Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Merge pull request #71 from Polymer/issue_70
Browse files Browse the repository at this point in the history
fixes #70 -- move d8 specific code into d8_benchmark.js
  • Loading branch information
John Messerly committed Sep 5, 2014
2 parents e223268 + 50d3df5 commit b17a7aa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
15 changes: 15 additions & 0 deletions benchmark/d8_benchmarks.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@ var setTimeout = function(callback) {
callback();
}

var hasDebugForceFullDelivery = (function() {
try {
eval('%RunMicrotasks()');
return true;
} catch (ex) {
return false;
}
})();

if (hasDebugForceFullDelivery) {
Platform.performMicrotaskCheckpoint = function() {
eval('%RunMicrotasks()');
};
}

recordCount = 0;

var alert = print;
Expand Down
16 changes: 1 addition & 15 deletions src/observe.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
// Firefox OS Apps do not allow eval. This feature detection is very hacky
// but even if some other platform adds support for this function this code
// will continue to work.
if (navigator.getDeviceStorage) {
if (typeof navigator != 'undefined' && navigator.getDeviceStorage) {
return false;
}

Expand Down Expand Up @@ -794,26 +794,12 @@

var runningMicrotaskCheckpoint = false;

var hasDebugForceFullDelivery = hasObserve && hasEval && (function() {
try {
eval('%RunMicrotasks()');
return true;
} catch (ex) {
return false;
}
})();

global.Platform = global.Platform || {};

global.Platform.performMicrotaskCheckpoint = function() {
if (runningMicrotaskCheckpoint)
return;

if (hasDebugForceFullDelivery) {
eval('%RunMicrotasks()');
return;
}

if (!collectObservers)
return;

Expand Down

0 comments on commit b17a7aa

Please sign in to comment.