| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MOJO_EDK_TEST_SCOPED_IPC_SUPPORT_H_ | |
| 6 #define MOJO_EDK_TEST_SCOPED_IPC_SUPPORT_H_ | |
| 7 | |
| 8 #include "base/callback.h" | |
| 9 #include "base/memory/ref_counted.h" | |
| 10 #include "base/synchronization/waitable_event.h" | |
| 11 #include "base/task_runner.h" | |
| 12 #include "mojo/edk/embedder/process_delegate.h" | |
| 13 | |
| 14 namespace mojo { | |
| 15 namespace edk { | |
| 16 namespace test { | |
| 17 | |
| 18 base::TaskRunner* GetIoTaskRunner(); | |
| 19 | |
| 20 // A simple class that calls |InitIPCSupport()| on construction and | |
| 21 // |ShutdownIPCSupport()| on destruction. | |
| 22 class ScopedIPCSupport : public ProcessDelegate { | |
| 23 public: | |
| 24 explicit ScopedIPCSupport( | |
| 25 scoped_refptr<base::TaskRunner> io_thread_task_runner); | |
| 26 ~ScopedIPCSupport() override; | |
| 27 | |
| 28 private: | |
| 29 // |ProcessDelegate| implementation: | |
| 30 // Note: Executed on the I/O thread. | |
| 31 void OnShutdownComplete() override; | |
| 32 | |
| 33 base::Closure shutdown_closure_; | |
| 34 base::WaitableEvent shutdown_event_; | |
| 35 | |
| 36 DISALLOW_COPY_AND_ASSIGN(ScopedIPCSupport); | |
| 37 }; | |
| 38 | |
| 39 } // namespace test | |
| 40 } // namespace edk | |
| 41 } // namespace mojo | |
| 42 | |
| 43 #endif // MOJO_EDK_TEST_SCOPED_IPC_SUPPORT_H_ | |
| OLD | NEW |