OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef TOOLS_BLINK_GC_PLUGIN_EDGE_H_ | 5 #ifndef TOOLS_BLINK_GC_PLUGIN_EDGE_H_ |
6 #define TOOLS_BLINK_GC_PLUGIN_EDGE_H_ | 6 #define TOOLS_BLINK_GC_PLUGIN_EDGE_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "TracingStatus.h" | 10 #include "TracingStatus.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 virtual void VisitMember(Member*) {} | 32 virtual void VisitMember(Member*) {} |
33 virtual void VisitWeakMember(WeakMember*) {} | 33 virtual void VisitWeakMember(WeakMember*) {} |
34 virtual void VisitPersistent(Persistent*) {} | 34 virtual void VisitPersistent(Persistent*) {} |
35 virtual void VisitCollection(Collection*) {} | 35 virtual void VisitCollection(Collection*) {} |
36 }; | 36 }; |
37 | 37 |
38 // Recursive edge visitor. The traversed path is accessible in context. | 38 // Recursive edge visitor. The traversed path is accessible in context. |
39 class RecursiveEdgeVisitor : public EdgeVisitor { | 39 class RecursiveEdgeVisitor : public EdgeVisitor { |
40 public: | 40 public: |
41 // Overrides that recursively walk the edges and record the path. | 41 // Overrides that recursively walk the edges and record the path. |
42 virtual void VisitValue(Value*) override; | 42 void VisitValue(Value*) override; |
43 virtual void VisitRawPtr(RawPtr*) override; | 43 void VisitRawPtr(RawPtr*) override; |
44 virtual void VisitRefPtr(RefPtr*) override; | 44 void VisitRefPtr(RefPtr*) override; |
45 virtual void VisitOwnPtr(OwnPtr*) override; | 45 void VisitOwnPtr(OwnPtr*) override; |
46 virtual void VisitMember(Member*) override; | 46 void VisitMember(Member*) override; |
47 virtual void VisitWeakMember(WeakMember*) override; | 47 void VisitWeakMember(WeakMember*) override; |
48 virtual void VisitPersistent(Persistent*) override; | 48 void VisitPersistent(Persistent*) override; |
49 virtual void VisitCollection(Collection*) override; | 49 void VisitCollection(Collection*) override; |
50 | 50 |
51 protected: | 51 protected: |
52 typedef std::deque<Edge*> Context; | 52 typedef std::deque<Edge*> Context; |
53 Context& context() { return context_; } | 53 Context& context() { return context_; } |
54 Edge* Parent() { return context_.empty() ? 0 : context_.front(); } | 54 Edge* Parent() { return context_.empty() ? 0 : context_.front(); } |
55 void Enter(Edge* e) { return context_.push_front(e); } | 55 void Enter(Edge* e) { return context_.push_front(e); } |
56 void Leave() { context_.pop_front(); } | 56 void Leave() { context_.pop_front(); } |
57 | 57 |
58 // Default callback to overwrite in visitor subclass. | 58 // Default callback to overwrite in visitor subclass. |
59 virtual void AtValue(Value*); | 59 virtual void AtValue(Value*); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 } | 237 } |
238 | 238 |
239 private: | 239 private: |
240 RecordInfo* info_; | 240 RecordInfo* info_; |
241 Members members_; | 241 Members members_; |
242 bool on_heap_; | 242 bool on_heap_; |
243 bool is_root_; | 243 bool is_root_; |
244 }; | 244 }; |
245 | 245 |
246 #endif // TOOLS_BLINK_GC_PLUGIN_EDGE_H_ | 246 #endif // TOOLS_BLINK_GC_PLUGIN_EDGE_H_ |
OLD | NEW |