OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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_BASE_ISOLATE_H_ | 5 #ifndef VM_BASE_ISOLATE_H_ |
6 #define VM_BASE_ISOLATE_H_ | 6 #define VM_BASE_ISOLATE_H_ |
7 | 7 |
8 namespace dart { | 8 namespace dart { |
9 | 9 |
10 class HandleScope; | 10 class HandleScope; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 #endif | 73 #endif |
74 } | 74 } |
75 | 75 |
76 void DecrementNoGCScopeDepth() { | 76 void DecrementNoGCScopeDepth() { |
77 #if defined(DEBUG) | 77 #if defined(DEBUG) |
78 ASSERT(no_gc_scope_depth_ > 0); | 78 ASSERT(no_gc_scope_depth_ > 0); |
79 no_gc_scope_depth_ -= 1; | 79 no_gc_scope_depth_ -= 1; |
80 #endif | 80 #endif |
81 } | 81 } |
82 | 82 |
| 83 int32_t no_callback_scope_depth() const { |
| 84 return no_callback_scope_depth_; |
| 85 } |
| 86 |
| 87 void IncrementNoCallbackScopeDepth() { |
| 88 ASSERT(no_callback_scope_depth_ < INT_MAX); |
| 89 no_callback_scope_depth_ += 1; |
| 90 } |
| 91 |
| 92 void DecrementNoCallbackScopeDepth() { |
| 93 ASSERT(no_callback_scope_depth_ > 0); |
| 94 no_callback_scope_depth_ -= 1; |
| 95 } |
| 96 |
83 #if defined(DEBUG) | 97 #if defined(DEBUG) |
84 static void AssertCurrent(BaseIsolate* isolate); | 98 static void AssertCurrent(BaseIsolate* isolate); |
85 #endif | 99 #endif |
86 | 100 |
87 protected: | 101 protected: |
88 BaseIsolate() | 102 BaseIsolate() |
89 : top_resource_(NULL), | 103 : top_resource_(NULL), |
| 104 current_zone_(NULL), |
90 #if defined(DEBUG) | 105 #if defined(DEBUG) |
91 current_zone_(NULL), | |
92 top_handle_scope_(NULL), | 106 top_handle_scope_(NULL), |
93 no_handle_scope_depth_(0), | 107 no_handle_scope_depth_(0), |
94 no_gc_scope_depth_(0) | 108 no_gc_scope_depth_(0), |
95 #else | |
96 current_zone_(NULL) | |
97 #endif | 109 #endif |
| 110 no_callback_scope_depth_(0) |
98 {} | 111 {} |
99 | 112 |
100 ~BaseIsolate() { | 113 ~BaseIsolate() { |
101 // Do not delete stack resources: top_resource_ and current_zone_. | 114 // Do not delete stack resources: top_resource_ and current_zone_. |
102 } | 115 } |
103 | 116 |
104 StackResource* top_resource_; | 117 StackResource* top_resource_; |
105 Zone* current_zone_; | 118 Zone* current_zone_; |
106 #if defined(DEBUG) | 119 #if defined(DEBUG) |
107 HandleScope* top_handle_scope_; | 120 HandleScope* top_handle_scope_; |
108 int32_t no_handle_scope_depth_; | 121 int32_t no_handle_scope_depth_; |
109 int32_t no_gc_scope_depth_; | 122 int32_t no_gc_scope_depth_; |
110 #endif | 123 #endif |
| 124 int32_t no_callback_scope_depth_; |
111 | 125 |
112 DISALLOW_COPY_AND_ASSIGN(BaseIsolate); | 126 DISALLOW_COPY_AND_ASSIGN(BaseIsolate); |
113 }; | 127 }; |
114 | 128 |
115 } // namespace dart | 129 } // namespace dart |
116 | 130 |
117 #endif // VM_BASE_ISOLATE_H_ | 131 #endif // VM_BASE_ISOLATE_H_ |
OLD | NEW |