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

Unified Diff: src/object-observe.js

Issue 11347037: Object.observe: generate change records for named properties. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing comments. 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 | « src/ic.cc ('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 dcf98d84aed1e66359b2c71d8f648733f7479922..41d7f3c608d593631600abdf7c5c493054cbce08 100644
--- a/src/object-observe.js
+++ b/src/object-observe.js
@@ -68,6 +68,7 @@ function ObjectObserve(object, callback) {
changeObservers: new InternalArray(callback)
};
objectInfoMap.set(object, objectInfo);
+ %SetIsObserved(object, true);
return;
}
@@ -109,6 +110,15 @@ function EnqueueChangeRecord(changeRecord, observers) {
}
}
+function NotifyChange(type, object, name, oldValue) {
+ var objectInfo = objectInfoMap.get(object);
+ var changeRecord = (arguments.length < 4) ?
+ { type: type, object: object, name: name } :
+ { type: type, object: object, name: name, oldValue: oldValue };
+ InternalObjectFreeze(changeRecord);
+ EnqueueChangeRecord(changeRecord, objectInfo.changeObservers);
+}
+
function ObjectNotify(object, changeRecord) {
// TODO: notifier needs to be [[THIS]]
if (!IS_STRING(changeRecord.type))
@@ -119,7 +129,7 @@ function ObjectNotify(object, changeRecord) {
return;
var newRecord = {
- object: object // TODO: Needs to be 'object' retreived from notifier
+ object: object // TODO: Needs to be 'object' retrieved from notifier
};
for (var prop in changeRecord) {
if (prop === 'object')
@@ -161,4 +171,4 @@ function SetupObjectObserve() {
));
}
-SetupObjectObserve();
+SetupObjectObserve();
« no previous file with comments | « src/ic.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698