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

Unified Diff: third_party/WebKit/Source/platform/heap/Visitor.h

Issue 1477023003: Refactor the Heap into ThreadHeap to prepare for per thread heaps Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/heap/Visitor.h
diff --git a/third_party/WebKit/Source/platform/heap/Visitor.h b/third_party/WebKit/Source/platform/heap/Visitor.h
index 443db172a7ead4857fe943db6881ba5ca5b2d90c..3943142a2dea80c7499d836917c49b66d425f76c 100644
--- a/third_party/WebKit/Source/platform/heap/Visitor.h
+++ b/third_party/WebKit/Source/platform/heap/Visitor.h
@@ -53,6 +53,7 @@ template<typename T> class TraceTrait;
template<typename T> class TraceEagerlyTrait;
class ThreadState;
class Visitor;
+class VisitorScope;
// The TraceMethodDelegate is used to convert a trace method for type T to a TraceCallback.
// This allows us to pass a type's trace method as a parameter to the PersistentNode
@@ -123,6 +124,8 @@ public:
template<typename Derived>
class VisitorHelper {
public:
+ VisitorHelper(VisitorScope* visitorScope) : m_visitorScope(visitorScope) {}
+
// One-argument templated mark method. This uses the static type of
// the argument to get the TraceTrait. By default, the mark method
// of the TraceTrait just calls the virtual two-argument mark method on this
@@ -283,9 +286,13 @@ public:
Derived::fromHelper(this)->registerWeakMembers(object, object, callback);
}
+ inline VisitorScope* visitorScope() const { return m_visitorScope; }
+
private:
template<typename T>
static void handleWeakCell(Visitor* self, void* object);
+
+ VisitorScope* m_visitorScope;
};
// Visitor is used to traverse the Blink object graph. Used for the
@@ -374,8 +381,9 @@ public:
inline MarkingMode markingMode() const { return m_markingMode; }
protected:
- explicit Visitor(MarkingMode markingMode)
- : m_markingMode(markingMode)
+ explicit Visitor(MarkingMode markingMode, VisitorScope* visitorScope)
+ : VisitorHelper(visitorScope)
+ , m_markingMode(markingMode)
{ }
virtual void registerWeakCellWithCallback(void**, WeakCallback) = 0;
@@ -387,12 +395,13 @@ private:
bool m_isGlobalMarkingVisitor;
};
-class VisitorScope final {
+class PLATFORM_EXPORT VisitorScope final {
haraken 2016/02/29 11:17:45 Can we unify the VisitorScope and the Visitor into
keishi 2016/03/02 06:01:03 Created https://codereview.chromium.org/1753623002
STACK_ALLOCATED();
public:
VisitorScope(ThreadState*, BlinkGC::GCType);
~VisitorScope();
Visitor* visitor() const { return m_visitor.get(); }
+ Heap& heap() const { return m_state->heap(); }
private:
ThreadState* m_state;

Powered by Google App Engine
This is Rietveld 408576698