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

Side by Side Diff: mojo/edk/system/test/test_io_thread.h

Issue 1408003013: Reland "EDK: Move //mojo/edk/system/waitable_event* to edk/util." (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 1 month 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 | « mojo/edk/system/slave_connection_manager.h ('k') | mojo/edk/system/test/test_io_thread.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 MOJO_EDK_SYSTEM_TEST_TEST_IO_THREAD_H_ 5 #ifndef MOJO_EDK_SYSTEM_TEST_TEST_IO_THREAD_H_
6 #define MOJO_EDK_SYSTEM_TEST_TEST_IO_THREAD_H_ 6 #define MOJO_EDK_SYSTEM_TEST_TEST_IO_THREAD_H_
7 7
8 #include "base/callback_forward.h" 8 #include "base/callback_forward.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/task_runner.h" 10 #include "base/task_runner.h"
(...skipping 11 matching lines...) Expand all
22 explicit TestIOThread(StartMode start_mode); 22 explicit TestIOThread(StartMode start_mode);
23 // Stops the I/O thread if necessary. 23 // Stops the I/O thread if necessary.
24 ~TestIOThread(); 24 ~TestIOThread();
25 25
26 // |Start()|/|Stop()| should only be called from the main (creation) thread. 26 // |Start()|/|Stop()| should only be called from the main (creation) thread.
27 // After |Stop()|, |Start()| may be called again to start a new I/O thread. 27 // After |Stop()|, |Start()| may be called again to start a new I/O thread.
28 // |Stop()| may be called even when the I/O thread is not started. 28 // |Stop()| may be called even when the I/O thread is not started.
29 void Start(); 29 void Start();
30 void Stop(); 30 void Stop();
31 31
32 // Post |task| to the IO thread. 32 // Posts |task| to the I/O thread.
33 void PostTask(const base::Closure& task); 33 void PostTask(const base::Closure& task);
34 // Posts |task| to the IO-thread with an WaitableEvent associated blocks on 34 // Posts |task| to the I/O thread, blocking the calling thread until the
35 // it until the posted |task| is executed, then returns. 35 // posted task is executed (note the deadlock risk!).
36 void PostTaskAndWait(const base::Closure& task); 36 void PostTaskAndWait(const base::Closure& task);
37 37
38 base::MessageLoopForIO* message_loop() { 38 base::MessageLoopForIO* message_loop() {
39 return static_cast<base::MessageLoopForIO*>(io_thread_.message_loop()); 39 return static_cast<base::MessageLoopForIO*>(io_thread_.message_loop());
40 } 40 }
41 41
42 scoped_refptr<base::SingleThreadTaskRunner> task_runner() { 42 scoped_refptr<base::SingleThreadTaskRunner> task_runner() {
43 return message_loop()->task_runner(); 43 return message_loop()->task_runner();
44 } 44 }
45 45
46 private: 46 private:
47 base::Thread io_thread_; 47 base::Thread io_thread_;
48 bool io_thread_started_; 48 bool io_thread_started_;
49 49
50 MOJO_DISALLOW_COPY_AND_ASSIGN(TestIOThread); 50 MOJO_DISALLOW_COPY_AND_ASSIGN(TestIOThread);
51 }; 51 };
52 52
53 } // namespace test 53 } // namespace test
54 } // namespace system 54 } // namespace system
55 } // namespace mojo 55 } // namespace mojo
56 56
57 #endif // MOJO_EDK_SYSTEM_TEST_TEST_IO_THREAD_H_ 57 #endif // MOJO_EDK_SYSTEM_TEST_TEST_IO_THREAD_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/slave_connection_manager.h ('k') | mojo/edk/system/test/test_io_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698