| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "platform/scheduler/renderer/renderer_scheduler_impl.h" | 5 #include "platform/scheduler/renderer/renderer_scheduler_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/stack_trace.h" | 8 #include "base/debug/stack_trace.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 : last_input_type(blink::WebInputEvent::Undefined), | 240 : last_input_type(blink::WebInputEvent::Undefined), |
| 241 main_thread_seems_unresponsive(false) {} | 241 main_thread_seems_unresponsive(false) {} |
| 242 | 242 |
| 243 RendererSchedulerImpl::CompositorThreadOnly::~CompositorThreadOnly() {} | 243 RendererSchedulerImpl::CompositorThreadOnly::~CompositorThreadOnly() {} |
| 244 | 244 |
| 245 void RendererSchedulerImpl::Shutdown() { | 245 void RendererSchedulerImpl::Shutdown() { |
| 246 base::TimeTicks now = tick_clock()->NowTicks(); | 246 base::TimeTicks now = tick_clock()->NowTicks(); |
| 247 MainThreadOnly().background_main_thread_load_tracker.RecordIdle(now); | 247 MainThreadOnly().background_main_thread_load_tracker.RecordIdle(now); |
| 248 MainThreadOnly().foreground_main_thread_load_tracker.RecordIdle(now); | 248 MainThreadOnly().foreground_main_thread_load_tracker.RecordIdle(now); |
| 249 | 249 |
| 250 task_queue_throttler_.reset(); | |
| 251 helper_.Shutdown(); | 250 helper_.Shutdown(); |
| 252 idle_helper_.Shutdown(); | 251 idle_helper_.Shutdown(); |
| 253 MainThreadOnly().was_shutdown = true; | 252 MainThreadOnly().was_shutdown = true; |
| 254 MainThreadOnly().rail_mode_observer = nullptr; | 253 MainThreadOnly().rail_mode_observer = nullptr; |
| 254 |
| 255 // Note this must be done after shutting down |helper_| because otherwise |
| 256 // there's a window where another thread posting a task to a throttled queue |
| 257 // during shutdown might try to access the deleted TimeDomain owned by |
| 258 // |task_queue_throttler_|. |
| 259 task_queue_throttler_.reset(); |
| 255 } | 260 } |
| 256 | 261 |
| 257 std::unique_ptr<blink::WebThread> RendererSchedulerImpl::CreateMainThread() { | 262 std::unique_ptr<blink::WebThread> RendererSchedulerImpl::CreateMainThread() { |
| 258 return base::MakeUnique<WebThreadImplForRendererScheduler>(this); | 263 return base::MakeUnique<WebThreadImplForRendererScheduler>(this); |
| 259 } | 264 } |
| 260 | 265 |
| 261 scoped_refptr<TaskQueue> RendererSchedulerImpl::DefaultTaskRunner() { | 266 scoped_refptr<TaskQueue> RendererSchedulerImpl::DefaultTaskRunner() { |
| 262 return helper_.DefaultTaskRunner(); | 267 return helper_.DefaultTaskRunner(); |
| 263 } | 268 } |
| 264 | 269 |
| (...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1874 case TimeDomainType::VIRTUAL: | 1879 case TimeDomainType::VIRTUAL: |
| 1875 return "virtual"; | 1880 return "virtual"; |
| 1876 default: | 1881 default: |
| 1877 NOTREACHED(); | 1882 NOTREACHED(); |
| 1878 return nullptr; | 1883 return nullptr; |
| 1879 } | 1884 } |
| 1880 } | 1885 } |
| 1881 | 1886 |
| 1882 } // namespace scheduler | 1887 } // namespace scheduler |
| 1883 } // namespace blink | 1888 } // namespace blink |
| OLD | NEW |