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

Unified Diff: ipc/mojo/ipc_channel_mojo_host.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 | « ipc/mojo/ipc_channel_mojo.cc ('k') | ipc/mojo/ipc_channel_mojo_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/mojo/ipc_channel_mojo_host.h
diff --git a/ipc/mojo/ipc_channel_mojo_host.h b/ipc/mojo/ipc_channel_mojo_host.h
index e0d94beddc119903cac771a1e04bbf08f00f943f..dd67897ed890269154bf24d900c88341d27c728f 100644
--- a/ipc/mojo/ipc_channel_mojo_host.h
+++ b/ipc/mojo/ipc_channel_mojo_host.h
@@ -9,6 +9,7 @@
#include "base/memory/weak_ptr.h"
#include "base/process/process_handle.h"
#include "ipc/ipc_export.h"
+#include "ipc/mojo/ipc_channel_mojo.h"
namespace base {
class TaskRunner;
@@ -16,30 +17,31 @@ class TaskRunner;
namespace IPC {
-class ChannelMojo;
-
// Through ChannelMojoHost, ChannelMojo gets extra information that
// its client provides, including the child process's process handle. Every
// server process that uses ChannelMojo must have a ChannelMojoHost
// instance and call OnClientLaunched().
class IPC_MOJO_EXPORT ChannelMojoHost {
public:
- explicit ChannelMojoHost(scoped_refptr<base::TaskRunner> task_runner);
+ explicit ChannelMojoHost(scoped_refptr<base::TaskRunner> io_task_runner);
~ChannelMojoHost();
void OnClientLaunched(base::ProcessHandle process);
+ ChannelMojo::Delegate* channel_delegate() const;
private:
- friend class ChannelMojo;
-
- void OnChannelCreated(ChannelMojo* channel);
- void OnChannelDestroyed();
+ class ChannelDelegate;
- void InvokeOnClientLaunched(base::ProcessHandle process);
+ // Delegate talks to ChannelMojo, whch lives in IO thread, thus
+ // the Delegate should also live and dies in the IO thread as well.
+ class DelegateDeleter {
+ public:
+ void operator()(ChannelDelegate* ptr) const;
+ };
base::WeakPtrFactory<ChannelMojoHost> weak_factory_;
- scoped_refptr<base::TaskRunner> task_runner_;
- ChannelMojo* channel_;
+ const scoped_refptr<base::TaskRunner> io_task_runner_;
+ scoped_ptr<ChannelDelegate, DelegateDeleter> channel_delegate_;
DISALLOW_COPY_AND_ASSIGN(ChannelMojoHost);
};
« no previous file with comments | « ipc/mojo/ipc_channel_mojo.cc ('k') | ipc/mojo/ipc_channel_mojo_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698