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

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

Issue 2494333002: Replace wrapUnique(new T(args)) by makeUnique<T>(args) in Blink (Closed)
Patch Set: Drop redundant WTF:: Created 4 years, 1 month 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/PtrUtil.h" 9 #include "wtf/PtrUtil.h"
10 #include "wtf/Threading.h" 10 #include "wtf/Threading.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 WebThreadSupportingGC::~WebThreadSupportingGC() { 45 WebThreadSupportingGC::~WebThreadSupportingGC() {
46 if (ThreadState::current() && m_owningThread) { 46 if (ThreadState::current() && m_owningThread) {
47 // WebThread's destructor blocks until all the tasks are processed. 47 // WebThread's destructor blocks until all the tasks are processed.
48 SafePointScope scope(BlinkGC::HeapPointersOnStack); 48 SafePointScope scope(BlinkGC::HeapPointersOnStack);
49 m_owningThread.reset(); 49 m_owningThread.reset();
50 } 50 }
51 } 51 }
52 52
53 void WebThreadSupportingGC::initialize() { 53 void WebThreadSupportingGC::initialize() {
54 ThreadState::attachCurrentThread(m_threadHeapMode); 54 ThreadState::attachCurrentThread(m_threadHeapMode);
55 m_gcTaskRunner = wrapUnique(new GCTaskRunner(m_thread)); 55 m_gcTaskRunner = makeUnique<GCTaskRunner>(m_thread);
56 } 56 }
57 57
58 void WebThreadSupportingGC::shutdown() { 58 void WebThreadSupportingGC::shutdown() {
59 #if defined(LEAK_SANITIZER) 59 #if defined(LEAK_SANITIZER)
60 ThreadState::current()->releaseStaticPersistentNodes(); 60 ThreadState::current()->releaseStaticPersistentNodes();
61 #endif 61 #endif
62 // Ensure no posted tasks will run from this point on. 62 // Ensure no posted tasks will run from this point on.
63 m_gcTaskRunner.reset(); 63 m_gcTaskRunner.reset();
64 64
65 // Shutdown the thread (via its scheduler) only when the thread is created 65 // Shutdown the thread (via its scheduler) only when the thread is created
66 // and is owned by this instance. 66 // and is owned by this instance.
67 if (m_owningThread) 67 if (m_owningThread)
68 m_owningThread->scheduler()->shutdown(); 68 m_owningThread->scheduler()->shutdown();
69 69
70 ThreadState::detachCurrentThread(); 70 ThreadState::detachCurrentThread();
71 } 71 }
72 72
73 } // namespace blink 73 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698