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