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

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

Issue 1396323011: Native context: use import/export for Object observe related functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 5 years, 2 months 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
« no previous file with comments | « src/js/harmony-object-observe.js ('k') | src/js/prologue.js » ('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 // 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
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 })
OLDNEW
« no previous file with comments | « src/js/harmony-object-observe.js ('k') | src/js/prologue.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698