Index: content/browser/renderer_host/render_process_host_impl.h |
diff --git a/content/browser/renderer_host/render_process_host_impl.h b/content/browser/renderer_host/render_process_host_impl.h |
index e46e2c511257b92098a5282633d58b3f1f738b0e..efb808ae1468c47a8ec44675384f2e32f5220590 100644 |
--- a/content/browser/renderer_host/render_process_host_impl.h |
+++ b/content/browser/renderer_host/render_process_host_impl.h |
@@ -135,6 +135,8 @@ class CONTENT_EXPORT RenderProcessHostImpl |
void SetSuddenTerminationAllowed(bool enabled) override; |
bool SuddenTerminationAllowed() const override; |
IPC::ChannelProxy* GetChannel() override; |
+ IPC::Sender* GetImmediateSender() override; |
+ IPC::Sender* GetIOThreadSender() override; |
void AddFilter(BrowserMessageFilter* filter) override; |
bool FastShutdownForPageCount(size_t count) override; |
bool FastShutdownStarted() const override; |
@@ -291,8 +293,11 @@ class CONTENT_EXPORT RenderProcessHostImpl |
int32_t pending_views_; |
private: |
- friend class VisitRelayingRenderProcessHost; |
+ class SafeSenderProxy; |
+ |
friend class ChildProcessLauncherBrowserTest_ChildSpawnFail_Test; |
+ friend class SafeSenderProxy; |
+ friend class VisitRelayingRenderProcessHost; |
std::unique_ptr<IPC::ChannelProxy> CreateChannelProxy( |
const std::string& channel_id); |
@@ -300,6 +305,9 @@ class CONTENT_EXPORT RenderProcessHostImpl |
// Creates and adds the IO thread message filters. |
void CreateMessageFilters(); |
+ // Shared implementation for IPC::Senders exposed by this RPH. |
+ bool SendImpl(std::unique_ptr<IPC::Message> message, bool send_now); |
+ |
// Registers Mojo services to be exposed to the renderer. |
void RegisterMojoServices(); |
@@ -362,6 +370,11 @@ class CONTENT_EXPORT RenderProcessHostImpl |
base::FilePath GetEventLogFilePathWithExtensions(const base::FilePath& file); |
#endif |
+ // IPC::Senders which live as long as this RPH and provide safe, opaque |
+ // access to ChannelProxy SendNow() and SendOnIOThread() respectively. |
+ const std::unique_ptr<SafeSenderProxy> immediate_sender_; |
+ const std::unique_ptr<SafeSenderProxy> io_thread_sender_; |
+ |
std::unique_ptr<MojoChildConnection> mojo_child_connection_; |
std::unique_ptr<MojoApplicationHost> mojo_application_host_; |
@@ -407,7 +420,7 @@ class CONTENT_EXPORT RenderProcessHostImpl |
// instead of in the channel so that we ensure they're sent after init related |
// messages that are sent once the process handle is available. This is |
// because the queued messages may have dependencies on the init messages. |
- std::queue<IPC::Message*> queued_messages_; |
+ std::queue<std::unique_ptr<IPC::Message>> queued_messages_; |
// The globally-unique identifier for this RPH. |
const int id_; |