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

Side by Side Diff: src/object-observe.js

Issue 11414094: Make Object.observe on the global object functional (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add test for attaching via Context::New Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 InternalObjectHashTable.prototype = { 43 InternalObjectHashTable.prototype = {
44 get: function(key) { 44 get: function(key) {
45 return %ObjectHashTableGet(observationState[this.tableName], key); 45 return %ObjectHashTableGet(observationState[this.tableName], key);
46 }, 46 },
47 set: function(key, value) { 47 set: function(key, value) {
48 observationState[this.tableName] = 48 observationState[this.tableName] =
49 %ObjectHashTableSet(observationState[this.tableName], key, value); 49 %ObjectHashTableSet(observationState[this.tableName], key, value);
50 }, 50 },
51 has: function(key) { 51 has: function(key) {
52 return %ObjectHashTableHas(observationState[this.tableName], key); 52 return !IS_UNDEFINED(this.get(key));
53 } 53 }
54 }; 54 };
55 55
56 var observerInfoMap = new InternalObjectHashTable('observerInfoMap'); 56 var observerInfoMap = new InternalObjectHashTable('observerInfoMap');
57 var objectInfoMap = new InternalObjectHashTable('objectInfoMap'); 57 var objectInfoMap = new InternalObjectHashTable('objectInfoMap');
58 var notifierTargetMap = new InternalObjectHashTable('notifierTargetMap'); 58 var notifierTargetMap = new InternalObjectHashTable('notifierTargetMap');
59 59
60 function CreateObjectInfo(object) { 60 function CreateObjectInfo(object) {
61 var info = { 61 var info = {
62 changeObservers: new InternalArray, 62 changeObservers: new InternalArray,
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 "getNotifier", ObjectGetNotifier, 233 "getNotifier", ObjectGetNotifier,
234 "observe", ObjectObserve, 234 "observe", ObjectObserve,
235 "unobserve", ObjectUnobserve 235 "unobserve", ObjectUnobserve
236 )); 236 ));
237 InstallFunctions(notifierPrototype, DONT_ENUM, $Array( 237 InstallFunctions(notifierPrototype, DONT_ENUM, $Array(
238 "notify", ObjectNotifierNotify 238 "notify", ObjectNotifierNotify
239 )); 239 ));
240 } 240 }
241 241
242 SetupObjectObserve(); 242 SetupObjectObserve();
OLDNEW
« no previous file with comments | « no previous file | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698