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