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 COMPONENTS_SCHEDULER_RENDERER_WEB_VIEW_SCHEDULER_IMPL_H_ | 5 #ifndef COMPONENTS_SCHEDULER_RENDERER_WEB_VIEW_SCHEDULER_IMPL_H_ |
6 #define COMPONENTS_SCHEDULER_RENDERER_WEB_VIEW_SCHEDULER_IMPL_H_ | 6 #define COMPONENTS_SCHEDULER_RENDERER_WEB_VIEW_SCHEDULER_IMPL_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "components/scheduler/base/cancelable_closure_holder.h" | |
11 #include "components/scheduler/scheduler_export.h" | 12 #include "components/scheduler/scheduler_export.h" |
12 #include "third_party/WebKit/public/platform/WebViewScheduler.h" | 13 #include "third_party/WebKit/public/platform/WebViewScheduler.h" |
13 | 14 |
14 namespace base { | 15 namespace base { |
15 class SingleThreadTaskRunner; | 16 class SingleThreadTaskRunner; |
16 } // namespace base | 17 } // namespace base |
17 | 18 |
18 namespace blink { | 19 namespace blink { |
19 class WebView; | 20 class WebView; |
20 } // namespace blink | 21 } // namespace blink |
21 | 22 |
22 namespace scheduler { | 23 namespace scheduler { |
23 | 24 |
24 class RendererSchedulerImpl; | 25 class RendererSchedulerImpl; |
25 class WebFrameSchedulerImpl; | 26 class WebFrameSchedulerImpl; |
26 | 27 |
27 class SCHEDULER_EXPORT WebViewSchedulerImpl : public blink::WebViewScheduler { | 28 class SCHEDULER_EXPORT WebViewSchedulerImpl : public blink::WebViewScheduler { |
28 public: | 29 public: |
29 WebViewSchedulerImpl(blink::WebView* web_view, | 30 WebViewSchedulerImpl(blink::WebView* web_view, |
30 RendererSchedulerImpl* renderer_scheduler); | 31 RendererSchedulerImpl* renderer_scheduler, |
32 const char* tracing_category); | |
31 | 33 |
32 ~WebViewSchedulerImpl() override; | 34 ~WebViewSchedulerImpl() override; |
33 | 35 |
34 // blink::WebViewScheduler implementation: | 36 // blink::WebViewScheduler implementation: |
35 void setPageInBackground(bool background) override; | 37 void setPageInBackground(bool background) override; |
36 blink::WebPassOwnPtr<blink::WebFrameScheduler> createFrameScheduler() | 38 blink::WebPassOwnPtr<blink::WebFrameScheduler> createFrameScheduler() |
37 override; | 39 override; |
38 | 40 |
39 blink::WebView* web_view() const { return web_view_; } | 41 blink::WebView* web_view() const { return web_view_; } |
40 | 42 |
43 static double DelayToNextRunTimeInSeconds(double now_in_seconds); | |
44 | |
41 private: | 45 private: |
42 friend class WebFrameSchedulerImpl; | 46 friend class WebFrameSchedulerImpl; |
43 | 47 |
44 void Unregister(WebFrameSchedulerImpl* frame_scheduler); | 48 void Unregister(WebFrameSchedulerImpl* frame_scheduler); |
49 void PumpThrottledTasks(); | |
50 void SchedulePumpThrottledTasks(); | |
45 | 51 |
46 std::set<WebFrameSchedulerImpl*> frame_schedulers_; | 52 std::set<WebFrameSchedulerImpl*> frame_schedulers_; |
47 blink::WebView* web_view_; | 53 blink::WebView* web_view_; |
48 RendererSchedulerImpl* renderer_scheduler_; | 54 RendererSchedulerImpl* renderer_scheduler_; |
55 CancelableClosureHolder pump_throttled_tasks_closure_; | |
56 const char* tracing_category_; // NOT OWNED | |
49 bool background_; | 57 bool background_; |
Sami
2015/11/17 10:12:21
nit: could you rename this to page_in_background_
alex clarke (OOO till 29th)
2015/11/23 17:13:45
Done.
| |
58 base::WeakPtrFactory<WebViewSchedulerImpl> weak_factory_; | |
50 | 59 |
51 DISALLOW_COPY_AND_ASSIGN(WebViewSchedulerImpl); | 60 DISALLOW_COPY_AND_ASSIGN(WebViewSchedulerImpl); |
52 }; | 61 }; |
53 | 62 |
54 } // namespace scheduler | 63 } // namespace scheduler |
55 | 64 |
56 #endif // COMPONENTS_SCHEDULER_RENDERER_WEB_VIEW_SCHEDULER_IMPL_H_ | 65 #endif // COMPONENTS_SCHEDULER_RENDERER_WEB_VIEW_SCHEDULER_IMPL_H_ |
OLD | NEW |