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

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

Issue 2620633004: Remove mojo::edk::test::ScopedIPCSupport (Closed)
Patch Set: . Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/edk/test/scoped_ipc_support.h ('k') | mojo/public/cpp/bindings/tests/BUILD.gn » ('j') | 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
deleted file mode 100644
index 588039a8c21f9a03049efd869f1253994adfeaff..0000000000000000000000000000000000000000
--- a/mojo/edk/test/scoped_ipc_support.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "mojo/edk/test/scoped_ipc_support.h"
-
-#include "base/bind.h"
-#include "base/run_loop.h"
-#include "base/synchronization/waitable_event.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "mojo/edk/embedder/embedder.h"
-
-namespace mojo {
-namespace edk {
-namespace test {
-
-namespace {
-base::TaskRunner* g_io_task_runner = nullptr;
-}
-
-base::TaskRunner* GetIoTaskRunner() {
- return g_io_task_runner;
-}
-
-ScopedIPCSupport::ScopedIPCSupport(
- scoped_refptr<base::TaskRunner> io_thread_task_runner)
- : shutdown_event_(base::WaitableEvent::ResetPolicy::MANUAL,
- base::WaitableEvent::InitialState::NOT_SIGNALED) {
- g_io_task_runner = io_thread_task_runner.get();
- InitIPCSupport(this, io_thread_task_runner);
-}
-
-ScopedIPCSupport::~ScopedIPCSupport() {
- // ShutdownIPCSupport always runs OnShutdownComplete on the current
- // ThreadTaskRunnerHandle if set. Otherwise it's run on the IPC thread. We
- // account for both possibilities here to avoid unnecessarily starting a new
- // MessageLoop or blocking the existing one.
- //
- // TODO(rockot): Clean this up. ShutdownIPCSupport should probably always call
- // call OnShutdownComplete from the IPC thread.
- ShutdownIPCSupport();
- if (base::ThreadTaskRunnerHandle::IsSet()) {
- base::RunLoop run_loop;
- shutdown_closure_ = base::Bind(IgnoreResult(&base::TaskRunner::PostTask),
- base::ThreadTaskRunnerHandle::Get(),
- FROM_HERE, run_loop.QuitClosure());
- run_loop.Run();
- } else {
- shutdown_event_.Wait();
- }
-}
-
-void ScopedIPCSupport::OnShutdownComplete() {
- if (!shutdown_closure_.is_null())
- shutdown_closure_.Run();
- else
- shutdown_event_.Signal();
-}
-
-} // namespace test
-} // namespace edk
-} // namespace mojo
« no previous file with comments | « mojo/edk/test/scoped_ipc_support.h ('k') | mojo/public/cpp/bindings/tests/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698