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

Unified Diff: src/object-observe.js

Issue 11410046: Object.deliverChangeRecords should remove the observer from activeObservers (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rename activeObservers to pendingObservers Created 8 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 | « no previous file | test/cctest/test-object-observe.cc » ('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 28aa1f4e4e988caf624efcfd72df9c5d83325e30..b8fcee406230c7a0f842f36c44fe098950916f80 100644
--- a/src/object-observe.js
+++ b/src/object-observe.js
@@ -35,7 +35,7 @@ if (IS_UNDEFINED(observationState.observerInfoMap)) {
observationState.observerInfoMap = %CreateObjectHashTable();
observationState.objectInfoMap = %CreateObjectHashTable();
observationState.notifierTargetMap = %CreateObjectHashTable();
- observationState.activeObservers = new InternalArray;
+ observationState.pendingObservers = new InternalArray;
observationState.observerPriority = 0;
}
@@ -117,7 +117,7 @@ function EnqueueChangeRecord(changeRecord, observers) {
for (var i = 0; i < observers.length; i++) {
var observer = observers[i];
var observerInfo = observerInfoMap.get(observer);
- observationState.activeObservers[observerInfo.priority] = observer;
+ observationState.pendingObservers[observerInfo.priority] = observer;
%SetObserverDeliveryPending();
if (IS_NULL(observerInfo.pendingChangeRecords)) {
observerInfo.pendingChangeRecords = new InternalArray(changeRecord);
@@ -200,6 +200,7 @@ function DeliverChangeRecordsForObserver(observer) {
return;
observerInfo.pendingChangeRecords = null;
+ delete observationState.pendingObservers[observerInfo.priority];
var delivered = [];
%MoveArrayContents(pendingChangeRecords, delivered);
try {
@@ -215,11 +216,11 @@ function ObjectDeliverChangeRecords(callback) {
}
function DeliverChangeRecords() {
- while (observationState.activeObservers.length) {
- var activeObservers = observationState.activeObservers;
- observationState.activeObservers = new InternalArray;
- for (var i in activeObservers) {
- DeliverChangeRecordsForObserver(activeObservers[i]);
+ while (observationState.pendingObservers.length) {
+ var pendingObservers = observationState.pendingObservers;
+ observationState.pendingObservers = new InternalArray;
+ for (var i in pendingObservers) {
+ DeliverChangeRecordsForObserver(pendingObservers[i]);
}
}
}
« no previous file with comments | « no previous file | test/cctest/test-object-observe.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698