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

Side by Side Diff: third_party/WebKit/Source/platform/heap/Visitor.cpp

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, 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
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 VisitorScope::VisitorScope(ThreadState* state, BlinkGC::GCType gcType)
14 : m_state(state) 14 : m_state(state)
15 { 15 {
16 // See ThreadState::runScheduledGC() why we need to already be in a 16 // See ThreadState::runScheduledGC() why we need to already be in a
17 // GCForbiddenScope before any safe point is entered. 17 // GCForbiddenScope before any safe point is entered.
18 m_state->enterGCForbiddenScope(); 18 m_state->enterGCForbiddenScope();
19 19
20 ASSERT(m_state->checkThread()); 20 ASSERT(m_state->checkThread());
21 21
22 switch (gcType) { 22 switch (gcType) {
23 case BlinkGC::GCWithSweep: 23 case BlinkGC::GCWithSweep:
24 case BlinkGC::GCWithoutSweep: 24 case BlinkGC::GCWithoutSweep:
25 m_visitor = adoptPtr(new MarkingVisitor<Visitor::GlobalMarking>()); 25 m_visitor = adoptPtr(new MarkingVisitor<Visitor::GlobalMarking>(this));
26 break; 26 break;
27 case BlinkGC::TakeSnapshot: 27 case BlinkGC::TakeSnapshot:
28 m_visitor = adoptPtr(new MarkingVisitor<Visitor::SnapshotMarking>()); 28 m_visitor = adoptPtr(new MarkingVisitor<Visitor::SnapshotMarking>(this)) ;
29 break; 29 break;
30 case BlinkGC::ThreadTerminationGC: 30 case BlinkGC::ThreadTerminationGC:
31 m_visitor = adoptPtr(new MarkingVisitor<Visitor::ThreadLocalMarking>()); 31 m_visitor = adoptPtr(new MarkingVisitor<Visitor::ThreadLocalMarking>(thi s));
32 break; 32 break;
33 case BlinkGC::ThreadLocalWeakProcessing: 33 case BlinkGC::ThreadLocalWeakProcessing:
34 m_visitor = adoptPtr(new MarkingVisitor<Visitor::WeakProcessing>()); 34 m_visitor = adoptPtr(new MarkingVisitor<Visitor::WeakProcessing>(this));
35 break; 35 break;
36 default: 36 default:
37 ASSERT_NOT_REACHED(); 37 ASSERT_NOT_REACHED();
38 } 38 }
39 } 39 }
40 40
41 VisitorScope::~VisitorScope() 41 VisitorScope::~VisitorScope()
42 { 42 {
43 m_state->leaveGCForbiddenScope(); 43 m_state->leaveGCForbiddenScope();
44 } 44 }
45 45
46 } // namespace blink 46 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698