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

Unified Diff: mojo/edk/test/scoped_ipc_support.cc

Issue 2514093002: Mojo EDK: Clean shutdown for ScopedIPCSupport in tests (Closed)
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/edk/test/scoped_ipc_support.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/test/scoped_ipc_support.cc
diff --git a/mojo/edk/test/scoped_ipc_support.cc b/mojo/edk/test/scoped_ipc_support.cc
index 7dc7c99b946624eda9397242c9c33857d26f3c43..bbf2432798a3d5f2922c2d826750518dd721756b 100644
--- a/mojo/edk/test/scoped_ipc_support.cc
+++ b/mojo/edk/test/scoped_ipc_support.cc
@@ -21,40 +21,22 @@ base::TaskRunner* GetIoTaskRunner() {
return g_io_task_runner;
}
-namespace internal {
-
-ScopedIPCSupportHelper::ScopedIPCSupportHelper() {
-}
-
-ScopedIPCSupportHelper::~ScopedIPCSupportHelper() {
- ShutdownIPCSupport();
- run_loop_.Run();
-}
-
-void ScopedIPCSupportHelper::Init(
- ProcessDelegate* process_delegate,
- scoped_refptr<base::TaskRunner> io_thread_task_runner) {
- io_thread_task_runner_ = io_thread_task_runner;
- InitIPCSupport(process_delegate, io_thread_task_runner_);
-}
-
-void ScopedIPCSupportHelper::OnShutdownCompleteImpl() {
- run_loop_.Quit();
-}
-
-} // namespace internal
-
ScopedIPCSupport::ScopedIPCSupport(
scoped_refptr<base::TaskRunner> io_thread_task_runner) {
g_io_task_runner = io_thread_task_runner.get();
- helper_.Init(this, std::move(io_thread_task_runner));
+ InitIPCSupport(this, io_thread_task_runner);
}
ScopedIPCSupport::~ScopedIPCSupport() {
+ base::RunLoop run_loop;
+ quit_closure = run_loop.QuitClosure();
+ ShutdownIPCSupport();
+ run_loop.Run();
}
void ScopedIPCSupport::OnShutdownComplete() {
- helper_.OnShutdownCompleteImpl();
+ DCHECK(!quit_closure.is_null());
+ quit_closure.Run();
yzshen1 2016/11/20 06:07:35 (My understanding of the embedder API is purely fr
}
} // namespace test
« no previous file with comments | « mojo/edk/test/scoped_ipc_support.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698