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

Side by Side 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, 9 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Visitor.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "platform/heap/Visitor.h" 5 #include "platform/heap/Visitor.h"
6 6
7 #include "platform/heap/BlinkGC.h" 7 #include "platform/heap/BlinkGC.h"
8 #include "platform/heap/MarkingVisitor.h" 8 #include "platform/heap/MarkingVisitor.h"
9 #include "platform/heap/ThreadState.h" 9 #include "platform/heap/ThreadState.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 VisitorScope::VisitorScope(ThreadState* state, BlinkGC::GCType gcType) 13 PassOwnPtr<Visitor> Visitor::create(ThreadState* state, BlinkGC::GCType gcType)
14 {
15 switch (gcType) {
16 case BlinkGC::GCWithSweep:
17 case BlinkGC::GCWithoutSweep:
18 return adoptPtr(new MarkingVisitor<Visitor::GlobalMarking>(state));
19 case BlinkGC::TakeSnapshot:
20 return adoptPtr(new MarkingVisitor<Visitor::SnapshotMarking>(state));
21 case BlinkGC::ThreadTerminationGC:
22 return adoptPtr(new MarkingVisitor<Visitor::ThreadLocalMarking>(state));
23 case BlinkGC::ThreadLocalWeakProcessing:
24 return adoptPtr(new MarkingVisitor<Visitor::WeakProcessing>(state));
25 default:
26 ASSERT_NOT_REACHED();
27 }
28 return nullptr;
29 }
30
31 Visitor::Visitor(ThreadState* state, MarkingMode markingMode)
14 : m_state(state) 32 : m_state(state)
33 , m_markingMode(markingMode)
15 { 34 {
16 // See ThreadState::runScheduledGC() why we need to already be in a 35 // See ThreadState::runScheduledGC() why we need to already be in a
17 // GCForbiddenScope before any safe point is entered. 36 // GCForbiddenScope before any safe point is entered.
18 m_state->enterGCForbiddenScope(); 37 m_state->enterGCForbiddenScope();
19 38
20 ASSERT(m_state->checkThread()); 39 ASSERT(m_state->checkThread());
21
22 switch (gcType) {
23 case BlinkGC::GCWithSweep:
24 case BlinkGC::GCWithoutSweep:
25 m_visitor = adoptPtr(new MarkingVisitor<Visitor::GlobalMarking>());
26 break;
27 case BlinkGC::TakeSnapshot:
28 m_visitor = adoptPtr(new MarkingVisitor<Visitor::SnapshotMarking>());
29 break;
30 case BlinkGC::ThreadTerminationGC:
31 m_visitor = adoptPtr(new MarkingVisitor<Visitor::ThreadLocalMarking>());
32 break;
33 case BlinkGC::ThreadLocalWeakProcessing:
34 m_visitor = adoptPtr(new MarkingVisitor<Visitor::WeakProcessing>());
35 break;
36 default:
37 ASSERT_NOT_REACHED();
38 }
39 } 40 }
40 41
41 VisitorScope::~VisitorScope() 42 Visitor::~Visitor()
42 { 43 {
43 m_state->leaveGCForbiddenScope(); 44 m_state->leaveGCForbiddenScope();
44 } 45 }
45 46
46 } // namespace blink 47 } // namespace blink
OLDNEW
« 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