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

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, 3 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 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 return deoptimized_code_array_; 695 return deoptimized_code_array_;
696 } 696 }
697 void set_deoptimized_code_array(const GrowableObjectArray& value); 697 void set_deoptimized_code_array(const GrowableObjectArray& value);
698 void TrackDeoptimizedCode(const Code& code); 698 void TrackDeoptimizedCode(const Code& code);
699 699
700 bool compilation_allowed() const { return compilation_allowed_; } 700 bool compilation_allowed() const { return compilation_allowed_; }
701 void set_compilation_allowed(bool allowed) { 701 void set_compilation_allowed(bool allowed) {
702 compilation_allowed_ = allowed; 702 compilation_allowed_ = allowed;
703 } 703 }
704 704
705 RawObject* InvokePendingExtensionCalls();
706 void AppendExtensionCall(const Instance& closure,
707 const String& method_name,
708 const Array& parameter_keys,
709 const Array& parameter_values,
710 const Instance& reply_port,
711 const Instance& id);
712 void RegisterExtensionHandler(const String& name, const Instance& closure);
713 RawInstance* LookupExtensionHandler(const String& name);
714
705 #if defined(DEBUG) 715 #if defined(DEBUG)
706 #define REUSABLE_HANDLE_SCOPE_ACCESSORS(object) \ 716 #define REUSABLE_HANDLE_SCOPE_ACCESSORS(object) \
707 void set_reusable_##object##_handle_scope_active(bool value) { \ 717 void set_reusable_##object##_handle_scope_active(bool value) { \
708 reusable_##object##_handle_scope_active_ = value; \ 718 reusable_##object##_handle_scope_active_ = value; \
709 } \ 719 } \
710 bool reusable_##object##_handle_scope_active() const { \ 720 bool reusable_##object##_handle_scope_active() const { \
711 return reusable_##object##_handle_scope_active_; \ 721 return reusable_##object##_handle_scope_active_; \
712 } 722 }
713 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_ACCESSORS) 723 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_ACCESSORS)
714 #undef REUSABLE_HANDLE_SCOPE_ACCESSORS 724 #undef REUSABLE_HANDLE_SCOPE_ACCESSORS
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 // Visit all object pointers. Caller must ensure concurrent sweeper is not 768 // Visit all object pointers. Caller must ensure concurrent sweeper is not
759 // running, and the visitor must not allocate. 769 // running, and the visitor must not allocate.
760 void VisitObjectPointers(ObjectPointerVisitor* visitor, 770 void VisitObjectPointers(ObjectPointerVisitor* visitor,
761 bool visit_prologue_weak_persistent_handles, 771 bool visit_prologue_weak_persistent_handles,
762 bool validate_frames); 772 bool validate_frames);
763 773
764 void set_user_tag(uword tag) { 774 void set_user_tag(uword tag) {
765 user_tag_ = tag; 775 user_tag_ = tag;
766 } 776 }
767 777
778 RawGrowableObjectArray* GetAndClearPendingExtensionCalls();
779 RawGrowableObjectArray* pending_extension_calls() const {
780 return pending_extension_calls_;
781 }
782 void set_pending_extension_calls(const GrowableObjectArray& value);
783 RawGrowableObjectArray* registered_extension_handlers() const {
784 return registered_extension_handlers_;
785 }
786 void set_registered_extension_handlers(const GrowableObjectArray& value);
787
768 void ClearMutatorThread() { 788 void ClearMutatorThread() {
769 mutator_thread_ = NULL; 789 mutator_thread_ = NULL;
770 } 790 }
771 void MakeCurrentThreadMutator(Thread* thread) { 791 void MakeCurrentThreadMutator(Thread* thread) {
772 ASSERT(thread == Thread::Current()); 792 ASSERT(thread == Thread::Current());
773 DEBUG_ASSERT(IsIsolateOf(thread)); 793 DEBUG_ASSERT(IsIsolateOf(thread));
774 mutator_thread_ = thread; 794 mutator_thread_ = thread;
775 } 795 }
776 #if defined(DEBUG) 796 #if defined(DEBUG)
777 bool IsIsolateOf(Thread* thread); 797 bool IsIsolateOf(Thread* thread);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 869
850 VMTagCounters vm_tag_counters_; 870 VMTagCounters vm_tag_counters_;
851 uword user_tag_; 871 uword user_tag_;
852 RawGrowableObjectArray* tag_table_; 872 RawGrowableObjectArray* tag_table_;
853 RawUserTag* current_tag_; 873 RawUserTag* current_tag_;
854 RawUserTag* default_tag_; 874 RawUserTag* default_tag_;
855 875
856 RawGrowableObjectArray* collected_closures_; 876 RawGrowableObjectArray* collected_closures_;
857 RawGrowableObjectArray* deoptimized_code_array_; 877 RawGrowableObjectArray* deoptimized_code_array_;
858 878
879 // We use 6 list entries for each pending service extension calls.
880 enum {
881 kPendingHandlerIndex = 0,
882 kPendingMethodNameIndex,
883 kPendingKeysIndex,
884 kPendingValuesIndex,
885 kPendingReplyPortIndex,
886 kPendingIdIndex,
887 kPendingEntrySize
888 };
889 RawGrowableObjectArray* pending_extension_calls_;
890
891 // We use 2 list entries for each registered extension handler.
892 enum {
893 kRegisteredNameIndex = 0,
894 kRegisteredHandlerIndex,
895 kRegisteredEntrySize
896 };
897 RawGrowableObjectArray* registered_extension_handlers_;
898
859 Metric* metrics_list_head_; 899 Metric* metrics_list_head_;
860 900
861 Counters counters_; 901 Counters counters_;
862 902
863 bool compilation_allowed_; 903 bool compilation_allowed_;
864 904
865 // TODO(23153): Move this out of Isolate/Thread. 905 // TODO(23153): Move this out of Isolate/Thread.
866 CHA* cha_; 906 CHA* cha_;
867 907
868 // Isolate list next pointer. 908 // Isolate list next pointer.
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 uint8_t* serialized_message_; 1109 uint8_t* serialized_message_;
1070 intptr_t serialized_message_len_; 1110 intptr_t serialized_message_len_;
1071 Isolate::Flags isolate_flags_; 1111 Isolate::Flags isolate_flags_;
1072 bool paused_; 1112 bool paused_;
1073 bool errors_are_fatal_; 1113 bool errors_are_fatal_;
1074 }; 1114 };
1075 1115
1076 } // namespace dart 1116 } // namespace dart
1077 1117
1078 #endif // VM_ISOLATE_H_ 1118 #endif // VM_ISOLATE_H_
OLDNEW
« no previous file with comments | « runtime/vm/dart_entry.cc ('k') | runtime/vm/isolate.cc » ('j') | runtime/vm/isolate.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698