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

Side by Side Diff: runtime/vm/isolate.h

Issue 1299493007: Rework service extensions to be safe (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_ISOLATE_H_ 5 #ifndef VM_ISOLATE_H_
6 #define VM_ISOLATE_H_ 6 #define VM_ISOLATE_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "vm/atomic.h" 10 #include "vm/atomic.h"
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 return deoptimized_code_array_; 696 return deoptimized_code_array_;
697 } 697 }
698 void set_deoptimized_code_array(const GrowableObjectArray& value); 698 void set_deoptimized_code_array(const GrowableObjectArray& value);
699 void TrackDeoptimizedCode(const Code& code); 699 void TrackDeoptimizedCode(const Code& code);
700 700
701 bool compilation_allowed() const { return compilation_allowed_; } 701 bool compilation_allowed() const { return compilation_allowed_; }
702 void set_compilation_allowed(bool allowed) { 702 void set_compilation_allowed(bool allowed) {
703 compilation_allowed_ = allowed; 703 compilation_allowed_ = allowed;
704 } 704 }
705 705
706 RawObject* InvokePendingExtensionCalls();
707 void AppendExtensionCall(const Instance& closure,
708 const String& method_name,
709 const Array& parameter_keys,
710 const Array& parameter_values,
711 const Instance& reply_port,
712 const Instance& id);
713 void RegisterExtensionHandler(const String& name, const Instance& closure);
714 RawInstance* LookupExtensionHandler(const String& name);
715
706 #if defined(DEBUG) 716 #if defined(DEBUG)
707 #define REUSABLE_HANDLE_SCOPE_ACCESSORS(object) \ 717 #define REUSABLE_HANDLE_SCOPE_ACCESSORS(object) \
708 void set_reusable_##object##_handle_scope_active(bool value) { \ 718 void set_reusable_##object##_handle_scope_active(bool value) { \
709 reusable_##object##_handle_scope_active_ = value; \ 719 reusable_##object##_handle_scope_active_ = value; \
710 } \ 720 } \
711 bool reusable_##object##_handle_scope_active() const { \ 721 bool reusable_##object##_handle_scope_active() const { \
712 return reusable_##object##_handle_scope_active_; \ 722 return reusable_##object##_handle_scope_active_; \
713 } 723 }
714 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_ACCESSORS) 724 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_ACCESSORS)
715 #undef REUSABLE_HANDLE_SCOPE_ACCESSORS 725 #undef REUSABLE_HANDLE_SCOPE_ACCESSORS
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 // Visit all object pointers. Caller must ensure concurrent sweeper is not 769 // Visit all object pointers. Caller must ensure concurrent sweeper is not
760 // running, and the visitor must not allocate. 770 // running, and the visitor must not allocate.
761 void VisitObjectPointers(ObjectPointerVisitor* visitor, 771 void VisitObjectPointers(ObjectPointerVisitor* visitor,
762 bool visit_prologue_weak_persistent_handles, 772 bool visit_prologue_weak_persistent_handles,
763 bool validate_frames); 773 bool validate_frames);
764 774
765 void set_user_tag(uword tag) { 775 void set_user_tag(uword tag) {
766 user_tag_ = tag; 776 user_tag_ = tag;
767 } 777 }
768 778
779 RawGrowableObjectArray* GetAndClearPendingExtensionCalls();
780 RawGrowableObjectArray* pending_extension_calls() const {
781 return pending_extension_calls_;
782 }
783 void set_pending_extension_calls(const GrowableObjectArray& value);
784 RawGrowableObjectArray* registered_extension_handlers() const {
785 return registered_extension_handlers_;
786 }
787 void set_registered_extension_handlers(const GrowableObjectArray& value);
788
769 void ClearMutatorThread() { 789 void ClearMutatorThread() {
770 mutator_thread_ = NULL; 790 mutator_thread_ = NULL;
771 } 791 }
772 void MakeCurrentThreadMutator(Thread* thread) { 792 void MakeCurrentThreadMutator(Thread* thread) {
773 ASSERT(thread == Thread::Current()); 793 ASSERT(thread == Thread::Current());
774 DEBUG_ASSERT(IsIsolateOf(thread)); 794 DEBUG_ASSERT(IsIsolateOf(thread));
775 mutator_thread_ = thread; 795 mutator_thread_ = thread;
776 } 796 }
777 #if defined(DEBUG) 797 #if defined(DEBUG)
778 bool IsIsolateOf(Thread* thread); 798 bool IsIsolateOf(Thread* thread);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 870
851 VMTagCounters vm_tag_counters_; 871 VMTagCounters vm_tag_counters_;
852 uword user_tag_; 872 uword user_tag_;
853 RawGrowableObjectArray* tag_table_; 873 RawGrowableObjectArray* tag_table_;
854 RawUserTag* current_tag_; 874 RawUserTag* current_tag_;
855 RawUserTag* default_tag_; 875 RawUserTag* default_tag_;
856 876
857 RawGrowableObjectArray* collected_closures_; 877 RawGrowableObjectArray* collected_closures_;
858 RawGrowableObjectArray* deoptimized_code_array_; 878 RawGrowableObjectArray* deoptimized_code_array_;
859 879
880 // We use 6 list entries for each pending service extension calls.
881 enum {
882 kPendingHandlerIndex = 0,
883 kPendingMethodNameIndex,
884 kPendingKeysIndex,
885 kPendingValuesIndex,
886 kPendingReplyPortIndex,
887 kPendingIdIndex,
888 kPendingEntrySize
889 };
890 RawGrowableObjectArray* pending_extension_calls_;
891
892 // We use 2 list entries for each register extension handler.
Ivan Posva 2015/08/26 04:47:00 register -> registered
Cutch 2015/08/26 14:28:00 Done.
893 enum {
894 kRegisteredNameIndex = 0,
895 kRegisteredHandlerIndex,
896 kRegisteredEntrySize
897 };
898 RawGrowableObjectArray* registered_extension_handlers_;
899
860 Metric* metrics_list_head_; 900 Metric* metrics_list_head_;
861 901
862 Counters counters_; 902 Counters counters_;
863 903
864 bool compilation_allowed_; 904 bool compilation_allowed_;
865 905
866 // TODO(23153): Move this out of Isolate/Thread. 906 // TODO(23153): Move this out of Isolate/Thread.
867 CHA* cha_; 907 CHA* cha_;
868 908
869 // Isolate list next pointer. 909 // Isolate list next pointer.
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 uint8_t* serialized_message_; 1110 uint8_t* serialized_message_;
1071 intptr_t serialized_message_len_; 1111 intptr_t serialized_message_len_;
1072 Isolate::Flags isolate_flags_; 1112 Isolate::Flags isolate_flags_;
1073 bool paused_; 1113 bool paused_;
1074 bool errors_are_fatal_; 1114 bool errors_are_fatal_;
1075 }; 1115 };
1076 1116
1077 } // namespace dart 1117 } // namespace dart
1078 1118
1079 #endif // VM_ISOLATE_H_ 1119 #endif // VM_ISOLATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698