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

Unified Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 584173002: Revert "Always activate MojoApplicationHost" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_process_host_impl.cc
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index dd3a46ead886613f6edc532b81ab9d6cfab2be37..fee818dd764672c7db4b41237423f69bf85e70b1 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -437,6 +437,7 @@ RenderProcessHostImpl::RenderProcessHostImpl(
#endif
pending_views_(0),
mojo_application_host_(new MojoApplicationHost),
+ mojo_activation_required_(false),
visible_widgets_(0),
backgrounded_(true),
is_initialized_(false),
@@ -641,6 +642,20 @@ bool RenderProcessHostImpl::Init() {
return true;
}
+void RenderProcessHostImpl::MaybeActivateMojo() {
+ // TODO(darin): Following security review, we can unconditionally initialize
+ // Mojo in all renderers. We will then be able to directly call Activate()
+ // from OnProcessLaunched.
+ if (!mojo_activation_required_)
+ return; // Waiting on someone to require Mojo.
+
+ if (!GetHandle())
+ return; // Waiting on renderer startup.
+
+ if (!mojo_application_host_->did_activate())
+ mojo_application_host_->Activate(this, GetHandle());
+}
+
bool RenderProcessHostImpl::ShouldUseMojoChannel() const {
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
@@ -1911,6 +1926,7 @@ void RenderProcessHostImpl::ProcessDied(bool already_dead) {
}
mojo_application_host_.reset(new MojoApplicationHost);
+ mojo_activation_required_ = false;
// It's possible that one of the calls out to the observers might have caused
// this object to be no longer needed.
@@ -2077,7 +2093,7 @@ void RenderProcessHostImpl::OnProcessLaunched() {
// Allow Mojo to be setup before the renderer sees any Chrome IPC messages.
// This way, Mojo can be safely used from the renderer in response to any
// Chrome IPC message.
- mojo_application_host_->Activate(this, GetHandle());
+ MaybeActivateMojo();
while (!queued_messages_.empty()) {
Send(queued_messages_.front());
@@ -2218,4 +2234,9 @@ void RenderProcessHostImpl::DecrementWorkerRefCount() {
Cleanup();
}
+void RenderProcessHostImpl::EnsureMojoActivated() {
+ mojo_activation_required_ = true;
+ MaybeActivateMojo();
+}
+
} // namespace content
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698