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

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

Issue 1753623002: Merge VisitorScope to Visitor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added explicit 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
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Visitor.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/heap/Visitor.cpp
diff --git a/third_party/WebKit/Source/platform/heap/Visitor.cpp b/third_party/WebKit/Source/platform/heap/Visitor.cpp
index 575285dae0c896bfdf62befc8351adbe3fc429ae..6f5d00fbaf3f812f5692f202b3d57277f2a446e4 100644
--- a/third_party/WebKit/Source/platform/heap/Visitor.cpp
+++ b/third_party/WebKit/Source/platform/heap/Visitor.cpp
@@ -10,35 +10,36 @@
namespace blink {
-VisitorScope::VisitorScope(ThreadState* state, BlinkGC::GCType gcType)
- : m_state(state)
+PassOwnPtr<Visitor> Visitor::create(ThreadState* state, BlinkGC::GCType gcType)
{
- // See ThreadState::runScheduledGC() why we need to already be in a
- // GCForbiddenScope before any safe point is entered.
- m_state->enterGCForbiddenScope();
-
- ASSERT(m_state->checkThread());
-
switch (gcType) {
case BlinkGC::GCWithSweep:
case BlinkGC::GCWithoutSweep:
- m_visitor = adoptPtr(new MarkingVisitor<Visitor::GlobalMarking>());
- break;
+ return adoptPtr(new MarkingVisitor<Visitor::GlobalMarking>(state));
case BlinkGC::TakeSnapshot:
- m_visitor = adoptPtr(new MarkingVisitor<Visitor::SnapshotMarking>());
- break;
+ return adoptPtr(new MarkingVisitor<Visitor::SnapshotMarking>(state));
case BlinkGC::ThreadTerminationGC:
- m_visitor = adoptPtr(new MarkingVisitor<Visitor::ThreadLocalMarking>());
- break;
+ return adoptPtr(new MarkingVisitor<Visitor::ThreadLocalMarking>(state));
case BlinkGC::ThreadLocalWeakProcessing:
- m_visitor = adoptPtr(new MarkingVisitor<Visitor::WeakProcessing>());
- break;
+ return adoptPtr(new MarkingVisitor<Visitor::WeakProcessing>(state));
default:
ASSERT_NOT_REACHED();
}
+ return nullptr;
+}
+
+Visitor::Visitor(ThreadState* state, MarkingMode markingMode)
+ : m_state(state)
+ , m_markingMode(markingMode)
+{
+ // See ThreadState::runScheduledGC() why we need to already be in a
+ // GCForbiddenScope before any safe point is entered.
+ m_state->enterGCForbiddenScope();
+
+ ASSERT(m_state->checkThread());
}
-VisitorScope::~VisitorScope()
+Visitor::~Visitor()
{
m_state->leaveGCForbiddenScope();
}
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Visitor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698