Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: components/scheduler/renderer/web_frame_scheduler_impl.h

Issue 2023033003: scheduler: Throttle timers in out-of-view frames (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add cross origin check, tests Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_FRAME_SCHEDULER_IMPL_H_ 5 #ifndef COMPONENTS_SCHEDULER_RENDERER_WEB_FRAME_SCHEDULER_IMPL_H_
6 #define COMPONENTS_SCHEDULER_RENDERER_WEB_FRAME_SCHEDULER_IMPL_H_ 6 #define COMPONENTS_SCHEDULER_RENDERER_WEB_FRAME_SCHEDULER_IMPL_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 15 matching lines...) Expand all
26 class AutoAdvancingVirtualTimeDomain; 26 class AutoAdvancingVirtualTimeDomain;
27 class RendererSchedulerImpl; 27 class RendererSchedulerImpl;
28 class TaskQueue; 28 class TaskQueue;
29 class WebTaskRunnerImpl; 29 class WebTaskRunnerImpl;
30 class WebViewSchedulerImpl; 30 class WebViewSchedulerImpl;
31 31
32 class SCHEDULER_EXPORT WebFrameSchedulerImpl : public blink::WebFrameScheduler { 32 class SCHEDULER_EXPORT WebFrameSchedulerImpl : public blink::WebFrameScheduler {
33 public: 33 public:
34 WebFrameSchedulerImpl(RendererSchedulerImpl* renderer_scheduler, 34 WebFrameSchedulerImpl(RendererSchedulerImpl* renderer_scheduler,
35 WebViewSchedulerImpl* parent_web_view_scheduler, 35 WebViewSchedulerImpl* parent_web_view_scheduler,
36 base::trace_event::BlameContext* blame_context); 36 base::trace_event::BlameContext* blame_context,
37 bool allow_hidden_timer_throttling);
37 38
38 ~WebFrameSchedulerImpl() override; 39 ~WebFrameSchedulerImpl() override;
39 40
40 // blink::WebFrameScheduler implementation: 41 // blink::WebFrameScheduler implementation:
41 void setFrameVisible(bool frame_visible) override; 42 void setFrameVisible(bool frame_visible) override;
42 void setPageVisible(bool page_visible) override; 43 void setPageVisible(bool page_visible) override;
44 void setCrossOrigin(bool cross_origin) override;
43 blink::WebTaskRunner* loadingTaskRunner() override; 45 blink::WebTaskRunner* loadingTaskRunner() override;
44 blink::WebTaskRunner* timerTaskRunner() override; 46 blink::WebTaskRunner* timerTaskRunner() override;
45 47
46 void OnVirtualTimeDomainChanged(); 48 void OnVirtualTimeDomainChanged();
47 49
48 private: 50 private:
49 friend class WebViewSchedulerImpl; 51 friend class WebViewSchedulerImpl;
50 52
51 void DetachFromWebViewScheduler(); 53 void DetachFromWebViewScheduler();
52 void ApplyPolicyToTimerQueue(); 54 bool ShouldThrottleTimers() const;
55 void UpdateTimerThrottling(bool was_throttled);
53 56
54 scoped_refptr<TaskQueue> loading_task_queue_; 57 scoped_refptr<TaskQueue> loading_task_queue_;
55 scoped_refptr<TaskQueue> timer_task_queue_; 58 scoped_refptr<TaskQueue> timer_task_queue_;
56 std::unique_ptr<WebTaskRunnerImpl> loading_web_task_runner_; 59 std::unique_ptr<WebTaskRunnerImpl> loading_web_task_runner_;
57 std::unique_ptr<WebTaskRunnerImpl> timer_web_task_runner_; 60 std::unique_ptr<WebTaskRunnerImpl> timer_web_task_runner_;
58 RendererSchedulerImpl* renderer_scheduler_; // NOT OWNED 61 RendererSchedulerImpl* renderer_scheduler_; // NOT OWNED
59 WebViewSchedulerImpl* parent_web_view_scheduler_; // NOT OWNED 62 WebViewSchedulerImpl* parent_web_view_scheduler_; // NOT OWNED
60 base::trace_event::BlameContext* blame_context_; // NOT OWNED 63 base::trace_event::BlameContext* blame_context_; // NOT OWNED
61 TaskQueue::PumpPolicy virtual_time_pump_policy_; 64 TaskQueue::PumpPolicy virtual_time_pump_policy_;
62 bool frame_visible_; 65 bool frame_visible_;
alex clarke (OOO till 29th) 2016/06/28 17:11:28 I can't help thinking this state would be useful t
Sami 2016/06/28 17:22:45 Yes, I thought about that too. Let's figure out a
63 bool page_visible_; 66 bool page_visible_;
67 bool cross_origin_;
68 bool allow_hidden_timer_throttling_;
alex clarke (OOO till 29th) 2016/06/28 17:11:28 const
Sami 2016/06/28 17:22:45 Done.
64 69
65 DISALLOW_COPY_AND_ASSIGN(WebFrameSchedulerImpl); 70 DISALLOW_COPY_AND_ASSIGN(WebFrameSchedulerImpl);
66 }; 71 };
67 72
68 } // namespace scheduler 73 } // namespace scheduler
69 74
70 #endif // COMPONENTS_SCHEDULER_RENDERER_WEB_FRAME_SCHEDULER_IMPL_H_ 75 #endif // COMPONENTS_SCHEDULER_RENDERER_WEB_FRAME_SCHEDULER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698