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

Side by Side Diff: Source/platform/scheduler/CancellableTaskFactory.cpp

Issue 876623002: Adds a CancellableTaskFactory and exposes postLoadingTasks to Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "platform/scheduler/CancellableTaskFactory.h"
7
8 #include "platform/TraceLocation.h"
9 #include "public/platform/Platform.h"
10 #include "wtf/InstanceCounter.h"
11
12 namespace blink {
13
14 void CancellableTaskFactory::cancel()
15 {
16 m_weakPtrFactory.revokeAll();
17 }
18
19 WebThread::Task* CancellableTaskFactory::task()
20 {
21 m_weakPtrFactory.revokeAll();
Sami 2015/01/26 16:08:14 Perhaps just call cancel() here instead of duplica
alex clarke (OOO till 29th) 2015/01/26 17:00:45 Done.
22 return new CancellableTask(m_weakPtrFactory.createWeakPtr());
23 }
24
25 void CancellableTaskFactory::CancellableTask::run()
26 {
27 if (m_weakPtr.get())
28 m_weakPtr->runInternal();
Sami 2015/01/26 16:08:14 nit: I think you could call m_closure here directl
alex clarke (OOO till 29th) 2015/01/26 17:00:45 Done.
29 }
30
31 void CancellableTaskFactory::runInternal()
32 {
33 m_weakPtrFactory.revokeAll();
Sami 2015/01/26 16:08:14 Do we need to do this? Task::run is guaranteed to
alex clarke (OOO till 29th) 2015/01/26 17:00:45 Yes we do because there's code in the HTML parser
34 (*m_closure)();
35 }
36
37 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698