| OLD | NEW |
| 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 WebViewScheduler_h | 5 #ifndef WebViewScheduler_h |
| 6 #define WebViewScheduler_h | 6 #define WebViewScheduler_h |
| 7 | 7 |
| 8 #include "WebCommon.h" | 8 #include "WebCommon.h" |
| 9 #include "public/platform/WebPassOwnPtr.h" | 9 #include "public/platform/WebPassOwnPtr.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class WebFrameScheduler; | 13 class WebFrameScheduler; |
| 14 | 14 |
| 15 class BLINK_PLATFORM_EXPORT WebViewScheduler { | 15 class BLINK_PLATFORM_EXPORT WebViewScheduler { |
| 16 public: | 16 public: |
| 17 virtual ~WebViewScheduler() { } | 17 virtual ~WebViewScheduler() { } |
| 18 | 18 |
| 19 // The scheduler may throttle tasks associated with background pages. | 19 // The scheduler may throttle tasks associated with background pages. |
| 20 virtual void setPageVisible(bool) = 0; | 20 virtual void setPageVisible(bool) = 0; |
| 21 | 21 |
| 22 // Creaters a new WebFrameScheduler, the caller is responsible for deleting
it. | 22 // Creaters a new WebFrameScheduler, the caller is responsible for deleting
it. |
| 23 virtual WebPassOwnPtr<WebFrameScheduler> createFrameScheduler() = 0; | 23 virtual WebPassOwnPtr<WebFrameScheduler> createFrameScheduler() = 0; |
| 24 | |
| 25 // Instructs this WebViewScheduler to use virtual time. When virtual time is
enabled | |
| 26 // the system doesn't actually sleep for the delays between tasks before exe
cuting | |
| 27 // them. E.g: A-E are delayed tasks | |
| 28 // | |
| 29 // | A B C D E (normal) | |
| 30 // |-----------------------------> time | |
| 31 // | |
| 32 // |ABCDE (virtual time) | |
| 33 // |-----------------------------> time | |
| 34 virtual void enableVirtualTime() = 0; | |
| 35 | |
| 36 // Controls whether or not virtual time is allowed to advance. If virtual ti
me | |
| 37 // is not allowed to advance then delayed tasks posted to the WebTaskRunners
owned | |
| 38 // by any child WebFrameSchedulers will be paused. If virtual time is allowe
d to | |
| 39 // advance then tasks will be run in time order (as usual) but virtual time
will | |
| 40 // fast forward so that the system doesn't actually sleep for the delays bet
ween | |
| 41 // tasks before executing them. | |
| 42 virtual void setAllowVirtualTimeToAdvance(bool) = 0; | |
| 43 }; | 24 }; |
| 44 | 25 |
| 45 } // namespace blink | 26 } // namespace blink |
| 46 | 27 |
| 47 #endif // WebViewScheduler | 28 #endif // WebViewScheduler |
| OLD | NEW |