OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_TEST_SCOPED_IPC_SUPPORT_H_ | 5 #ifndef MOJO_EDK_TEST_SCOPED_IPC_SUPPORT_H_ |
6 #define MOJO_EDK_TEST_SCOPED_IPC_SUPPORT_H_ | 6 #define MOJO_EDK_TEST_SCOPED_IPC_SUPPORT_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 void Init(ProcessDelegate* process_delegate, | 27 void Init(ProcessDelegate* process_delegate, |
28 scoped_refptr<base::TaskRunner> io_thread_task_runner); | 28 scoped_refptr<base::TaskRunner> io_thread_task_runner); |
29 | 29 |
30 void OnShutdownCompleteImpl(); | 30 void OnShutdownCompleteImpl(); |
31 | 31 |
32 private: | 32 private: |
33 scoped_refptr<base::TaskRunner> io_thread_task_runner_; | 33 scoped_refptr<base::TaskRunner> io_thread_task_runner_; |
34 | 34 |
35 base::RunLoop run_loop_; | 35 base::RunLoop run_loop_; |
36 | 36 |
37 MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedIPCSupportHelper); | 37 DISALLOW_COPY_AND_ASSIGN(ScopedIPCSupportHelper); |
38 }; | 38 }; |
39 | 39 |
40 } // namespace internal | 40 } // namespace internal |
41 | 41 |
42 // A simple class that calls |InitIPCSupport()| on construction and | 42 // A simple class that calls |InitIPCSupport()| on construction and |
43 // |ShutdownIPCSupport()| on destruction. | 43 // |ShutdownIPCSupport()| on destruction. |
44 class ScopedIPCSupport : public ProcessDelegate { | 44 class ScopedIPCSupport : public ProcessDelegate { |
45 public: | 45 public: |
46 explicit ScopedIPCSupport( | 46 explicit ScopedIPCSupport( |
47 scoped_refptr<base::TaskRunner> io_thread_task_runner); | 47 scoped_refptr<base::TaskRunner> io_thread_task_runner); |
48 ~ScopedIPCSupport() override; | 48 ~ScopedIPCSupport() override; |
49 | 49 |
50 private: | 50 private: |
51 // |ProcessDelegate| implementation: | 51 // |ProcessDelegate| implementation: |
52 // Note: Executed on the I/O thread. | 52 // Note: Executed on the I/O thread. |
53 void OnShutdownComplete() override; | 53 void OnShutdownComplete() override; |
54 | 54 |
55 internal::ScopedIPCSupportHelper helper_; | 55 internal::ScopedIPCSupportHelper helper_; |
56 | 56 |
57 MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedIPCSupport); | 57 DISALLOW_COPY_AND_ASSIGN(ScopedIPCSupport); |
58 }; | 58 }; |
59 | 59 |
60 } // namespace test | 60 } // namespace test |
61 } // namespace edk | 61 } // namespace edk |
62 } // namespace mojo | 62 } // namespace mojo |
63 | 63 |
64 #endif // MOJO_EDK_TEST_SCOPED_IPC_SUPPORT_H_ | 64 #endif // MOJO_EDK_TEST_SCOPED_IPC_SUPPORT_H_ |
OLD | NEW |