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

Unified Diff: ipc/mojo/ipc_channel_mojo.h

Issue 599333002: ChannelMojo: Handle when ChannelMojo outlives ChannelMojoHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Landing Created 6 years, 3 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 | « content/browser/renderer_host/render_process_host_impl.cc ('k') | ipc/mojo/ipc_channel_mojo.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/mojo/ipc_channel_mojo.h
diff --git a/ipc/mojo/ipc_channel_mojo.h b/ipc/mojo/ipc_channel_mojo.h
index e3ecb995b9fc6150b65ff12ff6fe7acaff555b47..dcf236d7a25c0213c5684f8e4027e3c04f5fbb22 100644
--- a/ipc/mojo/ipc_channel_mojo.h
+++ b/ipc/mojo/ipc_channel_mojo.h
@@ -32,8 +32,6 @@ class ClientControlReader;
class MessageReader;
}
-class ChannelMojoHost;
-
// Mojo-based IPC::Channel implementation over a platform handle.
//
// ChannelMojo builds Mojo MessagePipe using underlying pipe given by
@@ -61,9 +59,17 @@ class ChannelMojoHost;
class IPC_MOJO_EXPORT ChannelMojo : public Channel,
public MojoBootstrap::Delegate {
public:
+ class Delegate {
+ public:
+ virtual ~Delegate() {}
+ virtual base::WeakPtr<Delegate> ToWeakPtr() = 0;
+ virtual scoped_refptr<base::TaskRunner> GetIOTaskRunner() = 0;
+ virtual void OnChannelCreated(base::WeakPtr<ChannelMojo> channel) = 0;
+ };
+
// Create ChannelMojo. A bootstrap channel is created as well.
- // |host| must not be null.
- static scoped_ptr<ChannelMojo> Create(ChannelMojoHost* host,
+ // |host| must not be null for server channels.
+ static scoped_ptr<ChannelMojo> Create(Delegate* delegate,
const ChannelHandle& channel_handle,
Mode mode,
Listener* listener);
@@ -72,7 +78,7 @@ class IPC_MOJO_EXPORT ChannelMojo : public Channel,
// The factory is used to create Mojo-based ChannelProxy family.
// |host| must not be null.
static scoped_ptr<ChannelFactory> CreateServerFactory(
- ChannelMojoHost* host,
+ Delegate* delegate,
const ChannelHandle& channel_handle);
static scoped_ptr<ChannelFactory> CreateClientFactory(
@@ -118,7 +124,7 @@ class IPC_MOJO_EXPORT ChannelMojo : public Channel,
void set_peer_pid(base::ProcessId pid) { peer_pid_ = pid; }
protected:
- ChannelMojo(ChannelMojoHost* host,
+ ChannelMojo(Delegate* delegate,
const ChannelHandle& channel_handle,
Mode mode,
Listener* listener);
@@ -133,10 +139,11 @@ class IPC_MOJO_EXPORT ChannelMojo : public Channel,
// notifications invoked by them.
typedef internal::MessagePipeReader::DelayedDeleter ReaderDeleter;
+ void InitDelegate(ChannelMojo::Delegate* delegate);
void InitControlReader(mojo::embedder::ScopedPlatformHandle handle);
scoped_ptr<MojoBootstrap> bootstrap_;
- ChannelMojoHost* const host_;
+ base::WeakPtr<Delegate> delegate_;
Mode mode_;
Listener* listener_;
base::ProcessId peer_pid_;
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | ipc/mojo/ipc_channel_mojo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698