OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 virtual ~TaskObserver() { } | 63 virtual ~TaskObserver() { } |
64 virtual void willProcessTask() = 0; | 64 virtual void willProcessTask() = 0; |
65 virtual void didProcessTask() = 0; | 65 virtual void didProcessTask() = 0; |
66 }; | 66 }; |
67 | 67 |
68 // postTask() and postDelayedTask() take ownership of the passed Task | 68 // postTask() and postDelayedTask() take ownership of the passed Task |
69 // object. It is safe to invoke postTask() and postDelayedTask() from any | 69 // object. It is safe to invoke postTask() and postDelayedTask() from any |
70 // thread. | 70 // thread. |
71 virtual void postTask(const WebTraceLocation&, Task*) = 0; | 71 virtual void postTask(const WebTraceLocation&, Task*) = 0; |
72 virtual void postDelayedTask(const WebTraceLocation&, Task*, long long delay
Ms) = 0; | 72 virtual void postDelayedTask(const WebTraceLocation&, Task*, long long delay
Ms) = 0; |
| 73 virtual void postIdleTask(const blink::WebTraceLocation&, IdleTask*) = 0; |
| 74 virtual void postIdleTaskAfterWakeup(const blink::WebTraceLocation&, IdleTas
k*) = 0; |
73 | 75 |
74 virtual bool isCurrentThread() const = 0; | 76 virtual bool isCurrentThread() const = 0; |
75 virtual PlatformThreadId threadId() const { return 0; } | 77 virtual PlatformThreadId threadId() const { return 0; } |
76 | 78 |
77 virtual void addTaskObserver(TaskObserver*) { } | 79 virtual void addTaskObserver(TaskObserver*) { } |
78 virtual void removeTaskObserver(TaskObserver*) { } | 80 virtual void removeTaskObserver(TaskObserver*) { } |
79 | 81 |
80 // enterRunLoop() processes tasks posted to this WebThread. This call does n
ot return until some task calls exitRunLoop(). | 82 // enterRunLoop() processes tasks posted to this WebThread. This call does n
ot return until some task calls exitRunLoop(). |
81 // WebThread does not support nesting, meaning that once the run loop is ent
ered for a given WebThread it is not valid to | 83 // WebThread does not support nesting, meaning that once the run loop is ent
ered for a given WebThread it is not valid to |
82 // call enterRunLoop() again. | 84 // call enterRunLoop() again. |
83 virtual void enterRunLoop() = 0; | 85 virtual void enterRunLoop() = 0; |
84 | 86 |
85 // exitRunLoop() runs tasks until there are no tasks available to run, then
returns control to the caller of enterRunLoop(). | 87 // exitRunLoop() runs tasks until there are no tasks available to run, then
returns control to the caller of enterRunLoop(). |
86 // Must be called when the WebThread is running. | 88 // Must be called when the WebThread is running. |
87 virtual void exitRunLoop() = 0; | 89 virtual void exitRunLoop() = 0; |
88 | 90 |
89 virtual ~WebThread() { } | 91 virtual ~WebThread() { } |
90 | 92 |
91 #ifdef INSIDE_BLINK | 93 #ifdef INSIDE_BLINK |
92 // Helpers for posting bound functions as tasks. | 94 // Helpers for posting bound functions as tasks. |
93 void postTask(const WebTraceLocation&, PassOwnPtr<Function<void()>>); | 95 void postTask(const WebTraceLocation&, PassOwnPtr<Function<void()>>); |
94 void postDelayedTask(const WebTraceLocation&, PassOwnPtr<Function<void()>>,
long long delayMs); | 96 void postDelayedTask(const WebTraceLocation&, PassOwnPtr<Function<void()>>,
long long delayMs); |
95 #endif | 97 #endif |
96 }; | 98 }; |
97 | 99 |
98 } // namespace blink | 100 } // namespace blink |
99 | 101 |
100 #endif | 102 #endif |
OLD | NEW |