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

Unified Diff: mojo/edk/embedder/embedder.cc

Issue 1492943005: Remove ShutdownIPCSupportAndWaitForNoChannels. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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/embedder/embedder.h ('k') | mojo/edk/embedder/embedder_internal.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/embedder/embedder.cc
diff --git a/mojo/edk/embedder/embedder.cc b/mojo/edk/embedder/embedder.cc
index f9b5c9daaeb72664ea0190700262dd2a16ae060a..eb572c5717bebeb537fdc44481e1a9992ac2b55c 100644
--- a/mojo/edk/embedder/embedder.cc
+++ b/mojo/edk/embedder/embedder.cc
@@ -28,25 +28,10 @@
namespace mojo {
namespace edk {
-// TODO(jam): move into annonymous namespace. Keep outside for debugging in VS
-// temporarily.
-int g_channel_count = 0;
-bool g_wait_for_no_more_channels = false;
-base::TaskRunner* g_delegate_task_runner = nullptr; // Used at shutdown.
-
namespace {
// Note: Called on the I/O thread.
-void ShutdownIPCSupportHelper(bool wait_for_no_more_channels) {
- if (wait_for_no_more_channels && g_channel_count) {
- g_wait_for_no_more_channels = true;
- return;
- }
-
- g_delegate_task_runner->PostTask(
- FROM_HERE, base::Bind(&ProcessDelegate::OnShutdownComplete,
- base::Unretained(internal::g_process_delegate)));
- g_delegate_task_runner = nullptr;
+void ShutdownIPCSupportHelper() {
}
} // namespace
@@ -65,23 +50,6 @@ Core* GetCore() {
return g_core;
}
-void ChannelStarted() {
- DCHECK(g_io_thread_task_runner->RunsTasksOnCurrentThread());
- g_channel_count++;
-}
-
-void ChannelShutdown() {
- DCHECK(g_io_thread_task_runner->RunsTasksOnCurrentThread());
- DCHECK_GT(g_channel_count, 0);
- g_channel_count--;
- if (!g_channel_count && g_wait_for_no_more_channels) {
- // Reset g_wait_for_no_more_channels for unit tests which initialize and
- // tear down multiple times in a process.
- g_wait_for_no_more_channels = false;
- ShutdownIPCSupportHelper(false);
- }
-}
-
} // namespace internal
void SetMaxMessageSize(size_t bytes) {
@@ -188,15 +156,11 @@ void ShutdownIPCSupportOnIOThread() {
}
void ShutdownIPCSupport() {
- g_delegate_task_runner = base::MessageLoop::current()->task_runner().get();
- internal::g_io_thread_task_runner->PostTask(
- FROM_HERE, base::Bind(&ShutdownIPCSupportHelper, false));
-}
-
-void ShutdownIPCSupportAndWaitForNoChannels() {
- g_delegate_task_runner = base::MessageLoop::current()->task_runner().get();
- internal::g_io_thread_task_runner->PostTask(
- FROM_HERE, base::Bind(&ShutdownIPCSupportHelper, true));
+ internal::g_io_thread_task_runner->PostTaskAndReply(
+ FROM_HERE,
+ base::Bind(&ShutdownIPCSupportHelper),
+ base::Bind(&ProcessDelegate::OnShutdownComplete,
+ base::Unretained(internal::g_process_delegate)));
}
ScopedMessagePipeHandle CreateMessagePipe(
« no previous file with comments | « mojo/edk/embedder/embedder.h ('k') | mojo/edk/embedder/embedder_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698