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