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 var $observeEnqueueSpliceRecord; | |
6 var $observeBeginPerformSplice; | |
7 var $observeEndPerformSplice; | |
8 | |
9 var $observeObjectMethods; | |
10 var $observeArrayMethods; | |
11 | |
12 (function(global, utils) { | 5 (function(global, utils) { |
13 | 6 |
14 "use strict"; | 7 "use strict"; |
15 | 8 |
16 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
17 | 10 |
18 // ------------------------------------------------------------------- | 11 // ------------------------------------------------------------------- |
19 // Imports | 12 // Imports |
20 | 13 |
21 var GlobalArray = global.Array; | 14 var GlobalArray = global.Array; |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 } | 670 } |
678 } | 671 } |
679 | 672 |
680 // ------------------------------------------------------------------- | 673 // ------------------------------------------------------------------- |
681 | 674 |
682 utils.InstallFunctions(notifierPrototype, DONT_ENUM, [ | 675 utils.InstallFunctions(notifierPrototype, DONT_ENUM, [ |
683 "notify", ObjectNotifierNotify, | 676 "notify", ObjectNotifierNotify, |
684 "performChange", ObjectNotifierPerformChange | 677 "performChange", ObjectNotifierPerformChange |
685 ]); | 678 ]); |
686 | 679 |
687 $observeObjectMethods = [ | 680 var ObserveObjectMethods = [ |
688 "deliverChangeRecords", ObjectDeliverChangeRecords, | 681 "deliverChangeRecords", ObjectDeliverChangeRecords, |
689 "getNotifier", ObjectGetNotifier, | 682 "getNotifier", ObjectGetNotifier, |
690 "observe", ObjectObserve, | 683 "observe", ObjectObserve, |
691 "unobserve", ObjectUnobserve | 684 "unobserve", ObjectUnobserve |
692 ]; | 685 ]; |
693 $observeArrayMethods = [ | 686 |
| 687 var ObserveArrayMethods = [ |
694 "observe", ArrayObserve, | 688 "observe", ArrayObserve, |
695 "unobserve", ArrayUnobserve | 689 "unobserve", ArrayUnobserve |
696 ]; | 690 ]; |
697 | 691 |
698 // TODO(adamk): Figure out why this prototype removal has to | 692 // TODO(adamk): Figure out why this prototype removal has to |
699 // happen as part of initial snapshotting. | 693 // happen as part of initial snapshotting. |
700 var removePrototypeFn = function(f, i) { | 694 var removePrototypeFn = function(f, i) { |
701 if (i % 2 === 1) %FunctionRemovePrototype(f); | 695 if (i % 2 === 1) %FunctionRemovePrototype(f); |
702 }; | 696 }; |
703 $observeObjectMethods.forEach(removePrototypeFn); | 697 ObserveObjectMethods.forEach(removePrototypeFn); |
704 $observeArrayMethods.forEach(removePrototypeFn); | 698 ObserveArrayMethods.forEach(removePrototypeFn); |
705 | |
706 $observeEnqueueSpliceRecord = EnqueueSpliceRecord; | |
707 $observeBeginPerformSplice = BeginPerformSplice; | |
708 $observeEndPerformSplice = EndPerformSplice; | |
709 | 699 |
710 %InstallToContext([ | 700 %InstallToContext([ |
711 "native_object_get_notifier", NativeObjectGetNotifier, | 701 "native_object_get_notifier", NativeObjectGetNotifier, |
712 "native_object_notifier_perform_change", NativeObjectNotifierPerformChange, | 702 "native_object_notifier_perform_change", NativeObjectNotifierPerformChange, |
713 "native_object_observe", NativeObjectObserve, | 703 "native_object_observe", NativeObjectObserve, |
714 "observers_begin_perform_splice", BeginPerformSplice, | 704 "observers_begin_perform_splice", BeginPerformSplice, |
715 "observers_end_perform_splice", EndPerformSplice, | 705 "observers_end_perform_splice", EndPerformSplice, |
716 "observers_enqueue_splice", EnqueueSpliceRecord, | 706 "observers_enqueue_splice", EnqueueSpliceRecord, |
717 "observers_notify_change", NotifyChange, | 707 "observers_notify_change", NotifyChange, |
718 ]); | 708 ]); |
719 | 709 |
| 710 utils.Export(function(to) { |
| 711 to.ObserveArrayMethods = ObserveArrayMethods; |
| 712 to.ObserveBeginPerformSplice = BeginPerformSplice; |
| 713 to.ObserveEndPerformSplice = EndPerformSplice; |
| 714 to.ObserveEnqueueSpliceRecord = EnqueueSpliceRecord; |
| 715 to.ObserveObjectMethods = ObserveObjectMethods; |
| 716 }); |
| 717 |
720 }) | 718 }) |
OLD | NEW |