Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Unified Diff: webkit/port/bindings/v8/extensions/Interval.cpp

Issue 28201: Changes to the interval timer:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/data/layout_tests/chrome/fast/dom/extensions/interval-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/port/bindings/v8/extensions/Interval.cpp
===================================================================
--- webkit/port/bindings/v8/extensions/Interval.cpp (revision 10494)
+++ webkit/port/bindings/v8/extensions/Interval.cpp (working copy)
@@ -14,11 +14,15 @@
public:
IntervalExtensionWrapper() :
v8::Extension(kIntervalExtensionName,
- "native function HiResTime();"
- "function Interval() {"
+ "var chromium;"
+ "if (!chromium)"
+ " chromium = {};"
+ "chromium.Interval = function() {"
" var start_ = 0;"
" var stop_ = 0;"
+ " native function HiResTime();"
" this.start = function() {"
+ " stop_ = 0;"
" start_ = HiResTime();"
" };"
" this.stop = function() {"
@@ -27,9 +31,10 @@
" stop_ = 0;"
" };"
" this.microseconds = function() {"
- " if (stop_ == 0)"
- " stop();"
- " return Math.ceil((stop_ - start_) * 1000000);"
+ " var stop = stop_;"
+ " if (stop == 0 && start_ != 0)"
+ " stop = HiResTime();"
+ " return Math.ceil((stop - start_) * 1000000);"
" };"
"}") {};
« no previous file with comments | « webkit/data/layout_tests/chrome/fast/dom/extensions/interval-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698