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_impl.h" | 8 #include "content/child/webthread_impl.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/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/pending_task.h" | 13 #include "base/pending_task.h" |
14 #include "base/threading/platform_thread.h" | 14 #include "base/threading/platform_thread.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
18 WebThreadBase::WebThreadBase() {} | 18 WebThreadBase::WebThreadBase() {} |
19 WebThreadBase::~WebThreadBase() {} | 19 WebThreadBase::~WebThreadBase() {} |
20 | 20 |
21 class WebThreadBase::TaskObserverAdapter | 21 class WebThreadBase::TaskObserverAdapter |
22 : public base::MessageLoop::TaskObserver { | 22 : public base::MessageLoop::TaskObserver { |
23 public: | 23 public: |
24 TaskObserverAdapter(WebThread::TaskObserver* observer) | 24 TaskObserverAdapter(WebThread::TaskObserver* observer) |
25 : observer_(observer) {} | 25 : observer_(observer) {} |
26 | 26 |
27 virtual void WillProcessTask(const base::PendingTask& pending_task) OVERRIDE { | 27 virtual void WillProcessTask(const base::PendingTask& pending_task) override { |
28 observer_->willProcessTask(); | 28 observer_->willProcessTask(); |
29 } | 29 } |
30 | 30 |
31 virtual void DidProcessTask(const base::PendingTask& pending_task) OVERRIDE { | 31 virtual void DidProcessTask(const base::PendingTask& pending_task) override { |
32 observer_->didProcessTask(); | 32 observer_->didProcessTask(); |
33 } | 33 } |
34 | 34 |
35 private: | 35 private: |
36 WebThread::TaskObserver* observer_; | 36 WebThread::TaskObserver* observer_; |
37 }; | 37 }; |
38 | 38 |
39 void WebThreadBase::addTaskObserver(TaskObserver* observer) { | 39 void WebThreadBase::addTaskObserver(TaskObserver* observer) { |
40 CHECK(isCurrentThread()); | 40 CHECK(isCurrentThread()); |
41 std::pair<TaskObserverMap::iterator, bool> result = task_observer_map_.insert( | 41 std::pair<TaskObserverMap::iterator, bool> result = task_observer_map_.insert( |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 return message_loop_->BelongsToCurrentThread(); | 131 return message_loop_->BelongsToCurrentThread(); |
132 } | 132 } |
133 | 133 |
134 blink::PlatformThreadId WebThreadImplForMessageLoop::threadId() const { | 134 blink::PlatformThreadId WebThreadImplForMessageLoop::threadId() const { |
135 return thread_id_; | 135 return thread_id_; |
136 } | 136 } |
137 | 137 |
138 WebThreadImplForMessageLoop::~WebThreadImplForMessageLoop() {} | 138 WebThreadImplForMessageLoop::~WebThreadImplForMessageLoop() {} |
139 | 139 |
140 } // namespace content | 140 } // namespace content |
OLD | NEW |