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

Unified Diff: sdk/lib/_internal/js_runtime/lib/preambles/d8.js

Issue 3011503002: Revert "Add ticks counter to Timer." (Closed)
Patch Set: Created 3 years, 4 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 | « sdk/lib/_internal/js_runtime/lib/isolate_helper.dart ('k') | sdk/lib/async/timer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/js_runtime/lib/preambles/d8.js
diff --git a/sdk/lib/_internal/js_runtime/lib/preambles/d8.js b/sdk/lib/_internal/js_runtime/lib/preambles/d8.js
index 00f2485248e46a10871650dad74ae93d801b0ae9..ca9093756e46bee93a6cdc15d041a9c7a6811376 100644
--- a/sdk/lib/_internal/js_runtime/lib/preambles/d8.js
+++ b/sdk/lib/_internal/js_runtime/lib/preambles/d8.js
@@ -15,6 +15,7 @@ if (typeof global != "undefined") self = global; // Node.js.
"use strict"; // Should be first statement of this function.
// Location (Uri.base)
+
var baseUri = 'org-dartlang-d8-preamble:///mock/uri/base/';
if (typeof process != "undefined" &&
typeof process.cwd == "function") {
@@ -77,7 +78,7 @@ if (typeof global != "undefined") self = global; // Node.js.
var id = timerIdCounter++;
f.$timerId = id;
timerIds[id] = f;
- if (ms == 0 && !isNextTimerDue()) {
+ if (ms == 0) {
zeroTimerQueue.push(f);
} else {
addDelayedTimer(f, ms);
@@ -126,10 +127,7 @@ if (typeof global != "undefined") self = global; // Node.js.
var originalDate = Date;
var originalNow = originalDate.now;
function advanceTimeTo(time) {
- var now = originalNow();
- if (timeOffset < time - now) {
- timeOffset = time - now;
- }
+ timeOffset = time - originalNow();
}
function installMockDate() {
var NewDate = function Date(Y, M, D, h, m, s, ms) {
@@ -174,12 +172,6 @@ if (typeof global != "undefined") self = global; // Node.js.
}
}
- function isNextTimerDue() {
- if (timerHeap.length == 0) return false;
- var head = timerHeap[0];
- return head[0] < originalNow() + timeOffset;
- }
-
function nextDelayedTimerQueue() {
if (timerHeap.length == 0) return null;
var result = timerHeap[0];
@@ -269,7 +261,7 @@ if (typeof global != "undefined") self = global; // Node.js.
// Global properties. "self" refers to the global object, so adding a
// property to "self" defines a global variable.
- self.self = self;
+ self.self = self
self.dartMainRunner = function(main, args) {
// Initialize.
var action = function() { main(args); }
« no previous file with comments | « sdk/lib/_internal/js_runtime/lib/isolate_helper.dart ('k') | sdk/lib/async/timer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698