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

Side by Side Diff: Source/platform/scheduler/CancellableTaskFactory.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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/scheduler/CancellableTaskFactory.h" 6 #include "platform/scheduler/CancellableTaskFactory.h"
7 7
8 #include "public/platform/Platform.h" 8 #include "public/platform/Platform.h"
9 #include "wtf/InstanceCounter.h" 9 #include "wtf/InstanceCounter.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 void CancellableTaskFactory::cancel() 13 void CancellableTaskFactory::cancel()
14 { 14 {
15 m_weakPtrFactory.revokeAll(); 15 m_weakPtrFactory.revokeAll();
16 } 16 }
17 17
18 WebThread::Task* CancellableTaskFactory::cancelAndCreate() 18 WebTaskRunner::Task* CancellableTaskFactory::cancelAndCreate()
19 { 19 {
20 cancel(); 20 cancel();
21 return new CancellableTask(m_weakPtrFactory.createWeakPtr()); 21 return new CancellableTask(m_weakPtrFactory.createWeakPtr());
22 } 22 }
23 23
24 NO_LAZY_SWEEP_SANITIZE_ADDRESS 24 NO_LAZY_SWEEP_SANITIZE_ADDRESS
25 void CancellableTaskFactory::CancellableTask::run() 25 void CancellableTaskFactory::CancellableTask::run()
26 { 26 {
27 if (CancellableTaskFactory* taskFactory = m_weakPtr.get()) { 27 if (CancellableTaskFactory* taskFactory = m_weakPtr.get()) {
28 #if defined(ADDRESS_SANITIZER) 28 #if defined(ADDRESS_SANITIZER)
29 if (taskFactory->m_unpoisonBeforeUpdate) 29 if (taskFactory->m_unpoisonBeforeUpdate)
30 ASAN_UNPOISON_MEMORY_REGION(reinterpret_cast<unsigned char*>(taskFac tory), sizeof(CancellableTaskFactory)); 30 ASAN_UNPOISON_MEMORY_REGION(reinterpret_cast<unsigned char*>(taskFac tory), sizeof(CancellableTaskFactory));
31 #endif 31 #endif
32 Closure* closure = taskFactory->m_closure.get(); 32 Closure* closure = taskFactory->m_closure.get();
33 taskFactory->m_weakPtrFactory.revokeAll(); 33 taskFactory->m_weakPtrFactory.revokeAll();
34 (*closure)(); 34 (*closure)();
35 } 35 }
36 } 36 }
37 37
38 } // namespace blink 38 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/scheduler/CancellableTaskFactory.h ('k') | Source/platform/scheduler/CancellableTaskFactoryTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698