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

Side by Side Diff: base/test/scoped_task_scheduler.h

Issue 2768873007: Add Support to Get a COM STA Task Runner from the Task Scheduler API (Closed)
Patch Set: Simplify COM Init for ScopedTaskScheduler 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
« no previous file with comments | « base/task_scheduler/task_scheduler_impl_unittest.cc ('k') | base/test/scoped_task_scheduler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef BASE_TEST_SCOPED_TASK_SCHEDULER_H_ 5 #ifndef BASE_TEST_SCOPED_TASK_SCHEDULER_H_
6 #define BASE_TEST_SCOPED_TASK_SCHEDULER_H_ 6 #define BASE_TEST_SCOPED_TASK_SCHEDULER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/threading/thread_checker.h" 9 #include "base/threading/thread_checker.h"
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // runs "D" because it's BLOCK_SHUTDOWN. "C" is skipped. 50 // runs "D" because it's BLOCK_SHUTDOWN. "C" is skipped.
51 class ScopedTaskScheduler { 51 class ScopedTaskScheduler {
52 public: 52 public:
53 // Registers a synchronous TaskScheduler on a thread that doesn't have a 53 // Registers a synchronous TaskScheduler on a thread that doesn't have a
54 // MessageLoop. 54 // MessageLoop.
55 // 55 //
56 // This constructor handles most common cases. 56 // This constructor handles most common cases.
57 ScopedTaskScheduler(); 57 ScopedTaskScheduler();
58 58
59 // Registers a synchronous TaskScheduler on a thread that already has a 59 // Registers a synchronous TaskScheduler on a thread that already has a
60 // |message_loop|. Calling RunLoop::Run/RunUntilIdle() on the thread where 60 // |message_loop| assumed to be associated with the caller's thread. Calling
61 // this lives runs the MessageLoop and TaskScheduler tasks in posting order. 61 // RunLoop::Run/RunUntilIdle() on the thread where this lives runs the
62 // MessageLoop and TaskScheduler tasks in posting order.
62 // 63 //
63 // In general, you don't need a ScopedTaskScheduler and a MessageLoop because 64 // In general, you don't need a ScopedTaskScheduler and a MessageLoop because
64 // ScopedTaskScheduler provides most MessageLoop features. 65 // ScopedTaskScheduler provides most MessageLoop features.
65 // 66 //
66 // ScopedTaskScheduler scoped_task_scheduler; 67 // ScopedTaskScheduler scoped_task_scheduler;
67 // ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, Bind(&Task)); 68 // ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, Bind(&Task));
68 // RunLoop().RunUntilIdle(); // Runs Task. 69 // RunLoop().RunUntilIdle(); // Runs Task.
69 // 70 //
70 // is equivalent to 71 // is equivalent to
71 // 72 //
(...skipping 21 matching lines...) Expand all
93 const TaskScheduler* task_scheduler_ = nullptr; 94 const TaskScheduler* task_scheduler_ = nullptr;
94 ThreadChecker thread_checker_; 95 ThreadChecker thread_checker_;
95 96
96 DISALLOW_COPY_AND_ASSIGN(ScopedTaskScheduler); 97 DISALLOW_COPY_AND_ASSIGN(ScopedTaskScheduler);
97 }; 98 };
98 99
99 } // namespace test 100 } // namespace test
100 } // namespace base 101 } // namespace base
101 102
102 #endif // BASE_TEST_SCOPED_TASK_SCHEDULER_H_ 103 #endif // BASE_TEST_SCOPED_TASK_SCHEDULER_H_
OLDNEW
« no previous file with comments | « base/task_scheduler/task_scheduler_impl_unittest.cc ('k') | base/test/scoped_task_scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698