| 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 RendererSchedulerImpl; | |
| 31 class WebFrameSchedulerImpl; | |
| 32 | |
| 33 class SCHEDULER_EXPORT WebViewSchedulerImpl : public blink::WebViewScheduler { | |
| 34 public: | |
| 35 WebViewSchedulerImpl(blink::WebView* web_view, | |
| 36 RendererSchedulerImpl* renderer_scheduler, | |
| 37 bool disable_background_timer_throttling); | |
| 38 | |
| 39 ~WebViewSchedulerImpl() override; | |
| 40 | |
| 41 // blink::WebViewScheduler implementation: | |
| 42 void setPageVisible(bool page_visible) override; | |
| 43 std::unique_ptr<blink::WebFrameScheduler> createFrameScheduler( | |
| 44 blink::BlameContext* blame_context) override; | |
| 45 void enableVirtualTime() override; | |
| 46 bool virtualTimeAllowedToAdvance() const override; | |
| 47 void setVirtualTimePolicy(VirtualTimePolicy virtual_time_policy) override; | |
| 48 | |
| 49 // Virtual for testing. | |
| 50 virtual void AddConsoleWarning(const std::string& message); | |
| 51 | |
| 52 std::unique_ptr<WebFrameSchedulerImpl> createWebFrameSchedulerImpl( | |
| 53 base::trace_event::BlameContext* blame_context); | |
| 54 | |
| 55 void DidStartLoading(unsigned long identifier); | |
| 56 void DidStopLoading(unsigned long identifier); | |
| 57 void IncrementBackgroundParserCount(); | |
| 58 void DecrementBackgroundParserCount(); | |
| 59 void Unregister(WebFrameSchedulerImpl* frame_scheduler); | |
| 60 | |
| 61 private: | |
| 62 void setAllowVirtualTimeToAdvance(bool allow_virtual_time_to_advance); | |
| 63 void ApplyVirtualTimePolicy(); | |
| 64 | |
| 65 std::set<WebFrameSchedulerImpl*> frame_schedulers_; | |
| 66 std::set<unsigned long> pending_loads_; | |
| 67 blink::WebView* web_view_; | |
| 68 RendererSchedulerImpl* renderer_scheduler_; | |
| 69 VirtualTimePolicy virtual_time_policy_; | |
| 70 int background_parser_count_; | |
| 71 bool page_visible_; | |
| 72 bool disable_background_timer_throttling_; | |
| 73 bool allow_virtual_time_to_advance_; | |
| 74 bool have_seen_loading_task_; | |
| 75 bool virtual_time_; | |
| 76 | |
| 77 DISALLOW_COPY_AND_ASSIGN(WebViewSchedulerImpl); | |
| 78 }; | |
| 79 | |
| 80 } // namespace scheduler | |
| 81 | |
| 82 #endif // COMPONENTS_SCHEDULER_RENDERER_WEB_VIEW_SCHEDULER_IMPL_H_ | |
| OLD | NEW |