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 <utility> | 5 #include <utility> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 bool PostDelayedTask(const tracked_objects::Location& from_here, | 41 bool PostDelayedTask(const tracked_objects::Location& from_here, |
42 base::OnceClosure task, | 42 base::OnceClosure task, |
43 base::TimeDelta delay) override { | 43 base::TimeDelta delay) override { |
44 { | 44 { |
45 base::AutoLock locker(lock_); | 45 base::AutoLock locker(lock_); |
46 tasks_.push(std::move(task)); | 46 tasks_.push(std::move(task)); |
47 } | 47 } |
48 task_ready_.Signal(); | 48 task_ready_.Signal(); |
49 return true; | 49 return true; |
50 } | 50 } |
51 bool RunsTasksOnCurrentThread() const override { | 51 bool RunsTasksInCurrentSequence() const override { |
52 return base::PlatformThread::CurrentRef() == thread_id_; | 52 return base::PlatformThread::CurrentRef() == thread_id_; |
53 } | 53 } |
54 | 54 |
55 // Only quits when Quit() is called. | 55 // Only quits when Quit() is called. |
56 void Run() { | 56 void Run() { |
57 DCHECK(RunsTasksOnCurrentThread()); | 57 DCHECK(RunsTasksOnCurrentThread()); |
58 quit_called_ = false; | 58 quit_called_ = false; |
59 | 59 |
60 while (true) { | 60 while (true) { |
61 { | 61 { |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 EXPECT_TRUE(sender_impl_error); | 386 EXPECT_TRUE(sender_impl_error); |
387 connection_ptr_task_runner_->Run(); | 387 connection_ptr_task_runner_->Run(); |
388 EXPECT_TRUE(connection_ptr_error); | 388 EXPECT_TRUE(connection_ptr_error); |
389 sender_ptr_task_runner_->Run(); | 389 sender_ptr_task_runner_->Run(); |
390 EXPECT_TRUE(sender_ptr_error); | 390 EXPECT_TRUE(sender_ptr_error); |
391 } | 391 } |
392 | 392 |
393 } // namespace | 393 } // namespace |
394 } // namespace test | 394 } // namespace test |
395 } // namespace mojo | 395 } // namespace mojo |
OLD | NEW |