OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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_HANDLES_H_ | 5 #ifndef VM_HANDLES_H_ |
6 #define VM_HANDLES_H_ | 6 #define VM_HANDLES_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
10 #include "vm/os.h" | 10 #include "vm/os.h" |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 // { | 294 // { |
295 // HANDLESCOPE(thread); | 295 // HANDLESCOPE(thread); |
296 // .... | 296 // .... |
297 // ..... | 297 // ..... |
298 // code that creates some scoped handles. | 298 // code that creates some scoped handles. |
299 // .... | 299 // .... |
300 // } | 300 // } |
301 class HandleScope : public StackResource { | 301 class HandleScope : public StackResource { |
302 public: | 302 public: |
303 explicit HandleScope(Thread* thread); | 303 explicit HandleScope(Thread* thread); |
304 // DEPRECATED: Use Thread version. | |
305 explicit HandleScope(Isolate* isolate); | |
306 ~HandleScope(); | 304 ~HandleScope(); |
307 | 305 |
308 private: | 306 private: |
309 void Initialize(); | 307 void Initialize(); |
310 | 308 |
311 VMHandles::HandlesBlock* saved_handle_block_; // Handle block at prev scope. | 309 VMHandles::HandlesBlock* saved_handle_block_; // Handle block at prev scope. |
312 uword saved_handle_slot_; // Next available handle slot at previous scope. | 310 uword saved_handle_slot_; // Next available handle slot at previous scope. |
313 #if defined(DEBUG) | 311 #if defined(DEBUG) |
314 HandleScope* link_; // Link to previous scope. | 312 HandleScope* link_; // Link to previous scope. |
315 #endif | 313 #endif |
(...skipping 14 matching lines...) Expand all Loading... |
330 // NOHANDLESCOPE(thread); | 328 // NOHANDLESCOPE(thread); |
331 // .... | 329 // .... |
332 // ..... | 330 // ..... |
333 // critical code that manipulates dart objects directly. | 331 // critical code that manipulates dart objects directly. |
334 // .... | 332 // .... |
335 // } | 333 // } |
336 #if defined(DEBUG) | 334 #if defined(DEBUG) |
337 class NoHandleScope : public StackResource { | 335 class NoHandleScope : public StackResource { |
338 public: | 336 public: |
339 explicit NoHandleScope(Thread* thread); | 337 explicit NoHandleScope(Thread* thread); |
340 // DEPRECATED: Use Thread version. | |
341 explicit NoHandleScope(Isolate* isolate); | |
342 NoHandleScope(); | |
343 ~NoHandleScope(); | 338 ~NoHandleScope(); |
344 | 339 |
345 private: | 340 private: |
346 DISALLOW_COPY_AND_ASSIGN(NoHandleScope); | 341 DISALLOW_COPY_AND_ASSIGN(NoHandleScope); |
347 }; | 342 }; |
348 #else // defined(DEBUG) | 343 #else // defined(DEBUG) |
349 class NoHandleScope : public ValueObject { | 344 class NoHandleScope : public ValueObject { |
350 public: | 345 public: |
351 explicit NoHandleScope(Thread* thread) { } | 346 explicit NoHandleScope(Thread* thread) { } |
352 explicit NoHandleScope(Isolate* isolate) { } | 347 explicit NoHandleScope(Isolate* isolate) { } |
353 NoHandleScope() { } | 348 NoHandleScope() { } |
354 ~NoHandleScope() { } | 349 ~NoHandleScope() { } |
355 | 350 |
356 private: | 351 private: |
357 DISALLOW_COPY_AND_ASSIGN(NoHandleScope); | 352 DISALLOW_COPY_AND_ASSIGN(NoHandleScope); |
358 }; | 353 }; |
359 #endif // defined(DEBUG) | 354 #endif // defined(DEBUG) |
360 | 355 |
361 // Macro to start a no handles scope in the code. | 356 // Macro to start a no handles scope in the code. |
362 #define NOHANDLESCOPE(isolate_or_thread) \ | 357 #define NOHANDLESCOPE(isolate_or_thread) \ |
363 dart::NoHandleScope no_vm_internal_handles_scope_(isolate_or_thread); | 358 dart::NoHandleScope no_vm_internal_handles_scope_(isolate_or_thread); |
364 | 359 |
365 } // namespace dart | 360 } // namespace dart |
366 | 361 |
367 #endif // VM_HANDLES_H_ | 362 #endif // VM_HANDLES_H_ |
OLD | NEW |