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 // An implementation of WebThread in terms of base::MessageLoop and | 5 // An implementation of WebThread in terms of base::MessageLoop and |
6 // base::Thread | 6 // base::Thread |
7 | 7 |
8 #include "content/child/webthread_base.h" | 8 #include "components/scheduler/child/webthread_base.h" |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/pending_task.h" | 12 #include "base/pending_task.h" |
13 #include "base/threading/platform_thread.h" | 13 #include "base/threading/platform_thread.h" |
14 #include "content/child/scheduler/single_thread_idle_task_runner.h" | 14 #include "components/scheduler/child/single_thread_idle_task_runner.h" |
15 #include "third_party/WebKit/public/platform/WebTraceLocation.h" | 15 #include "third_party/WebKit/public/platform/WebTraceLocation.h" |
16 | 16 |
17 namespace content { | 17 namespace scheduler { |
18 | 18 |
19 class WebThreadBase::TaskObserverAdapter | 19 class WebThreadBase::TaskObserverAdapter |
20 : public base::MessageLoop::TaskObserver { | 20 : public base::MessageLoop::TaskObserver { |
21 public: | 21 public: |
22 TaskObserverAdapter(WebThread::TaskObserver* observer) | 22 TaskObserverAdapter(WebThread::TaskObserver* observer) |
23 : observer_(observer) {} | 23 : observer_(observer) {} |
24 | 24 |
25 void WillProcessTask(const base::PendingTask& pending_task) override { | 25 void WillProcessTask(const base::PendingTask& pending_task) override { |
26 observer_->willProcessTask(); | 26 observer_->willProcessTask(); |
27 } | 27 } |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 CHECK(isCurrentThread()); | 154 CHECK(isCurrentThread()); |
155 CHECK(MessageLoop()); | 155 CHECK(MessageLoop()); |
156 CHECK(MessageLoop()->is_running()); | 156 CHECK(MessageLoop()->is_running()); |
157 MessageLoop()->Quit(); | 157 MessageLoop()->Quit(); |
158 } | 158 } |
159 | 159 |
160 bool WebThreadBase::isCurrentThread() const { | 160 bool WebThreadBase::isCurrentThread() const { |
161 return TaskRunner()->BelongsToCurrentThread(); | 161 return TaskRunner()->BelongsToCurrentThread(); |
162 } | 162 } |
163 | 163 |
164 } // namespace content | 164 } // namespace scheduler |
OLD | NEW |