| OLD | NEW |
| 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 #ifndef WebScheduler_h | 5 #ifndef WebScheduler_h |
| 6 #define WebScheduler_h | 6 #define WebScheduler_h |
| 7 | 7 |
| 8 #include "WebCommon.h" | 8 #include "WebCommon.h" |
| 9 #include "WebString.h" | 9 #include "WebString.h" |
| 10 #include "public/platform/WebTaskRunner.h" | 10 #include "public/platform/WebTaskRunner.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // Takes ownership of |IdleTask|. Can be called from any thread. | 59 // Takes ownership of |IdleTask|. Can be called from any thread. |
| 60 virtual void postIdleTask(const WebTraceLocation&, WebThread::IdleTask*) = 0
; | 60 virtual void postIdleTask(const WebTraceLocation&, WebThread::IdleTask*) = 0
; |
| 61 | 61 |
| 62 // Like postIdleTask but guarantees that the posted task will not run | 62 // Like postIdleTask but guarantees that the posted task will not run |
| 63 // nested within an already-running task. Posting an idle task as | 63 // nested within an already-running task. Posting an idle task as |
| 64 // non-nestable may not affect when the task gets run, or it could | 64 // non-nestable may not affect when the task gets run, or it could |
| 65 // make it run later than it normally would, but it won't make it | 65 // make it run later than it normally would, but it won't make it |
| 66 // run earlier than it normally would. | 66 // run earlier than it normally would. |
| 67 virtual void postNonNestableIdleTask(const WebTraceLocation&, WebThread::Idl
eTask*) = 0; | 67 virtual void postNonNestableIdleTask(const WebTraceLocation&, WebThread::Idl
eTask*) = 0; |
| 68 | 68 |
| 69 // Like postIdleTask but does not run the idle task until after some other | |
| 70 // task has run. This enables posting of a task which won't stop the Blink | |
| 71 // main thread from sleeping, but will start running after it wakes up. | |
| 72 // Takes ownership of |IdleTask|. Can be called from any thread. | |
| 73 virtual void postIdleTaskAfterWakeup(const WebTraceLocation&, WebThread::Idl
eTask*) = 0; | |
| 74 | |
| 75 // Returns a WebTaskRunner for loading tasks. Can be called from any thread. | 69 // Returns a WebTaskRunner for loading tasks. Can be called from any thread. |
| 76 virtual WebTaskRunner* loadingTaskRunner() = 0; | 70 virtual WebTaskRunner* loadingTaskRunner() = 0; |
| 77 | 71 |
| 78 // Returns a WebTaskRunner for timer tasks. Can be called from any thread. | 72 // Returns a WebTaskRunner for timer tasks. Can be called from any thread. |
| 79 virtual WebTaskRunner* timerTaskRunner() = 0; | 73 virtual WebTaskRunner* timerTaskRunner() = 0; |
| 80 | 74 |
| 81 // Creates a new WebViewScheduler for a given WebView. Must be called from | 75 // Creates a new WebViewScheduler for a given WebView. Must be called from |
| 82 // the associated WebThread. | 76 // the associated WebThread. |
| 83 virtual std::unique_ptr<WebViewScheduler> createWebViewScheduler(Interventio
nReporter*) = 0; | 77 virtual std::unique_ptr<WebViewScheduler> createWebViewScheduler(Interventio
nReporter*) = 0; |
| 84 | 78 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 104 | 98 |
| 105 // Tells the scheduler that an expected navigation was started. | 99 // Tells the scheduler that an expected navigation was started. |
| 106 virtual void onNavigationStarted() = 0; | 100 virtual void onNavigationStarted() = 0; |
| 107 | 101 |
| 108 #ifdef INSIDE_BLINK | 102 #ifdef INSIDE_BLINK |
| 109 // Helpers for posting bound functions as tasks. | 103 // Helpers for posting bound functions as tasks. |
| 110 typedef Function<void(double deadlineSeconds)> IdleTask; | 104 typedef Function<void(double deadlineSeconds)> IdleTask; |
| 111 | 105 |
| 112 void postIdleTask(const WebTraceLocation&, std::unique_ptr<IdleTask>); | 106 void postIdleTask(const WebTraceLocation&, std::unique_ptr<IdleTask>); |
| 113 void postNonNestableIdleTask(const WebTraceLocation&, std::unique_ptr<IdleTa
sk>); | 107 void postNonNestableIdleTask(const WebTraceLocation&, std::unique_ptr<IdleTa
sk>); |
| 114 void postIdleTaskAfterWakeup(const WebTraceLocation&, std::unique_ptr<IdleTa
sk>); | |
| 115 #endif | 108 #endif |
| 116 }; | 109 }; |
| 117 | 110 |
| 118 } // namespace blink | 111 } // namespace blink |
| 119 | 112 |
| 120 #endif // WebScheduler_h | 113 #endif // WebScheduler_h |
| OLD | NEW |