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_FRAME_SCHEDULER_IMPL_H_ | |
6 #define COMPONENTS_SCHEDULER_RENDERER_WEB_FRAME_SCHEDULER_IMPL_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "base/macros.h" | |
11 #include "base/memory/ref_counted.h" | |
12 #include "base/trace_event/trace_event.h" | |
13 #include "components/scheduler/base/task_queue.h" | |
14 #include "components/scheduler/scheduler_export.h" | |
15 #include "third_party/WebKit/public/platform/WebFrameScheduler.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 scheduler { | |
25 | |
26 class AutoAdvancingVirtualTimeDomain; | |
27 class RendererSchedulerImpl; | |
28 class TaskQueue; | |
29 class WebTaskRunnerImpl; | |
30 class WebViewSchedulerImpl; | |
31 | |
32 class SCHEDULER_EXPORT WebFrameSchedulerImpl : public blink::WebFrameScheduler { | |
33 public: | |
34 WebFrameSchedulerImpl(RendererSchedulerImpl* renderer_scheduler, | |
35 WebViewSchedulerImpl* parent_web_view_scheduler, | |
36 base::trace_event::BlameContext* blame_context); | |
37 | |
38 ~WebFrameSchedulerImpl() override; | |
39 | |
40 // blink::WebFrameScheduler implementation: | |
41 void setFrameVisible(bool frame_visible) override; | |
42 void setPageVisible(bool page_visible) override; | |
43 blink::WebTaskRunner* loadingTaskRunner() override; | |
44 blink::WebTaskRunner* timerTaskRunner() override; | |
45 blink::WebTaskRunner* unthrottledTaskRunner() override; | |
46 blink::WebViewScheduler* webViewScheduler() override; | |
47 void didStartLoading(unsigned long identifier) override; | |
48 void didStopLoading(unsigned long identifier) override; | |
49 void setDocumentParsingInBackground(bool background_parser_active) override; | |
50 | |
51 private: | |
52 friend class WebViewSchedulerImpl; | |
53 | |
54 void DetachFromWebViewScheduler(); | |
55 void ApplyPolicyToTimerQueue(); | |
56 | |
57 scoped_refptr<TaskQueue> loading_task_queue_; | |
58 scoped_refptr<TaskQueue> timer_task_queue_; | |
59 scoped_refptr<TaskQueue> unthrottled_task_queue_; | |
60 std::unique_ptr<WebTaskRunnerImpl> loading_web_task_runner_; | |
61 std::unique_ptr<WebTaskRunnerImpl> timer_web_task_runner_; | |
62 std::unique_ptr<WebTaskRunnerImpl> unthrottled_web_task_runner_; | |
63 RendererSchedulerImpl* renderer_scheduler_; // NOT OWNED | |
64 WebViewSchedulerImpl* parent_web_view_scheduler_; // NOT OWNED | |
65 base::trace_event::BlameContext* blame_context_; // NOT OWNED | |
66 TaskQueue::PumpPolicy virtual_time_pump_policy_; | |
67 bool frame_visible_; | |
68 bool page_visible_; | |
69 | |
70 DISALLOW_COPY_AND_ASSIGN(WebFrameSchedulerImpl); | |
71 }; | |
72 | |
73 } // namespace scheduler | |
74 | |
75 #endif // COMPONENTS_SCHEDULER_RENDERER_WEB_FRAME_SCHEDULER_IMPL_H_ | |
OLD | NEW |