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 #include "content/renderer/scheduler/webthread_impl_for_scheduler.h" |
| 6 |
| 7 #include "content/renderer/scheduler/renderer_scheduler.h" |
| 8 #include "third_party/WebKit/public/platform/WebTraceLocation.h" |
| 9 |
| 10 namespace content { |
| 11 |
| 12 WebThreadImplForScheduler::WebThreadImplForScheduler( |
| 13 RendererScheduler* scheduler) |
| 14 : task_runner_(scheduler->DefaultTaskRunner()), |
| 15 scheduler_(scheduler), |
| 16 thread_id_(base::PlatformThread::CurrentId()) { |
| 17 } |
| 18 |
| 19 WebThreadImplForScheduler::~WebThreadImplForScheduler() { |
| 20 } |
| 21 |
| 22 blink::PlatformThreadId WebThreadImplForScheduler::threadId() const { |
| 23 return thread_id_; |
| 24 } |
| 25 |
| 26 base::MessageLoop* WebThreadImplForScheduler::MessageLoop() const { |
| 27 DCHECK(isCurrentThread()); |
| 28 return base::MessageLoop::current(); |
| 29 } |
| 30 |
| 31 base::SingleThreadTaskRunner* WebThreadImplForScheduler::TaskRunner() const { |
| 32 return task_runner_.get(); |
| 33 } |
| 34 |
| 35 void WebThreadImplForScheduler::AddTaskObserverInternal( |
| 36 base::MessageLoop::TaskObserver* observer) { |
| 37 scheduler_->AddTaskObserver(observer); |
| 38 } |
| 39 |
| 40 void WebThreadImplForScheduler::RemoveTaskObserverInternal( |
| 41 base::MessageLoop::TaskObserver* observer) { |
| 42 scheduler_->RemoveTaskObserver(observer); |
| 43 } |
| 44 |
| 45 } // namespace content |
OLD | NEW |