diff options
author | rockot <rockot@chromium.org> | 2016-02-19 11:49:01 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-19 19:50:08 +0000 |
commit | b2615c3a1f7e69d99711c0d6edf725a40a7b05ea (patch) | |
tree | 4d8c5118be4e4af1194e9a884d4e9ee5936a291d /mojo/edk | |
parent | 208180ba652e296ecf2ed70a9a400af0de25b6a8 (diff) | |
download | chromium_src-b2615c3a1f7e69d99711c0d6edf725a40a7b05ea.zip chromium_src-b2615c3a1f7e69d99711c0d6edf725a40a7b05ea.tar.gz chromium_src-b2615c3a1f7e69d99711c0d6edf725a40a7b05ea.tar.bz2 |
Mojo: Simplify IPC initialization assumptions
ScopedIPCSupport most likely has something wrong with it. This
removes all of its complexity since it's no longer needed. Instead
only a single ScopedIPCSupport per process is allowed.
The ScopedIPCSupport is removed from content::ChannelInit (which
can be removed in a future patch) and the one in BrowserMainLoop
is initialized a bit earlier, torn down a bit later.
BUG=587807
Review URL: https://codereview.chromium.org/1710823003
Cr-Commit-Position: refs/heads/master@{#376517}
Diffstat (limited to 'mojo/edk')
-rw-r--r-- | mojo/edk/embedder/embedder.cc | 6 | ||||
-rw-r--r-- | mojo/edk/embedder/embedder.h | 21 | ||||
-rw-r--r-- | mojo/edk/embedder/process_delegate.h | 3 | ||||
-rw-r--r-- | mojo/edk/test/scoped_ipc_support.cc | 9 | ||||
-rw-r--r-- | mojo/edk/test/scoped_ipc_support.h | 3 |
5 files changed, 11 insertions, 31 deletions
diff --git a/mojo/edk/embedder/embedder.cc b/mojo/edk/embedder/embedder.cc index 2fe0c8d..1feadda 100644 --- a/mojo/edk/embedder/embedder.cc +++ b/mojo/edk/embedder/embedder.cc @@ -94,9 +94,6 @@ void InitIPCSupport(ProcessDelegate* process_delegate, internal::g_process_delegate = process_delegate; } -void ShutdownIPCSupportOnIOThread() { -} - void ShutdownIPCSupport() { CHECK(internal::g_process_delegate); CHECK(internal::g_core); @@ -108,19 +105,16 @@ void ShutdownIPCSupport() { ScopedMessagePipeHandle CreateMessagePipe( ScopedPlatformHandle platform_handle) { CHECK(internal::g_process_delegate); - CHECK(internal::g_core); return internal::g_core->CreateMessagePipe(std::move(platform_handle)); } ScopedMessagePipeHandle CreateParentMessagePipe(const std::string& token) { CHECK(internal::g_process_delegate); - CHECK(internal::g_core); return internal::g_core->CreateParentMessagePipe(token); } ScopedMessagePipeHandle CreateChildMessagePipe(const std::string& token) { CHECK(internal::g_process_delegate); - CHECK(internal::g_core); return internal::g_core->CreateChildMessagePipe(token); } diff --git a/mojo/edk/embedder/embedder.h b/mojo/edk/embedder/embedder.h index 6c010f4..e34ef5c 100644 --- a/mojo/edk/embedder/embedder.h +++ b/mojo/edk/embedder/embedder.h @@ -100,30 +100,23 @@ CreateSharedBufferWrapper(base::SharedMemoryHandle shared_memory_handle, // making the IPC functions (in the following section) available and functional. // (This may only be done after |Init()|.) // -// This subsystem may be shut down, using |ShutdownIPCSupportOnIOThread()| or -// |ShutdownIPCSupport()|. None of the IPC functions may be called while or -// after either of these is called. +// This subsystem may be shut down using |ShutdownIPCSupport()|. None of the IPC +// functions may be called after this is called. // Initializes a process of the given type; to be called after |Init()|. // - |process_delegate| must be a process delegate of the appropriate type // corresponding to |process_type|; its methods will be called on the same // thread as Shutdown. // - |process_delegate|, and |io_thread_task_runner| should live at least -// until |ShutdownIPCSupport()|'s callback has been run or -// |ShutdownIPCSupportOnIOThread()| has completed. +// until |ShutdownIPCSupport()|'s callback has been run. MOJO_SYSTEM_IMPL_EXPORT void InitIPCSupport( ProcessDelegate* process_delegate, scoped_refptr<base::TaskRunner> io_thread_task_runner); -// Shuts down the subsystem initialized by |InitIPCSupport()|. This must be -// called on the I/O thread (given to |InitIPCSupport()|). This completes -// synchronously and does not result in a call to the process delegate's -// |OnShutdownComplete()|. -MOJO_SYSTEM_IMPL_EXPORT void ShutdownIPCSupportOnIOThread(); - -// Like |ShutdownIPCSupportOnIOThread()|, but may be called from any thread, -// signalling shutdown completion via the process delegate's -// |OnShutdownComplete()|. +// Shuts down the subsystem initialized by |InitIPCSupport()|. It be called from +// any thread and will attempt to complete shutdown on the I/O thread with which +// the system was initialized. Upon completion the ProcessDelegate's +// |OnShutdownComplete()| method is invoked. MOJO_SYSTEM_IMPL_EXPORT void ShutdownIPCSupport(); // Creates a message pipe over an arbitrary platform channel. The other end of diff --git a/mojo/edk/embedder/process_delegate.h b/mojo/edk/embedder/process_delegate.h index e5f90af..1357a76 100644 --- a/mojo/edk/embedder/process_delegate.h +++ b/mojo/edk/embedder/process_delegate.h @@ -14,8 +14,7 @@ namespace edk { // An interface for process delegates. class MOJO_SYSTEM_IMPL_EXPORT ProcessDelegate { public: - // Called when |ShutdownIPCSupport()| has "completed". Note that this is NOT - // called if |ShutdownIPCSupportOnIOThread()| is used instead. + // Called when |ShutdownIPCSupport()| has completed work on the I/O thread. virtual void OnShutdownComplete() = 0; protected: diff --git a/mojo/edk/test/scoped_ipc_support.cc b/mojo/edk/test/scoped_ipc_support.cc index 68e7ac2..d7ff28b 100644 --- a/mojo/edk/test/scoped_ipc_support.cc +++ b/mojo/edk/test/scoped_ipc_support.cc @@ -19,13 +19,8 @@ ScopedIPCSupportHelper::ScopedIPCSupportHelper() { } ScopedIPCSupportHelper::~ScopedIPCSupportHelper() { - if (base::MessageLoop::current() && - base::MessageLoop::current()->task_runner() == io_thread_task_runner_) { - ShutdownIPCSupportOnIOThread(); - } else { - ShutdownIPCSupport(); - run_loop_.Run(); - } + ShutdownIPCSupport(); + run_loop_.Run(); } void ScopedIPCSupportHelper::Init( diff --git a/mojo/edk/test/scoped_ipc_support.h b/mojo/edk/test/scoped_ipc_support.h index 132ed44..e920265 100644 --- a/mojo/edk/test/scoped_ipc_support.h +++ b/mojo/edk/test/scoped_ipc_support.h @@ -40,8 +40,7 @@ class ScopedIPCSupportHelper { } // namespace internal // A simple class that calls |InitIPCSupport()| on construction and -// |ShutdownIPCSupport()| on destruction (or |ShutdownIPCSupportOnIOThread()| -// if destroyed on the I/O thread). +// |ShutdownIPCSupport()| on destruction. class ScopedIPCSupport : public ProcessDelegate { public: explicit ScopedIPCSupport( |