| 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 c87bf1f94e13ab068c6f750feb01632b152dcde7..c5e5a5230e60bc66bc7dc575ebccb9a0b65629ec 100644
|
| --- a/content/browser/renderer_host/render_process_host_impl.cc
|
| +++ b/content/browser/renderer_host/render_process_host_impl.cc
|
| @@ -40,7 +40,6 @@
|
| #include "cc/base/switches.h"
|
| #include "content/browser/appcache/appcache_dispatcher_host.h"
|
| #include "content/browser/appcache/chrome_appcache_service.h"
|
| -#include "content/browser/battery_status/battery_status_message_filter.h"
|
| #include "content/browser/browser_child_process_host_impl.h"
|
| #include "content/browser/browser_main.h"
|
| #include "content/browser/browser_main_loop.h"
|
| @@ -132,6 +131,7 @@
|
| #include "content/public/common/result_codes.h"
|
| #include "content/public/common/sandboxed_process_launcher_delegate.h"
|
| #include "content/public/common/url_constants.h"
|
| +#include "device/battery/battery_monitor_impl.h"
|
| #include "gpu/command_buffer/service/gpu_switches.h"
|
| #include "ipc/ipc_channel.h"
|
| #include "ipc/ipc_logging.h"
|
| @@ -438,7 +438,6 @@ RenderProcessHostImpl::RenderProcessHostImpl(
|
| #endif
|
| pending_views_(0),
|
| mojo_application_host_(new MojoApplicationHost),
|
| - mojo_activation_required_(false),
|
| visible_widgets_(0),
|
| backgrounded_(true),
|
| is_initialized_(false),
|
| @@ -586,6 +585,7 @@ bool RenderProcessHostImpl::Init() {
|
| GetContentClient()->browser()->RenderProcessWillLaunch(this);
|
|
|
| CreateMessageFilters();
|
| + RegisterMojoServices();
|
|
|
| if (run_renderer_in_process()) {
|
| DCHECK(g_renderer_main_thread_factory);
|
| @@ -643,20 +643,6 @@ 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();
|
| @@ -880,17 +866,20 @@ void RenderProcessHostImpl::CreateMessageFilters() {
|
| AddFilter(new VibrationMessageFilter());
|
| AddFilter(new PushMessagingMessageFilter(
|
| GetID(), storage_partition_impl_->GetServiceWorkerContext()));
|
| - AddFilter(new BatteryStatusMessageFilter());
|
| #if defined(OS_ANDROID)
|
| AddFilter(new ScreenOrientationMessageFilterAndroid());
|
| #endif
|
| }
|
|
|
| +void RenderProcessHostImpl::RegisterMojoServices() {
|
| + mojo_application_host_->service_registry()->AddService(
|
| + base::Bind(&device::BatteryMonitorImpl::Create));
|
| +}
|
| +
|
| int RenderProcessHostImpl::GetNextRoutingID() {
|
| return widget_helper_->GetNextRoutingID();
|
| }
|
|
|
| -
|
| void RenderProcessHostImpl::ResumeDeferredNavigation(
|
| const GlobalRequestID& request_id) {
|
| widget_helper_->ResumeDeferredNavigation(request_id);
|
| @@ -1928,7 +1917,6 @@ 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.
|
| @@ -2095,7 +2083,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.
|
| - MaybeActivateMojo();
|
| + mojo_application_host_->Activate(this, GetHandle());
|
|
|
| while (!queued_messages_.empty()) {
|
| Send(queued_messages_.front());
|
| @@ -2236,9 +2224,4 @@ void RenderProcessHostImpl::DecrementWorkerRefCount() {
|
| Cleanup();
|
| }
|
|
|
| -void RenderProcessHostImpl::EnsureMojoActivated() {
|
| - mojo_activation_required_ = true;
|
| - MaybeActivateMojo();
|
| -}
|
| -
|
| } // namespace content
|
|
|