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

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

Issue 2246493002: Revert of Change VirtualTimePolicy::PAUSE_IF_NETWORK_FETCHES_PENDING (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 #include "components/scheduler/renderer/web_frame_scheduler_impl.h" 5 #include "components/scheduler/renderer/web_frame_scheduler_impl.h"
6 6
7 #include "base/trace_event/blame_context.h" 7 #include "base/trace_event/blame_context.h"
8 #include "components/scheduler/base/real_time_domain.h" 8 #include "components/scheduler/base/real_time_domain.h"
9 #include "components/scheduler/base/virtual_time_domain.h" 9 #include "components/scheduler/base/virtual_time_domain.h"
10 #include "components/scheduler/child/web_task_runner_impl.h" 10 #include "components/scheduler/child/web_task_runner_impl.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 frame_visible_ = frame_visible; 54 frame_visible_ = frame_visible;
55 // TODO(alexclarke): Do something with this flag. 55 // TODO(alexclarke): Do something with this flag.
56 } 56 }
57 57
58 blink::WebTaskRunner* WebFrameSchedulerImpl::loadingTaskRunner() { 58 blink::WebTaskRunner* WebFrameSchedulerImpl::loadingTaskRunner() {
59 DCHECK(parent_web_view_scheduler_); 59 DCHECK(parent_web_view_scheduler_);
60 if (!loading_web_task_runner_) { 60 if (!loading_web_task_runner_) {
61 loading_task_queue_ = 61 loading_task_queue_ =
62 renderer_scheduler_->NewLoadingTaskRunner("frame_loading_tq"); 62 renderer_scheduler_->NewLoadingTaskRunner("frame_loading_tq");
63 loading_task_queue_->SetBlameContext(blame_context_); 63 loading_task_queue_->SetBlameContext(blame_context_);
64 if (parent_web_view_scheduler_->virtual_time_domain()) {
65 loading_task_queue_->SetTimeDomain(
66 parent_web_view_scheduler_->virtual_time_domain());
67 }
64 loading_web_task_runner_.reset(new WebTaskRunnerImpl(loading_task_queue_)); 68 loading_web_task_runner_.reset(new WebTaskRunnerImpl(loading_task_queue_));
65 } 69 }
66 return loading_web_task_runner_.get(); 70 return loading_web_task_runner_.get();
67 } 71 }
68 72
69 blink::WebTaskRunner* WebFrameSchedulerImpl::timerTaskRunner() { 73 blink::WebTaskRunner* WebFrameSchedulerImpl::timerTaskRunner() {
70 DCHECK(parent_web_view_scheduler_); 74 DCHECK(parent_web_view_scheduler_);
71 if (!timer_web_task_runner_) { 75 if (!timer_web_task_runner_) {
72 timer_task_queue_ = 76 timer_task_queue_ =
73 renderer_scheduler_->NewTimerTaskRunner("frame_timer_tq"); 77 renderer_scheduler_->NewTimerTaskRunner("frame_timer_tq");
74 timer_task_queue_->SetBlameContext(blame_context_); 78 timer_task_queue_->SetBlameContext(blame_context_);
75 if (!page_visible_) { 79 if (parent_web_view_scheduler_->virtual_time_domain()) {
80 timer_task_queue_->SetTimeDomain(
81 parent_web_view_scheduler_->virtual_time_domain());
82 } else if (!page_visible_) {
76 renderer_scheduler_->throttling_helper()->IncreaseThrottleRefCount( 83 renderer_scheduler_->throttling_helper()->IncreaseThrottleRefCount(
77 timer_task_queue_.get()); 84 timer_task_queue_.get());
78 } 85 }
79 timer_web_task_runner_.reset(new WebTaskRunnerImpl(timer_task_queue_)); 86 timer_web_task_runner_.reset(new WebTaskRunnerImpl(timer_task_queue_));
80 } 87 }
81 return timer_web_task_runner_.get(); 88 return timer_web_task_runner_.get();
82 } 89 }
83 90
84 blink::WebTaskRunner* WebFrameSchedulerImpl::unthrottledTaskRunner() { 91 blink::WebTaskRunner* WebFrameSchedulerImpl::unthrottledTaskRunner() {
85 DCHECK(parent_web_view_scheduler_); 92 DCHECK(parent_web_view_scheduler_);
86 if (!unthrottled_web_task_runner_) { 93 if (!unthrottled_web_task_runner_) {
87 unthrottled_task_queue_ = 94 unthrottled_task_queue_ =
88 renderer_scheduler_->NewUnthrottledTaskRunner("frame_unthrottled_tq"); 95 renderer_scheduler_->NewUnthrottledTaskRunner("frame_unthrottled_tq");
89 unthrottled_task_queue_->SetBlameContext(blame_context_); 96 unthrottled_task_queue_->SetBlameContext(blame_context_);
97 if (parent_web_view_scheduler_->virtual_time_domain()) {
98 unthrottled_task_queue_->SetTimeDomain(
99 parent_web_view_scheduler_->virtual_time_domain());
100 }
90 unthrottled_web_task_runner_.reset( 101 unthrottled_web_task_runner_.reset(
91 new WebTaskRunnerImpl(unthrottled_task_queue_)); 102 new WebTaskRunnerImpl(unthrottled_task_queue_));
92 } 103 }
93 return unthrottled_web_task_runner_.get(); 104 return unthrottled_web_task_runner_.get();
94 } 105 }
95 106
96 blink::WebViewScheduler* WebFrameSchedulerImpl::webViewScheduler() { 107 blink::WebViewScheduler* WebFrameSchedulerImpl::webViewScheduler() {
97 return parent_web_view_scheduler_; 108 return parent_web_view_scheduler_;
98 } 109 }
99 110
(...skipping 15 matching lines...) Expand all
115 parent_web_view_scheduler_->DecrementBackgroundParserCount(); 126 parent_web_view_scheduler_->DecrementBackgroundParserCount();
116 } 127 }
117 128
118 void WebFrameSchedulerImpl::setPageVisible(bool page_visible) { 129 void WebFrameSchedulerImpl::setPageVisible(bool page_visible) {
119 DCHECK(parent_web_view_scheduler_); 130 DCHECK(parent_web_view_scheduler_);
120 if (page_visible_ == page_visible) 131 if (page_visible_ == page_visible)
121 return; 132 return;
122 133
123 page_visible_ = page_visible; 134 page_visible_ = page_visible;
124 135
125 if (!timer_web_task_runner_) 136 if (!timer_web_task_runner_ ||
137 parent_web_view_scheduler_->virtual_time_domain()) {
126 return; 138 return;
139 }
127 140
128 if (page_visible_) { 141 if (page_visible_) {
129 renderer_scheduler_->throttling_helper()->DecreaseThrottleRefCount( 142 renderer_scheduler_->throttling_helper()->DecreaseThrottleRefCount(
130 timer_task_queue_.get()); 143 timer_task_queue_.get());
131 } else { 144 } else {
132 renderer_scheduler_->throttling_helper()->IncreaseThrottleRefCount( 145 renderer_scheduler_->throttling_helper()->IncreaseThrottleRefCount(
133 timer_task_queue_.get()); 146 timer_task_queue_.get());
134 } 147 }
135 } 148 }
136 149
150 void WebFrameSchedulerImpl::OnVirtualTimeDomainChanged() {
151 DCHECK(parent_web_view_scheduler_);
152 DCHECK(parent_web_view_scheduler_->virtual_time_domain());
153
154 if (timer_task_queue_) {
155 renderer_scheduler_->throttling_helper()->UnregisterTaskQueue(
156 timer_task_queue_.get());
157 timer_task_queue_->SetTimeDomain(
158 parent_web_view_scheduler_->virtual_time_domain());
159 }
160
161 if (loading_task_queue_) {
162 loading_task_queue_->SetTimeDomain(
163 parent_web_view_scheduler_->virtual_time_domain());
164 }
165 }
166
137 } // namespace scheduler 167 } // namespace scheduler
OLDNEW
« no previous file with comments | « components/scheduler/renderer/web_frame_scheduler_impl.h ('k') | components/scheduler/renderer/web_view_scheduler_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698