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

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

Issue 1303153005: Introduce WebTaskRunner Patch 3/5 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add missing #include Created 5 years, 3 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 | « Source/platform/WebThreadSupportingGC.h ('k') | Source/platform/audio/HRTFDatabaseLoader.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "config.h" 5 #include "config.h"
6 #include "platform/WebThreadSupportingGC.h" 6 #include "platform/WebThreadSupportingGC.h"
7 7
8 #include "platform/heap/SafePoint.h" 8 #include "platform/heap/SafePoint.h"
9 #include "public/platform/WebScheduler.h" 9 #include "public/platform/WebScheduler.h"
10 #include "wtf/Threading.h" 10 #include "wtf/Threading.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 SafePointScope scope(ThreadState::HeapPointersOnStack); 44 SafePointScope scope(ThreadState::HeapPointersOnStack);
45 m_owningThread.clear(); 45 m_owningThread.clear();
46 } 46 }
47 } 47 }
48 48
49 void WebThreadSupportingGC::initialize() 49 void WebThreadSupportingGC::initialize()
50 { 50 {
51 m_pendingGCRunner = adoptPtr(new PendingGCRunner); 51 m_pendingGCRunner = adoptPtr(new PendingGCRunner);
52 m_thread->addTaskObserver(m_pendingGCRunner.get()); 52 m_thread->addTaskObserver(m_pendingGCRunner.get());
53 ThreadState::attach(); 53 ThreadState::attach();
54 OwnPtr<MessageLoopInterruptor> interruptor = adoptPtr(new MessageLoopInterru ptor(m_thread)); 54 OwnPtr<MessageLoopInterruptor> interruptor = adoptPtr(new MessageLoopInterru ptor(m_thread->taskRunner()));
55 ThreadState::current()->addInterruptor(interruptor.release()); 55 ThreadState::current()->addInterruptor(interruptor.release());
56 } 56 }
57 57
58 void WebThreadSupportingGC::shutdown() 58 void WebThreadSupportingGC::shutdown()
59 { 59 {
60 // Ensure no posted tasks will run from this point on. 60 // Ensure no posted tasks will run from this point on.
61 m_thread->removeTaskObserver(m_pendingGCRunner.get()); 61 m_thread->removeTaskObserver(m_pendingGCRunner.get());
62 62
63 // Shutdown the thread (via its scheduler) only when the thread is created 63 // Shutdown the thread (via its scheduler) only when the thread is created
64 // and is owned by this instance. 64 // and is owned by this instance.
65 if (m_owningThread) 65 if (m_owningThread)
66 m_owningThread->scheduler()->shutdown(); 66 m_owningThread->scheduler()->shutdown();
67 67
68 ThreadState::detach(); 68 ThreadState::detach();
69 m_pendingGCRunner = nullptr; 69 m_pendingGCRunner = nullptr;
70 } 70 }
71 71
72 } // namespace blink 72 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/WebThreadSupportingGC.h ('k') | Source/platform/audio/HRTFDatabaseLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698