OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 "use strict"; | 5 "use strict"; |
6 | 6 |
7 // Overview: | 7 // Overview: |
8 // | 8 // |
9 // This file contains all of the routing and accounting for Object.observe. | 9 // This file contains all of the routing and accounting for Object.observe. |
10 // User code will interact with these mechanisms via the Object.observe APIs | 10 // User code will interact with these mechanisms via the Object.observe APIs |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 } | 412 } |
413 | 413 |
414 var callback = ObserverGetCallback(observer); | 414 var callback = ObserverGetCallback(observer); |
415 if (!%ObserverObjectAndRecordHaveSameOrigin(callback, changeRecord.object, | 415 if (!%ObserverObjectAndRecordHaveSameOrigin(callback, changeRecord.object, |
416 changeRecord)) { | 416 changeRecord)) { |
417 return; | 417 return; |
418 } | 418 } |
419 | 419 |
420 var callbackInfo = CallbackInfoNormalize(callback); | 420 var callbackInfo = CallbackInfoNormalize(callback); |
421 if (IS_NULL(GetPendingObservers())) { | 421 if (IS_NULL(GetPendingObservers())) { |
422 SetPendingObservers(nullProtoObject()) | 422 SetPendingObservers(nullProtoObject()); |
423 EnqueueMicrotask(ObserveMicrotaskRunner); | 423 %EnqueueMicrotask(ObserveMicrotaskRunner); |
424 } | 424 } |
425 GetPendingObservers()[callbackInfo.priority] = callback; | 425 GetPendingObservers()[callbackInfo.priority] = callback; |
426 callbackInfo.push(changeRecord); | 426 callbackInfo.push(changeRecord); |
427 } | 427 } |
428 | 428 |
429 function ObjectInfoEnqueueExternalChangeRecord(objectInfo, changeRecord, type) { | 429 function ObjectInfoEnqueueExternalChangeRecord(objectInfo, changeRecord, type) { |
430 if (!ObjectInfoHasActiveObservers(objectInfo)) | 430 if (!ObjectInfoHasActiveObservers(objectInfo)) |
431 return; | 431 return; |
432 | 432 |
433 var hasType = !IS_UNDEFINED(type); | 433 var hasType = !IS_UNDEFINED(type); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 "observe", ArrayObserve, | 630 "observe", ArrayObserve, |
631 "unobserve", ArrayUnobserve | 631 "unobserve", ArrayUnobserve |
632 )); | 632 )); |
633 InstallFunctions(notifierPrototype, DONT_ENUM, $Array( | 633 InstallFunctions(notifierPrototype, DONT_ENUM, $Array( |
634 "notify", ObjectNotifierNotify, | 634 "notify", ObjectNotifierNotify, |
635 "performChange", ObjectNotifierPerformChange | 635 "performChange", ObjectNotifierPerformChange |
636 )); | 636 )); |
637 } | 637 } |
638 | 638 |
639 SetupObjectObserve(); | 639 SetupObjectObserve(); |
OLD | NEW |