Bug 34742

Summary: [Qt] Optimize getCPUTime for Symbian
Product: WebKit Reporter: Janne Koskinen <koshuin>
Component: New BugsAssignee: Janne Koskinen <koshuin>
Status: RESOLVED FIXED    
Severity: Critical CC: commit-queue, hausmann, laszlo.gombos, webkit.review.bot
Priority: P2 Keywords: Qt
Version: 528+ (Nightly build)   
Hardware: S60 Hardware   
OS: S60 3rd edition   
Bug Depends on:    
Bug Blocks: 27065    
Attachments:
Description Flags
proposed fix for timeoutchecker.cpp
none
proposed fix for timeoutchecker.cpp style fixed none

Description Janne Koskinen 2010-02-09 00:32:04 PST
Running tst_QWebPage::infiniteLoopJS() will never exit (testrun timeout is 1h) and unit test executable stops responding. In order to exit the phone has to be rebooted.
When running the same test on emulator it will pass. So for some reason javascript execution on HW is not stopped.
Implications of this test is , if failing, that any JS code getting stuck or taking long will block the running thread.

Test was run on Nokia 5800 Express Music, Qt and QtWebkit built for armv5 urel using RVCT 2.2.
Comment 1 Janne Koskinen 2010-02-17 08:11:54 PST
This issue is caused by bug in Open C 1.6 implementation of gettimeofday().
gtod precision seems to vary from min. 1sec to several minutes i.e. calling gtod several times in a row will return the same value.

This value is then used in TimeoutChecker getCPUTime() to calculate time spent running the script causing the script never to be interrupted.
Comment 2 Janne Koskinen 2010-02-23 04:46:59 PST
Created attachment 49276 [details]
proposed fix for timeoutchecker.cpp

Patch contains a proper implementation of getCPUTime for Symbian. It works from Symbian 9.1 onwards i.e. S60 3rd edition and up as that is when GetCpuTime function was introduced.
Tested the the patch to run on Nokia N95 and Nokia 5800 Express Music. It is possible that some device doesn't implement the function or has it disabled, thus added assertion for debugging purposes to see if some device returns KErrNotSupported.

Also reported the gettimeofday -issue to Open C guys, so that will be fixed in future releases.
Comment 3 WebKit Review Bot 2010-02-23 04:51:37 PST
Attachment 49276 [details] did not pass style-queue:

Failed to run "WebKitTools/Scripts/check-webkit-style" exit_code: 1
JavaScriptCore/runtime/TimeoutChecker.cpp:92:  Missing space after ,  [whitespace/comma] [3]
Total errors found: 1 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Janne Koskinen 2010-02-23 05:01:10 PST
Created attachment 49278 [details]
proposed fix for timeoutchecker.cpp style fixed

fixed style issue with ,
Comment 5 Laszlo Gombos 2010-02-23 08:48:25 PST
I changed the title to better reflect what this patch does. Approach looks good to me I think Symbian specific code is justified here.
Comment 6 WebKit Commit Bot 2010-02-26 11:50:59 PST
Comment on attachment 49278 [details]
proposed fix for timeoutchecker.cpp style fixed

Clearing flags on attachment: 49278

Committed r55296: <http://trac.webkit.org/changeset/55296>
Comment 7 WebKit Commit Bot 2010-02-26 11:51:04 PST
All reviewed patches have been landed.  Closing bug.