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_VISITOR_H_ | 5 #ifndef VM_VISITOR_H_ |
6 #define VM_VISITOR_H_ | 6 #define VM_VISITOR_H_ |
7 | 7 |
8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
9 | 9 |
10 namespace dart { | 10 namespace dart { |
(...skipping 23 matching lines...) Expand all Loading... |
34 private: | 34 private: |
35 Isolate* isolate_; | 35 Isolate* isolate_; |
36 | 36 |
37 DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectPointerVisitor); | 37 DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectPointerVisitor); |
38 }; | 38 }; |
39 | 39 |
40 | 40 |
41 // An object visitor interface. | 41 // An object visitor interface. |
42 class ObjectVisitor { | 42 class ObjectVisitor { |
43 public: | 43 public: |
| 44 explicit ObjectVisitor(Isolate* isolate) : isolate_(isolate) {} |
| 45 |
44 virtual ~ObjectVisitor() {} | 46 virtual ~ObjectVisitor() {} |
45 | 47 |
| 48 Isolate* isolate() const { return isolate_; } |
| 49 |
46 // Invoked for each object. | 50 // Invoked for each object. |
47 virtual void VisitObject(RawObject* obj) = 0; | 51 virtual void VisitObject(RawObject* obj) = 0; |
| 52 |
| 53 private: |
| 54 Isolate* isolate_; |
| 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(ObjectVisitor); |
48 }; | 57 }; |
49 | 58 |
50 | 59 |
51 // An object finder visitor interface. | 60 // An object finder visitor interface. |
52 class FindObjectVisitor { | 61 class FindObjectVisitor { |
53 public: | 62 public: |
54 explicit FindObjectVisitor(Isolate* isolate) : isolate_(isolate) {} | 63 explicit FindObjectVisitor(Isolate* isolate) : isolate_(isolate) {} |
55 virtual ~FindObjectVisitor() {} | 64 virtual ~FindObjectVisitor() {} |
56 | 65 |
57 // Check if object matches find condition. | 66 // Check if object matches find condition. |
58 virtual bool FindObject(RawObject* obj) = 0; | 67 virtual bool FindObject(RawObject* obj) = 0; |
59 | 68 |
60 private: | 69 private: |
61 Isolate* isolate_; | 70 Isolate* isolate_; |
62 | 71 |
63 DISALLOW_IMPLICIT_CONSTRUCTORS(FindObjectVisitor); | 72 DISALLOW_IMPLICIT_CONSTRUCTORS(FindObjectVisitor); |
64 }; | 73 }; |
65 | 74 |
66 } // namespace dart | 75 } // namespace dart |
67 | 76 |
68 #endif // VM_VISITOR_H_ | 77 #endif // VM_VISITOR_H_ |
OLD | NEW |