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

Side by Side Diff: third_party/WebKit/Source/platform/WebThreadSupportingGC.cpp

Issue 1892713003: Prepare for multiple ThreadHeaps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 7 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 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 #include "platform/WebThreadSupportingGC.h" 5 #include "platform/WebThreadSupportingGC.h"
6 6
7 #include "platform/heap/SafePoint.h" 7 #include "platform/heap/SafePoint.h"
8 #include "public/platform/WebScheduler.h" 8 #include "public/platform/WebScheduler.h"
9 #include "wtf/Threading.h" 9 #include "wtf/Threading.h"
10 10
(...skipping 29 matching lines...) Expand all
40 { 40 {
41 if (ThreadState::current() && m_owningThread) { 41 if (ThreadState::current() && m_owningThread) {
42 // WebThread's destructor blocks until all the tasks are processed. 42 // WebThread's destructor blocks until all the tasks are processed.
43 SafePointScope scope(BlinkGC::HeapPointersOnStack); 43 SafePointScope scope(BlinkGC::HeapPointersOnStack);
44 m_owningThread.clear(); 44 m_owningThread.clear();
45 } 45 }
46 } 46 }
47 47
48 void WebThreadSupportingGC::initialize() 48 void WebThreadSupportingGC::initialize()
49 { 49 {
50 ThreadState::attach(); 50 ThreadState::attachCurrentThread();
51 m_gcTaskRunner = adoptPtr(new GCTaskRunner(m_thread)); 51 m_gcTaskRunner = adoptPtr(new GCTaskRunner(m_thread));
52 } 52 }
53 53
54 void WebThreadSupportingGC::shutdown() 54 void WebThreadSupportingGC::shutdown()
55 { 55 {
56 #if defined(LEAK_SANITIZER) 56 #if defined(LEAK_SANITIZER)
57 ThreadState::current()->releaseStaticPersistentNodes(); 57 ThreadState::current()->releaseStaticPersistentNodes();
58 #endif 58 #endif
59 // Ensure no posted tasks will run from this point on. 59 // Ensure no posted tasks will run from this point on.
60 m_gcTaskRunner.clear(); 60 m_gcTaskRunner.clear();
61 61
62 // Shutdown the thread (via its scheduler) only when the thread is created 62 // Shutdown the thread (via its scheduler) only when the thread is created
63 // and is owned by this instance. 63 // and is owned by this instance.
64 if (m_owningThread) 64 if (m_owningThread)
65 m_owningThread->scheduler()->shutdown(); 65 m_owningThread->scheduler()->shutdown();
66 66
67 ThreadState::detach(); 67 ThreadState::detachCurrentThread();
68 } 68 }
69 69
70 } // namespace blink 70 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/WrapperTypeInfo.h ('k') | third_party/WebKit/Source/platform/exported/Platform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698