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/webthread_impl_for_renderer_scheduler.h" | 5 #include "components/scheduler/renderer/webthread_impl_for_renderer_scheduler.h" |
6 | 6 |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "components/scheduler/child/scheduler_task_runner_delegate_impl.h" | 10 #include "components/scheduler/child/scheduler_task_runner_delegate_impl.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 thread_.taskRunner()->postTask(blink::WebTraceLocation(), task2.release()); | 142 thread_.taskRunner()->postTask(blink::WebTraceLocation(), task2.release()); |
143 thread_.taskRunner()->postTask(blink::WebTraceLocation(), task3.release()); | 143 thread_.taskRunner()->postTask(blink::WebTraceLocation(), task3.release()); |
144 message_loop_.RunUntilIdle(); | 144 message_loop_.RunUntilIdle(); |
145 thread_.removeTaskObserver(&observer); | 145 thread_.removeTaskObserver(&observer); |
146 } | 146 } |
147 | 147 |
148 class ExitRunLoopTask : public blink::WebTaskRunner::Task { | 148 class ExitRunLoopTask : public blink::WebTaskRunner::Task { |
149 public: | 149 public: |
150 ExitRunLoopTask(base::RunLoop* run_loop) : run_loop_(run_loop) {} | 150 ExitRunLoopTask(base::RunLoop* run_loop) : run_loop_(run_loop) {} |
151 | 151 |
152 virtual void run() { run_loop_->Quit(); } | 152 void run() override { run_loop_->Quit(); } |
153 | 153 |
154 private: | 154 private: |
155 base::RunLoop* run_loop_; | 155 base::RunLoop* run_loop_; |
156 }; | 156 }; |
157 | 157 |
158 void EnterRunLoop(base::MessageLoop* message_loop, blink::WebThread* thread) { | 158 void EnterRunLoop(base::MessageLoop* message_loop, blink::WebThread* thread) { |
159 // Note: WebThreads do not support nested run loops, which is why we use a | 159 // Note: WebThreads do not support nested run loops, which is why we use a |
160 // run loop directly. | 160 // run loop directly. |
161 base::RunLoop run_loop; | 161 base::RunLoop run_loop; |
162 thread->taskRunner()->postTask(blink::WebTraceLocation(), | 162 thread->taskRunner()->postTask(blink::WebTraceLocation(), |
(...skipping 21 matching lines...) Expand all Loading... |
184 } | 184 } |
185 | 185 |
186 message_loop_.task_runner()->PostTask( | 186 message_loop_.task_runner()->PostTask( |
187 FROM_HERE, base::Bind(&EnterRunLoop, base::Unretained(&message_loop_), | 187 FROM_HERE, base::Bind(&EnterRunLoop, base::Unretained(&message_loop_), |
188 base::Unretained(&thread_))); | 188 base::Unretained(&thread_))); |
189 message_loop_.RunUntilIdle(); | 189 message_loop_.RunUntilIdle(); |
190 thread_.removeTaskObserver(&observer); | 190 thread_.removeTaskObserver(&observer); |
191 } | 191 } |
192 | 192 |
193 } // namespace scheduler | 193 } // namespace scheduler |
OLD | NEW |