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

Side by Side Diff: public/platform/WebTaskRunner.h

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 | « public/platform/WebScheduler.h ('k') | public/platform/WebThread.h » ('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 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 #ifndef WebTaskRunner_h 5 #ifndef WebTaskRunner_h
6 #define WebTaskRunner_h 6 #define WebTaskRunner_h
7 7
8 #include "WebCommon.h" 8 #include "WebCommon.h"
9 9
10 #ifdef INSIDE_BLINK
11 #include "wtf/Functional.h"
12 #endif
13
10 namespace blink { 14 namespace blink {
11 15
12 class WebTraceLocation; 16 class WebTraceLocation;
13 17
14 // The blink representation of a chromium SingleThreadTaskRunner. 18 // The blink representation of a chromium SingleThreadTaskRunner.
15 class BLINK_PLATFORM_EXPORT WebTaskRunner { 19 class BLINK_PLATFORM_EXPORT WebTaskRunner {
16 public: 20 public:
17 virtual ~WebTaskRunner() {} 21 virtual ~WebTaskRunner() {}
18 22
19 class BLINK_PLATFORM_EXPORT Task { 23 class BLINK_PLATFORM_EXPORT Task {
20 public: 24 public:
21 virtual ~Task() { } 25 virtual ~Task() { }
22 virtual void run() = 0; 26 virtual void run() = 0;
23 }; 27 };
24 28
25 // Schedule a task to be run on the the associated WebThread. 29 // Schedule a task to be run on the the associated WebThread.
26 // Takes ownership of |Task|. Can be called from any thread. 30 // Takes ownership of |Task|. Can be called from any thread.
27 virtual void postTask(const WebTraceLocation&, Task*) {} 31 virtual void postTask(const WebTraceLocation&, Task*) {}
28 32
29 // Schedule a task to be run after |delayMs| on the the associated WebThread . 33 // Schedule a task to be run after |delayMs| on the the associated WebThread .
30 // Takes ownership of |Task|. Can be called from any thread. 34 // Takes ownership of |Task|. Can be called from any thread.
31 // TODO(alexclarke): Remove this when possible. 35 // TODO(alexclarke): Remove this when possible.
32 virtual void postDelayedTask(const WebTraceLocation&, Task*, long long delay Ms) {} 36 virtual void postDelayedTask(const WebTraceLocation&, Task*, long long delay Ms) {}
33 37
34 // Schedule a task to be run after |delayMs| on the the associated WebThread . 38 // Schedule a task to be run after |delayMs| on the the associated WebThread .
35 // Takes ownership of |Task|. Can be called from any thread. 39 // Takes ownership of |Task|. Can be called from any thread.
36 virtual void postDelayedTask(const WebTraceLocation&, Task*, double delayMs) {} 40 virtual void postDelayedTask(const WebTraceLocation&, Task*, double delayMs) {}
37 41
38 // TODO(alexclarke): Add helpers for posting bound functions as tasks. 42 #ifdef INSIDE_BLINK
43 // Helpers for posting bound functions as tasks.
44 typedef Function<void()> ClosureTask;
45
46 void postTask(const WebTraceLocation&, PassOwnPtr<ClosureTask>);
47 // TODO(alexclarke): Remove this when possible.
48 void postDelayedTask(const WebTraceLocation&, PassOwnPtr<ClosureTask>, long long delayMs);
49 void postDelayedTask(const WebTraceLocation&, PassOwnPtr<ClosureTask>, doubl e delayMs);
50 #endif
39 }; 51 };
40 52
41 } // namespace blink 53 } // namespace blink
42 54
43 #endif // WebTaskRunner_h 55 #endif // WebTaskRunner_h
OLDNEW
« no previous file with comments | « public/platform/WebScheduler.h ('k') | public/platform/WebThread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698