Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: mojo/public/cpp/bindings/tests/bind_task_runner_unittest.cc

Issue 2823103003: Introduce TaskRunner::RunsTasksInCurrentSequence() (Closed)
Patch Set: remove RunsTasksOnCurrentThread() overrided. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 RunsTasksOnCurrentThread() const {
gab 2017/04/18 15:00:33 Remove this.
52 return RunsTasksInCurrentSequence();
53 }
54 bool RunsTasksInCurrentSequence() const override {
52 return base::PlatformThread::CurrentRef() == thread_id_; 55 return base::PlatformThread::CurrentRef() == thread_id_;
53 } 56 }
54 57
55 // Only quits when Quit() is called. 58 // Only quits when Quit() is called.
56 void Run() { 59 void Run() {
57 DCHECK(RunsTasksOnCurrentThread()); 60 DCHECK(RunsTasksOnCurrentThread());
58 quit_called_ = false; 61 quit_called_ = false;
59 62
60 while (true) { 63 while (true) {
61 { 64 {
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 EXPECT_TRUE(sender_impl_error); 389 EXPECT_TRUE(sender_impl_error);
387 connection_ptr_task_runner_->Run(); 390 connection_ptr_task_runner_->Run();
388 EXPECT_TRUE(connection_ptr_error); 391 EXPECT_TRUE(connection_ptr_error);
389 sender_ptr_task_runner_->Run(); 392 sender_ptr_task_runner_->Run();
390 EXPECT_TRUE(sender_ptr_error); 393 EXPECT_TRUE(sender_ptr_error);
391 } 394 }
392 395
393 } // namespace 396 } // namespace
394 } // namespace test 397 } // namespace test
395 } // namespace mojo 398 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698