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 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "components/scheduler/base/task_queue.h" | 13 #include "components/scheduler/base/task_queue.h" |
14 #include "components/scheduler/scheduler_export.h" | 14 #include "components/scheduler/scheduler_export.h" |
15 #include "third_party/WebKit/public/platform/WebViewScheduler.h" | 15 #include "third_party/WebKit/public/platform/WebViewScheduler.h" |
16 | 16 |
17 namespace base { | 17 namespace base { |
| 18 namespace trace_event { |
| 19 class BlameContext; |
| 20 } // namespace trace_event |
18 class SingleThreadTaskRunner; | 21 class SingleThreadTaskRunner; |
19 } // namespace base | 22 } // namespace base |
20 | 23 |
21 namespace blink { | 24 namespace blink { |
22 class WebView; | 25 class WebView; |
23 } // namespace blink | 26 } // namespace blink |
24 | 27 |
25 namespace scheduler { | 28 namespace scheduler { |
26 | 29 |
27 class AutoAdvancingVirtualTimeDomain; | 30 class AutoAdvancingVirtualTimeDomain; |
28 class RendererSchedulerImpl; | 31 class RendererSchedulerImpl; |
29 class WebFrameSchedulerImpl; | 32 class WebFrameSchedulerImpl; |
30 | 33 |
31 class SCHEDULER_EXPORT WebViewSchedulerImpl : public blink::WebViewScheduler { | 34 class SCHEDULER_EXPORT WebViewSchedulerImpl : public blink::WebViewScheduler { |
32 public: | 35 public: |
33 WebViewSchedulerImpl(blink::WebView* web_view, | 36 WebViewSchedulerImpl(blink::WebView* web_view, |
34 RendererSchedulerImpl* renderer_scheduler, | 37 RendererSchedulerImpl* renderer_scheduler, |
35 bool disable_background_timer_throttling); | 38 bool disable_background_timer_throttling); |
36 | 39 |
37 ~WebViewSchedulerImpl() override; | 40 ~WebViewSchedulerImpl() override; |
38 | 41 |
39 // blink::WebViewScheduler implementation: | 42 // blink::WebViewScheduler implementation: |
40 void setPageVisible(bool page_visible) override; | 43 void setPageVisible(bool page_visible) override; |
41 blink::WebPassOwnPtr<blink::WebFrameScheduler> createFrameScheduler() | 44 blink::WebPassOwnPtr<blink::WebFrameScheduler> createFrameScheduler( |
42 override; | 45 blink::BlameContext* blame_context) override; |
43 void enableVirtualTime() override; | 46 void enableVirtualTime() override; |
44 void setAllowVirtualTimeToAdvance( | 47 void setAllowVirtualTimeToAdvance( |
45 bool allow_virtual_time_to_advance) override; | 48 bool allow_virtual_time_to_advance) override; |
46 | 49 |
47 // Virtual for testing. | 50 // Virtual for testing. |
48 virtual void AddConsoleWarning(const std::string& message); | 51 virtual void AddConsoleWarning(const std::string& message); |
49 | 52 |
50 scoped_ptr<WebFrameSchedulerImpl> createWebFrameSchedulerImpl(); | 53 scoped_ptr<WebFrameSchedulerImpl> createWebFrameSchedulerImpl( |
| 54 base::trace_event::BlameContext* blame_context); |
51 | 55 |
52 private: | 56 private: |
53 friend class WebFrameSchedulerImpl; | 57 friend class WebFrameSchedulerImpl; |
54 | 58 |
55 void Unregister(WebFrameSchedulerImpl* frame_scheduler); | 59 void Unregister(WebFrameSchedulerImpl* frame_scheduler); |
56 | 60 |
57 AutoAdvancingVirtualTimeDomain* virtual_time_domain() const { | 61 AutoAdvancingVirtualTimeDomain* virtual_time_domain() const { |
58 return virtual_time_domain_.get(); | 62 return virtual_time_domain_.get(); |
59 } | 63 } |
60 | 64 |
61 std::set<WebFrameSchedulerImpl*> frame_schedulers_; | 65 std::set<WebFrameSchedulerImpl*> frame_schedulers_; |
62 scoped_ptr<AutoAdvancingVirtualTimeDomain> virtual_time_domain_; | 66 scoped_ptr<AutoAdvancingVirtualTimeDomain> virtual_time_domain_; |
63 TaskQueue::PumpPolicy virtual_time_pump_policy_; | 67 TaskQueue::PumpPolicy virtual_time_pump_policy_; |
64 blink::WebView* web_view_; | 68 blink::WebView* web_view_; |
65 RendererSchedulerImpl* renderer_scheduler_; | 69 RendererSchedulerImpl* renderer_scheduler_; |
66 bool page_visible_; | 70 bool page_visible_; |
67 bool disable_background_timer_throttling_; | 71 bool disable_background_timer_throttling_; |
68 bool allow_virtual_time_to_advance_; | 72 bool allow_virtual_time_to_advance_; |
69 | 73 |
70 DISALLOW_COPY_AND_ASSIGN(WebViewSchedulerImpl); | 74 DISALLOW_COPY_AND_ASSIGN(WebViewSchedulerImpl); |
71 }; | 75 }; |
72 | 76 |
73 } // namespace scheduler | 77 } // namespace scheduler |
74 | 78 |
75 #endif // COMPONENTS_SCHEDULER_RENDERER_WEB_VIEW_SCHEDULER_IMPL_H_ | 79 #endif // COMPONENTS_SCHEDULER_RENDERER_WEB_VIEW_SCHEDULER_IMPL_H_ |
OLD | NEW |