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

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

Issue 9148051: Provide API support for weak handles and post-mortem finalization. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: a better strategy for protected handle checks Created 8 years, 11 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 | Annotate | Revision Log
OLDNEW
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 9
10 namespace dart { 10 namespace dart {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 // .... 53 // ....
54 // } 54 // }
55 55
56 56
57 // Forward declarations. 57 // Forward declarations.
58 class ObjectPointerVisitor; 58 class ObjectPointerVisitor;
59 59
60 60
61 class HandleVisitor { 61 class HandleVisitor {
62 public: 62 public:
63 virtual void Visit(uword* addr) = 0; 63 virtual void VisitHandle(uword* addr) = 0;
Ivan Posva 2012/01/12 23:30:38 uword is already an address type, so please just u
cshapiro 2012/01/13 01:30:03 Done (here and in the callers).
64 64
65 virtual ~HandleVisitor() { 65 virtual ~HandleVisitor() {
66 } 66 }
67 }; 67 };
68 68
69 69
70 template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr> 70 template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr>
71 class Handles { 71 class Handles {
72 public: 72 public:
73 Handles() 73 Handles()
74 : zone_blocks_(NULL), 74 : zone_blocks_(NULL),
75 first_scoped_block_(NULL), 75 first_scoped_block_(NULL),
76 scoped_blocks_(&first_scoped_block_) { 76 scoped_blocks_(&first_scoped_block_) {
77 } 77 }
78 ~Handles() { 78 ~Handles() {
79 DeleteAll(); 79 DeleteAll();
80 } 80 }
81 81
82 // Visit all object pointers stored in the various handles. 82 // Visit all object pointers stored in the various handles.
83 void VisitObjectPointers(ObjectPointerVisitor* visitor); 83 void VisitObjectPointers(ObjectPointerVisitor* visitor);
84 84
85 // Visits all of the various handles. 85 // Visit all of the various handles.
86 void Visit(HandleVisitor* visitor); 86 void Visit(HandleVisitor* visitor);
87 87
88 // Allocates a handle in the current handle scope. This handle is valid only 88 // Allocates a handle in the current handle scope. This handle is valid only
89 // in the current handle scope and is destroyed when the current handle 89 // in the current handle scope and is destroyed when the current handle
90 // scope ends. 90 // scope ends.
91 static uword AllocateHandle(Isolate* isolate); 91 static uword AllocateHandle(Isolate* isolate);
92 92
93 // Allocates a handle in the current zone. This handle will be destroyed 93 // Allocates a handle in the current zone. This handle will be destroyed
94 // when the current zone is destroyed. 94 // when the current zone is destroyed.
95 static uword AllocateZoneHandle(Isolate* isolate); 95 static uword AllocateZoneHandle(Isolate* isolate);
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 }; 315 };
316 #endif // defined(DEBUG) 316 #endif // defined(DEBUG)
317 317
318 // Macro to start a no handles scope in the code. 318 // Macro to start a no handles scope in the code.
319 #define NOHANDLESCOPE(isolate) \ 319 #define NOHANDLESCOPE(isolate) \
320 dart::NoHandleScope no_vm_internal_handles_scope_(isolate); 320 dart::NoHandleScope no_vm_internal_handles_scope_(isolate);
321 321
322 } // namespace dart 322 } // namespace dart
323 323
324 #endif // VM_HANDLES_H_ 324 #endif // VM_HANDLES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698