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

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

Issue 2481873005: clang-format runtime/vm (Closed)
Patch Set: Merge Created 4 years, 1 month 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
« no previous file with comments | « runtime/vm/virtual_memory_win.cc ('k') | runtime/vm/weak_code.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 RUNTIME_VM_VISITOR_H_ 5 #ifndef RUNTIME_VM_VISITOR_H_
6 #define RUNTIME_VM_VISITOR_H_ 6 #define RUNTIME_VM_VISITOR_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
11 11
12 namespace dart { 12 namespace dart {
13 13
14 // Forward declarations. 14 // Forward declarations.
15 class Isolate; 15 class Isolate;
16 class RawObject; 16 class RawObject;
17 17
18 // An object pointer visitor interface. 18 // An object pointer visitor interface.
19 class ObjectPointerVisitor { 19 class ObjectPointerVisitor {
20 public: 20 public:
21 explicit ObjectPointerVisitor(Isolate* isolate) : isolate_(isolate) { } 21 explicit ObjectPointerVisitor(Isolate* isolate) : isolate_(isolate) {}
22 virtual ~ObjectPointerVisitor() { } 22 virtual ~ObjectPointerVisitor() {}
23 23
24 Isolate* isolate() const { return isolate_; } 24 Isolate* isolate() const { return isolate_; }
25 25
26 // Range of pointers to visit 'first' <= pointer <= 'last'. 26 // Range of pointers to visit 'first' <= pointer <= 'last'.
27 virtual void VisitPointers(RawObject** first, RawObject** last) = 0; 27 virtual void VisitPointers(RawObject** first, RawObject** last) = 0;
28 28
29 virtual bool visit_function_code() const { return true; } 29 virtual bool visit_function_code() const { return true; }
30 virtual void add_skipped_code_function(RawFunction* funct) { 30 virtual void add_skipped_code_function(RawFunction* funct) { UNREACHABLE(); }
31 UNREACHABLE();
32 }
33 // len argument is the number of pointers to visit starting from 'p'. 31 // len argument is the number of pointers to visit starting from 'p'.
34 void VisitPointers(RawObject** p, intptr_t len) { 32 void VisitPointers(RawObject** p, intptr_t len) {
35 VisitPointers(p, (p + len - 1)); 33 VisitPointers(p, (p + len - 1));
36 } 34 }
37 35
38 void VisitPointer(RawObject** p) { VisitPointers(p , p); } 36 void VisitPointer(RawObject** p) { VisitPointers(p, p); }
39 37
40 private: 38 private:
41 Isolate* isolate_; 39 Isolate* isolate_;
42 NoSafepointScope no_safepoints_; 40 NoSafepointScope no_safepoints_;
43 41
44 DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectPointerVisitor); 42 DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectPointerVisitor);
45 }; 43 };
46 44
47 45
48 // An object visitor interface. 46 // An object visitor interface.
49 class ObjectVisitor { 47 class ObjectVisitor {
50 public: 48 public:
51 ObjectVisitor() { } 49 ObjectVisitor() {}
52 50
53 virtual ~ObjectVisitor() { } 51 virtual ~ObjectVisitor() {}
54 52
55 // Invoked for each object. 53 // Invoked for each object.
56 virtual void VisitObject(RawObject* obj) = 0; 54 virtual void VisitObject(RawObject* obj) = 0;
57 55
58 private: 56 private:
59 DISALLOW_COPY_AND_ASSIGN(ObjectVisitor); 57 DISALLOW_COPY_AND_ASSIGN(ObjectVisitor);
60 }; 58 };
61 59
62 60
63 // An object finder visitor interface. 61 // An object finder visitor interface.
64 class FindObjectVisitor { 62 class FindObjectVisitor {
65 public: 63 public:
66 FindObjectVisitor() { } 64 FindObjectVisitor() {}
67 virtual ~FindObjectVisitor() { } 65 virtual ~FindObjectVisitor() {}
68 66
69 // Allow to specify a address filter. 67 // Allow to specify a address filter.
70 virtual uword filter_addr() const { return 0; } 68 virtual uword filter_addr() const { return 0; }
71 bool VisitRange(uword begin_addr, uword end_addr) const { 69 bool VisitRange(uword begin_addr, uword end_addr) const {
72 uword addr = filter_addr(); 70 uword addr = filter_addr();
73 return (addr == 0) || ((begin_addr <= addr) && (addr < end_addr)); 71 return (addr == 0) || ((begin_addr <= addr) && (addr < end_addr));
74 } 72 }
75 73
76 // Check if object matches find condition. 74 // Check if object matches find condition.
77 virtual bool FindObject(RawObject* obj) const = 0; 75 virtual bool FindObject(RawObject* obj) const = 0;
78 76
79 private: 77 private:
80 DISALLOW_COPY_AND_ASSIGN(FindObjectVisitor); 78 DISALLOW_COPY_AND_ASSIGN(FindObjectVisitor);
81 }; 79 };
82 80
83 } // namespace dart 81 } // namespace dart
84 82
85 #endif // RUNTIME_VM_VISITOR_H_ 83 #endif // RUNTIME_VM_VISITOR_H_
OLDNEW
« no previous file with comments | « runtime/vm/virtual_memory_win.cc ('k') | runtime/vm/weak_code.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698