OLD | NEW |
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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 var index = changeObservers.indexOf(callback); | 110 var index = changeObservers.indexOf(callback); |
111 if (index >= 0) { | 111 if (index >= 0) { |
112 changeObservers.splice(index, 1); | 112 changeObservers.splice(index, 1); |
113 if (changeObservers.length === 0) %SetIsObserved(object, false); | 113 if (changeObservers.length === 0) %SetIsObserved(object, false); |
114 } | 114 } |
115 | 115 |
116 return object; | 116 return object; |
117 } | 117 } |
118 | 118 |
119 function EnqueueChangeRecord(changeRecord, observers) { | 119 function EnqueueChangeRecord(changeRecord, observers) { |
| 120 // TODO(rossberg): adjust once there is a story for symbols vs proxies. |
| 121 if (IS_SYMBOL(changeRecord.name)) return; |
| 122 |
120 for (var i = 0; i < observers.length; i++) { | 123 for (var i = 0; i < observers.length; i++) { |
121 var observer = observers[i]; | 124 var observer = observers[i]; |
122 var observerInfo = observerInfoMap.get(observer); | 125 var observerInfo = observerInfoMap.get(observer); |
123 observationState.pendingObservers[observerInfo.priority] = observer; | 126 observationState.pendingObservers[observerInfo.priority] = observer; |
124 %SetObserverDeliveryPending(); | 127 %SetObserverDeliveryPending(); |
125 if (IS_NULL(observerInfo.pendingChangeRecords)) { | 128 if (IS_NULL(observerInfo.pendingChangeRecords)) { |
126 observerInfo.pendingChangeRecords = new InternalArray(changeRecord); | 129 observerInfo.pendingChangeRecords = new InternalArray(changeRecord); |
127 } else { | 130 } else { |
128 observerInfo.pendingChangeRecords.push(changeRecord); | 131 observerInfo.pendingChangeRecords.push(changeRecord); |
129 } | 132 } |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 "getNotifier", ObjectGetNotifier, | 229 "getNotifier", ObjectGetNotifier, |
227 "observe", ObjectObserve, | 230 "observe", ObjectObserve, |
228 "unobserve", ObjectUnobserve | 231 "unobserve", ObjectUnobserve |
229 )); | 232 )); |
230 InstallFunctions(notifierPrototype, DONT_ENUM, $Array( | 233 InstallFunctions(notifierPrototype, DONT_ENUM, $Array( |
231 "notify", ObjectNotifierNotify | 234 "notify", ObjectNotifierNotify |
232 )); | 235 )); |
233 } | 236 } |
234 | 237 |
235 SetupObjectObserve(); | 238 SetupObjectObserve(); |
OLD | NEW |