| 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_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/class_table.h" | 10 #include "vm/class_table.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 void set_ast_node_id(int value) { ast_node_id_ = value; } | 166 void set_ast_node_id(int value) { ast_node_id_ = value; } |
| 167 | 167 |
| 168 intptr_t computation_id() const { return computation_id_; } | 168 intptr_t computation_id() const { return computation_id_; } |
| 169 void set_computation_id(int value) { computation_id_ = value; } | 169 void set_computation_id(int value) { computation_id_ = value; } |
| 170 | 170 |
| 171 RawArray* ic_data_array() const { return ic_data_array_; } | 171 RawArray* ic_data_array() const { return ic_data_array_; } |
| 172 void set_ic_data_array(RawArray* value) { ic_data_array_ = value; } | 172 void set_ic_data_array(RawArray* value) { ic_data_array_ = value; } |
| 173 | 173 |
| 174 Debugger* debugger() const { return debugger_; } | 174 Debugger* debugger() const { return debugger_; } |
| 175 | 175 |
| 176 static void SetCreateCallback(Dart_IsolateCreateCallback cback); | 176 static void SetCreateCallback(Dart_IsolateCreateCallback cb) { |
| 177 static Dart_IsolateCreateCallback CreateCallback(); | 177 create_callback_ = cb; |
| 178 } |
| 179 static Dart_IsolateCreateCallback CreateCallback() { |
| 180 return create_callback_; |
| 181 } |
| 178 | 182 |
| 179 static void SetInterruptCallback(Dart_IsolateInterruptCallback cback); | 183 static void SetInterruptCallback(Dart_IsolateInterruptCallback cb) { |
| 180 static Dart_IsolateInterruptCallback InterruptCallback(); | 184 interrupt_callback_ = cb; |
| 185 } |
| 186 static Dart_IsolateInterruptCallback InterruptCallback() { |
| 187 return interrupt_callback_; |
| 188 } |
| 189 |
| 190 static void SetShutdownCallback(Dart_IsolateShutdownCallback cb) { |
| 191 shutdown_callback_ = cb; |
| 192 } |
| 193 static Dart_IsolateShutdownCallback ShutdownCallback() { |
| 194 return shutdown_callback_; |
| 195 } |
| 181 | 196 |
| 182 GcPrologueCallbacks& gc_prologue_callbacks() { | 197 GcPrologueCallbacks& gc_prologue_callbacks() { |
| 183 return gc_prologue_callbacks_; | 198 return gc_prologue_callbacks_; |
| 184 } | 199 } |
| 185 | 200 |
| 186 GcEpilogueCallbacks& gc_epilogue_callbacks() { | 201 GcEpilogueCallbacks& gc_epilogue_callbacks() { |
| 187 return gc_epilogue_callbacks_; | 202 return gc_epilogue_callbacks_; |
| 188 } | 203 } |
| 189 | 204 |
| 190 private: | 205 private: |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 Mutex* mutex_; // protects stack_limit_ and saved_stack_limit_. | 237 Mutex* mutex_; // protects stack_limit_ and saved_stack_limit_. |
| 223 uword stack_limit_; | 238 uword stack_limit_; |
| 224 uword saved_stack_limit_; | 239 uword saved_stack_limit_; |
| 225 MessageHandler* message_handler_; | 240 MessageHandler* message_handler_; |
| 226 uword spawn_data_; | 241 uword spawn_data_; |
| 227 GcPrologueCallbacks gc_prologue_callbacks_; | 242 GcPrologueCallbacks gc_prologue_callbacks_; |
| 228 GcEpilogueCallbacks gc_epilogue_callbacks_; | 243 GcEpilogueCallbacks gc_epilogue_callbacks_; |
| 229 | 244 |
| 230 static Dart_IsolateCreateCallback create_callback_; | 245 static Dart_IsolateCreateCallback create_callback_; |
| 231 static Dart_IsolateInterruptCallback interrupt_callback_; | 246 static Dart_IsolateInterruptCallback interrupt_callback_; |
| 247 static Dart_IsolateShutdownCallback shutdown_callback_; |
| 232 | 248 |
| 233 DISALLOW_COPY_AND_ASSIGN(Isolate); | 249 DISALLOW_COPY_AND_ASSIGN(Isolate); |
| 234 }; | 250 }; |
| 235 | 251 |
| 236 // When we need to execute code in an isolate, we use the | 252 // When we need to execute code in an isolate, we use the |
| 237 // StartIsolateScope. | 253 // StartIsolateScope. |
| 238 class StartIsolateScope { | 254 class StartIsolateScope { |
| 239 public: | 255 public: |
| 240 explicit StartIsolateScope(Isolate* new_isolate) | 256 explicit StartIsolateScope(Isolate* new_isolate) |
| 241 : new_isolate_(new_isolate), saved_isolate_(Isolate::Current()) { | 257 : new_isolate_(new_isolate), saved_isolate_(Isolate::Current()) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 Isolate* new_isolate_; | 309 Isolate* new_isolate_; |
| 294 Isolate* saved_isolate_; | 310 Isolate* saved_isolate_; |
| 295 uword saved_stack_limit_; | 311 uword saved_stack_limit_; |
| 296 | 312 |
| 297 DISALLOW_COPY_AND_ASSIGN(SwitchIsolateScope); | 313 DISALLOW_COPY_AND_ASSIGN(SwitchIsolateScope); |
| 298 }; | 314 }; |
| 299 | 315 |
| 300 } // namespace dart | 316 } // namespace dart |
| 301 | 317 |
| 302 #endif // VM_ISOLATE_H_ | 318 #endif // VM_ISOLATE_H_ |
| OLD | NEW |