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

Unified Diff: src/object-observe.js

Issue 362783002: Introduce debug events for Microtask queue. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: addressed Created 6 years, 6 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 | « src/debug-debugger.js ('k') | src/promise.js » ('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 a6277575086c96d4b027642d09331e66574ac115..9d80784d61690b4cf97bae0e7f907b59f7261720 100644
--- a/src/object-observe.js
+++ b/src/object-observe.js
@@ -45,6 +45,7 @@ function GetObservationStateJS() {
observationState.notifierObjectInfoMap = %ObservationWeakMapCreate();
observationState.pendingObservers = null;
observationState.nextCallbackPriority = 0;
+ observationState.lastMicrotaskId = 0;
}
return observationState;
@@ -421,7 +422,18 @@ function ObserverEnqueueIfActive(observer, objectInfo, changeRecord) {
var callbackInfo = CallbackInfoNormalize(callback);
if (IS_NULL(GetPendingObservers())) {
SetPendingObservers(nullProtoObject());
- %EnqueueMicrotask(ObserveMicrotaskRunner);
+ if (DEBUG_IS_ACTIVE) {
+ var id = ++GetObservationStateJS().lastMicrotaskId;
+ var name = "Object.observe";
+ %EnqueueMicrotask(function() {
+ %DebugAsyncTaskEvent({ type: "willHandle", id: id, name: name });
+ ObserveMicrotaskRunner();
+ %DebugAsyncTaskEvent({ type: "didHandle", id: id, name: name });
+ });
+ %DebugAsyncTaskEvent({ type: "enqueue", id: id, name: name });
+ } else {
+ %EnqueueMicrotask(ObserveMicrotaskRunner);
+ }
}
GetPendingObservers()[callbackInfo.priority] = callback;
callbackInfo.push(changeRecord);
« no previous file with comments | « src/debug-debugger.js ('k') | src/promise.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698