| 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 "public/platform/WebPassOwnPtr.h" | |
| 10 #include "public/platform/WebTaskRunner.h" | 9 #include "public/platform/WebTaskRunner.h" |
| 11 #include "public/platform/WebThread.h" | 10 #include "public/platform/WebThread.h" |
| 12 #include "public/platform/WebViewScheduler.h" | 11 #include "public/platform/WebViewScheduler.h" |
| 13 | 12 |
| 13 #include <memory> |
| 14 |
| 14 namespace blink { | 15 namespace blink { |
| 15 | 16 |
| 16 class WebTraceLocation; | 17 class WebTraceLocation; |
| 17 class WebView; | 18 class WebView; |
| 18 | 19 |
| 19 // This class is used to submit tasks and pass other information from Blink to | 20 // This class is used to submit tasks and pass other information from Blink to |
| 20 // the platform's scheduler. | 21 // the platform's scheduler. |
| 21 class BLINK_PLATFORM_EXPORT WebScheduler { | 22 class BLINK_PLATFORM_EXPORT WebScheduler { |
| 22 public: | 23 public: |
| 23 virtual ~WebScheduler() { } | 24 virtual ~WebScheduler() { } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 virtual void postIdleTaskAfterWakeup(const WebTraceLocation&, WebThread::Idl
eTask*) = 0; | 62 virtual void postIdleTaskAfterWakeup(const WebTraceLocation&, WebThread::Idl
eTask*) = 0; |
| 62 | 63 |
| 63 // Returns a WebTaskRunner for loading tasks. Can be called from any thread. | 64 // Returns a WebTaskRunner for loading tasks. Can be called from any thread. |
| 64 virtual WebTaskRunner* loadingTaskRunner() = 0; | 65 virtual WebTaskRunner* loadingTaskRunner() = 0; |
| 65 | 66 |
| 66 // Returns a WebTaskRunner for timer tasks. Can be called from any thread. | 67 // Returns a WebTaskRunner for timer tasks. Can be called from any thread. |
| 67 virtual WebTaskRunner* timerTaskRunner() = 0; | 68 virtual WebTaskRunner* timerTaskRunner() = 0; |
| 68 | 69 |
| 69 // Creates a new WebViewScheduler for a given WebView. Must be called from | 70 // Creates a new WebViewScheduler for a given WebView. Must be called from |
| 70 // the associated WebThread. | 71 // the associated WebThread. |
| 71 virtual WebPassOwnPtr<WebViewScheduler> createWebViewScheduler(blink::WebVie
w*) = 0; | 72 virtual std::unique_ptr<WebViewScheduler> createWebViewScheduler(blink::WebV
iew*) = 0; |
| 72 | 73 |
| 73 // Suspends the timer queue and increments the timer queue suspension count. | 74 // Suspends the timer queue and increments the timer queue suspension count. |
| 74 // May only be called from the main thread. | 75 // May only be called from the main thread. |
| 75 virtual void suspendTimerQueue() = 0; | 76 virtual void suspendTimerQueue() = 0; |
| 76 | 77 |
| 77 // Decrements the timer queue suspension count and re-enables the timer queu
e | 78 // Decrements the timer queue suspension count and re-enables the timer queu
e |
| 78 // if the suspension count is zero and the current scheduler policy allows i
t. | 79 // if the suspension count is zero and the current scheduler policy allows i
t. |
| 79 virtual void resumeTimerQueue() = 0; | 80 virtual void resumeTimerQueue() = 0; |
| 80 | 81 |
| 81 // Tells the scheduler that a navigation task is pending. | 82 // Tells the scheduler that a navigation task is pending. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 94 | 95 |
| 95 void postIdleTask(const WebTraceLocation&, PassOwnPtr<IdleTask>); | 96 void postIdleTask(const WebTraceLocation&, PassOwnPtr<IdleTask>); |
| 96 void postNonNestableIdleTask(const WebTraceLocation&, PassOwnPtr<IdleTask>); | 97 void postNonNestableIdleTask(const WebTraceLocation&, PassOwnPtr<IdleTask>); |
| 97 void postIdleTaskAfterWakeup(const WebTraceLocation&, PassOwnPtr<IdleTask>); | 98 void postIdleTaskAfterWakeup(const WebTraceLocation&, PassOwnPtr<IdleTask>); |
| 98 #endif | 99 #endif |
| 99 }; | 100 }; |
| 100 | 101 |
| 101 } // namespace blink | 102 } // namespace blink |
| 102 | 103 |
| 103 #endif // WebScheduler_h | 104 #endif // WebScheduler_h |
| OLD | NEW |