Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 19 matching lines...) Expand all Loading... | |
| 30 if (loading_task_queue_.get()) { | 30 if (loading_task_queue_.get()) { |
| 31 loading_task_queue_->UnregisterTaskQueue(); | 31 loading_task_queue_->UnregisterTaskQueue(); |
| 32 loading_task_queue_->SetBlameContext(nullptr); | 32 loading_task_queue_->SetBlameContext(nullptr); |
| 33 } | 33 } |
| 34 | 34 |
| 35 if (timer_task_queue_.get()) { | 35 if (timer_task_queue_.get()) { |
| 36 timer_task_queue_->UnregisterTaskQueue(); | 36 timer_task_queue_->UnregisterTaskQueue(); |
| 37 timer_task_queue_->SetBlameContext(nullptr); | 37 timer_task_queue_->SetBlameContext(nullptr); |
| 38 } | 38 } |
| 39 | 39 |
| 40 if (unthrottled_task_queue_.get()) { | |
|
dcheng
2016/07/04 06:52:35
Nit: no .get() here
Sami
2016/07/04 09:28:43
Done.
| |
| 41 unthrottled_task_queue_->UnregisterTaskQueue(); | |
| 42 unthrottled_task_queue_->SetBlameContext(nullptr); | |
| 43 } | |
| 44 | |
| 40 if (parent_web_view_scheduler_) | 45 if (parent_web_view_scheduler_) |
| 41 parent_web_view_scheduler_->Unregister(this); | 46 parent_web_view_scheduler_->Unregister(this); |
| 42 } | 47 } |
| 43 | 48 |
| 44 void WebFrameSchedulerImpl::DetachFromWebViewScheduler() { | 49 void WebFrameSchedulerImpl::DetachFromWebViewScheduler() { |
| 45 parent_web_view_scheduler_ = nullptr; | 50 parent_web_view_scheduler_ = nullptr; |
| 46 } | 51 } |
| 47 | 52 |
| 48 void WebFrameSchedulerImpl::setFrameVisible(bool frame_visible) { | 53 void WebFrameSchedulerImpl::setFrameVisible(bool frame_visible) { |
| 49 frame_visible_ = frame_visible; | 54 frame_visible_ = frame_visible; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 76 parent_web_view_scheduler_->virtual_time_domain()); | 81 parent_web_view_scheduler_->virtual_time_domain()); |
| 77 } else if (!page_visible_) { | 82 } else if (!page_visible_) { |
| 78 renderer_scheduler_->throttling_helper()->IncreaseThrottleRefCount( | 83 renderer_scheduler_->throttling_helper()->IncreaseThrottleRefCount( |
| 79 timer_task_queue_.get()); | 84 timer_task_queue_.get()); |
| 80 } | 85 } |
| 81 timer_web_task_runner_.reset(new WebTaskRunnerImpl(timer_task_queue_)); | 86 timer_web_task_runner_.reset(new WebTaskRunnerImpl(timer_task_queue_)); |
| 82 } | 87 } |
| 83 return timer_web_task_runner_.get(); | 88 return timer_web_task_runner_.get(); |
| 84 } | 89 } |
| 85 | 90 |
| 91 blink::WebTaskRunner* WebFrameSchedulerImpl::unthrottledTaskRunner() { | |
| 92 DCHECK(parent_web_view_scheduler_); | |
| 93 if (!unthrottled_web_task_runner_) { | |
| 94 unthrottled_task_queue_ = | |
| 95 renderer_scheduler_->NewUnthrottledTaskRunner("frame_unthrottled_tq"); | |
| 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 } | |
| 101 unthrottled_web_task_runner_.reset( | |
| 102 new WebTaskRunnerImpl(unthrottled_task_queue_)); | |
| 103 } | |
| 104 return unthrottled_web_task_runner_.get(); | |
| 105 } | |
| 106 | |
| 86 void WebFrameSchedulerImpl::setPageVisible(bool page_visible) { | 107 void WebFrameSchedulerImpl::setPageVisible(bool page_visible) { |
| 87 DCHECK(parent_web_view_scheduler_); | 108 DCHECK(parent_web_view_scheduler_); |
| 88 if (page_visible_ == page_visible) | 109 if (page_visible_ == page_visible) |
| 89 return; | 110 return; |
| 90 | 111 |
| 91 page_visible_ = page_visible; | 112 page_visible_ = page_visible; |
| 92 | 113 |
| 93 if (!timer_web_task_runner_ || | 114 if (!timer_web_task_runner_ || |
| 94 parent_web_view_scheduler_->virtual_time_domain()) { | 115 parent_web_view_scheduler_->virtual_time_domain()) { |
| 95 return; | 116 return; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 115 parent_web_view_scheduler_->virtual_time_domain()); | 136 parent_web_view_scheduler_->virtual_time_domain()); |
| 116 } | 137 } |
| 117 | 138 |
| 118 if (loading_task_queue_) { | 139 if (loading_task_queue_) { |
| 119 loading_task_queue_->SetTimeDomain( | 140 loading_task_queue_->SetTimeDomain( |
| 120 parent_web_view_scheduler_->virtual_time_domain()); | 141 parent_web_view_scheduler_->virtual_time_domain()); |
| 121 } | 142 } |
| 122 } | 143 } |
| 123 | 144 |
| 124 } // namespace scheduler | 145 } // namespace scheduler |
| OLD | NEW |