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