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

Unified Diff: src/object-observe.js

Issue 64223010: Harmony promises (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: "Renamed .when to .chain; Dmitry's comments" Created 7 years, 1 month 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 | « src/messages.js ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/object-observe.js
diff --git a/src/object-observe.js b/src/object-observe.js
index 73a5d34c7ca2bcff899f60402f6fa15cb71e6042..dfa57b8312640bbdf972b5eb1bb15a6f7aba5894 100644
--- a/src/object-observe.js
+++ b/src/object-observe.js
@@ -384,7 +384,7 @@ function ObserverEnqueueIfActive(observer, objectInfo, changeRecord,
observationState.pendingObservers = { __proto__: null };
observationState.pendingObservers[callbackInfo.priority] = callback;
callbackInfo.push(changeRecord);
- %SetObserverDeliveryPending();
+ %SetMicrotaskPending(true);
}
function ObjectInfoEnqueueExternalChangeRecord(objectInfo, changeRecord, type) {
@@ -551,7 +551,7 @@ function CallbackDeliverPending(callback) {
try {
%_CallFunction(UNDEFINED, delivered, callback);
- } catch (ex) {}
+ } catch (ex) {} // TODO(rossberg): perhaps log uncaught exceptions.
return true;
}
@@ -562,15 +562,16 @@ function ObjectDeliverChangeRecords(callback) {
while (CallbackDeliverPending(callback)) {}
}
-function DeliverChangeRecords() {
- while (observationState.pendingObservers) {
- var pendingObservers = observationState.pendingObservers;
+function ObserveMicrotaskRunner() {
+ var pendingObservers = observationState.pendingObservers;
+ if (pendingObservers) {
observationState.pendingObservers = null;
for (var i in pendingObservers) {
CallbackDeliverPending(pendingObservers[i]);
}
}
}
+RunMicrotasks.runners.push(ObserveMicrotaskRunner);
function SetupObjectObserve() {
%CheckIsBootstrapping();
« no previous file with comments | « src/messages.js ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698