OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
6 #include "base/single_thread_task_runner.h" | 6 #include "base/single_thread_task_runner.h" |
7 #include "base/synchronization/lock.h" | 7 #include "base/synchronization/lock.h" |
8 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
9 #include "base/threading/platform_thread.h" | 9 #include "base/threading/platform_thread.h" |
10 #include "mojo/public/cpp/bindings/associated_binding.h" | 10 #include "mojo/public/cpp/bindings/associated_binding.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 { | 40 { |
41 base::AutoLock locker(lock_); | 41 base::AutoLock locker(lock_); |
42 tasks_.push(task); | 42 tasks_.push(task); |
43 } | 43 } |
44 task_ready_.Signal(); | 44 task_ready_.Signal(); |
45 return true; | 45 return true; |
46 } | 46 } |
47 bool RunsTasksOnCurrentThread() const override { | 47 bool RunsTasksOnCurrentThread() const override { |
48 return base::PlatformThread::CurrentRef() == thread_id_; | 48 return base::PlatformThread::CurrentRef() == thread_id_; |
49 } | 49 } |
| 50 std::string GetThreadName() const override { return std::string(); } |
50 | 51 |
51 // Only quits when Quit() is called. | 52 // Only quits when Quit() is called. |
52 void Run() { | 53 void Run() { |
53 DCHECK(RunsTasksOnCurrentThread()); | 54 DCHECK(RunsTasksOnCurrentThread()); |
54 quit_called_ = false; | 55 quit_called_ = false; |
55 | 56 |
56 while (true) { | 57 while (true) { |
57 { | 58 { |
58 base::AutoLock locker(lock_); | 59 base::AutoLock locker(lock_); |
59 while (!tasks_.empty()) { | 60 while (!tasks_.empty()) { |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 EXPECT_TRUE(sender_impl_error); | 361 EXPECT_TRUE(sender_impl_error); |
361 connection_ptr_task_runner_->Run(); | 362 connection_ptr_task_runner_->Run(); |
362 EXPECT_TRUE(connection_ptr_error); | 363 EXPECT_TRUE(connection_ptr_error); |
363 sender_ptr_task_runner_->Run(); | 364 sender_ptr_task_runner_->Run(); |
364 EXPECT_TRUE(sender_ptr_error); | 365 EXPECT_TRUE(sender_ptr_error); |
365 } | 366 } |
366 | 367 |
367 } // namespace | 368 } // namespace |
368 } // namespace test | 369 } // namespace test |
369 } // namespace mojo | 370 } // namespace mojo |
OLD | NEW |