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

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 457933002: Replace Chrome IPC with Mojo IPC for querying BatteryStatus service Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Represents the browser side of the browser <--> renderer communication 5 // Represents the browser side of the browser <--> renderer communication
6 // channel. There will be one RenderProcessHost per renderer process. 6 // channel. There will be one RenderProcessHost per renderer process.
7 7
8 #include "content/browser/renderer_host/render_process_host_impl.h" 8 #include "content/browser/renderer_host/render_process_host_impl.h"
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 22 matching lines...) Expand all
33 #include "base/strings/string_number_conversions.h" 33 #include "base/strings/string_number_conversions.h"
34 #include "base/strings/string_util.h" 34 #include "base/strings/string_util.h"
35 #include "base/supports_user_data.h" 35 #include "base/supports_user_data.h"
36 #include "base/sys_info.h" 36 #include "base/sys_info.h"
37 #include "base/threading/thread.h" 37 #include "base/threading/thread.h"
38 #include "base/threading/thread_restrictions.h" 38 #include "base/threading/thread_restrictions.h"
39 #include "base/tracked_objects.h" 39 #include "base/tracked_objects.h"
40 #include "cc/base/switches.h" 40 #include "cc/base/switches.h"
41 #include "content/browser/appcache/appcache_dispatcher_host.h" 41 #include "content/browser/appcache/appcache_dispatcher_host.h"
42 #include "content/browser/appcache/chrome_appcache_service.h" 42 #include "content/browser/appcache/chrome_appcache_service.h"
43 #include "content/browser/battery_status/battery_status_message_filter.h"
44 #include "content/browser/browser_child_process_host_impl.h" 43 #include "content/browser/browser_child_process_host_impl.h"
45 #include "content/browser/browser_main.h" 44 #include "content/browser/browser_main.h"
46 #include "content/browser/browser_main_loop.h" 45 #include "content/browser/browser_main_loop.h"
47 #include "content/browser/browser_plugin/browser_plugin_message_filter.h" 46 #include "content/browser/browser_plugin/browser_plugin_message_filter.h"
48 #include "content/browser/child_process_security_policy_impl.h" 47 #include "content/browser/child_process_security_policy_impl.h"
49 #include "content/browser/device_sensors/device_motion_message_filter.h" 48 #include "content/browser/device_sensors/device_motion_message_filter.h"
50 #include "content/browser/device_sensors/device_orientation_message_filter.h" 49 #include "content/browser/device_sensors/device_orientation_message_filter.h"
51 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" 50 #include "content/browser/dom_storage/dom_storage_context_wrapper.h"
52 #include "content/browser/dom_storage/dom_storage_message_filter.h" 51 #include "content/browser/dom_storage/dom_storage_message_filter.h"
53 #include "content/browser/download/mhtml_generation_manager.h" 52 #include "content/browser/download/mhtml_generation_manager.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 #include "content/public/browser/resource_context.h" 123 #include "content/public/browser/resource_context.h"
125 #include "content/public/browser/user_metrics.h" 124 #include "content/public/browser/user_metrics.h"
126 #include "content/public/browser/worker_service.h" 125 #include "content/public/browser/worker_service.h"
127 #include "content/public/common/content_constants.h" 126 #include "content/public/common/content_constants.h"
128 #include "content/public/common/content_switches.h" 127 #include "content/public/common/content_switches.h"
129 #include "content/public/common/process_type.h" 128 #include "content/public/common/process_type.h"
130 #include "content/public/common/resource_type.h" 129 #include "content/public/common/resource_type.h"
131 #include "content/public/common/result_codes.h" 130 #include "content/public/common/result_codes.h"
132 #include "content/public/common/sandboxed_process_launcher_delegate.h" 131 #include "content/public/common/sandboxed_process_launcher_delegate.h"
133 #include "content/public/common/url_constants.h" 132 #include "content/public/common/url_constants.h"
133 #include "device/battery/battery_monitor_impl.h"
134 #include "gpu/command_buffer/service/gpu_switches.h" 134 #include "gpu/command_buffer/service/gpu_switches.h"
135 #include "ipc/ipc_channel.h" 135 #include "ipc/ipc_channel.h"
136 #include "ipc/ipc_logging.h" 136 #include "ipc/ipc_logging.h"
137 #include "ipc/ipc_switches.h" 137 #include "ipc/ipc_switches.h"
138 #include "ipc/mojo/ipc_channel_mojo.h" 138 #include "ipc/mojo/ipc_channel_mojo.h"
139 #include "media/base/media_switches.h" 139 #include "media/base/media_switches.h"
140 #include "net/url_request/url_request_context_getter.h" 140 #include "net/url_request/url_request_context_getter.h"
141 #include "ppapi/shared_impl/ppapi_switches.h" 141 #include "ppapi/shared_impl/ppapi_switches.h"
142 #include "storage/browser/fileapi/sandbox_file_system_backend.h" 142 #include "storage/browser/fileapi/sandbox_file_system_backend.h"
143 #include "third_party/skia/include/core/SkBitmap.h" 143 #include "third_party/skia/include/core/SkBitmap.h"
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 IPC::Channel::GenerateVerifiedChannelID(std::string()); 573 IPC::Channel::GenerateVerifiedChannelID(std::string());
574 channel_ = CreateChannelProxy(channel_id); 574 channel_ = CreateChannelProxy(channel_id);
575 575
576 // Setup the Mojo channel. 576 // Setup the Mojo channel.
577 mojo_application_host_->Init(); 577 mojo_application_host_->Init();
578 578
579 // Call the embedder first so that their IPC filters have priority. 579 // Call the embedder first so that their IPC filters have priority.
580 GetContentClient()->browser()->RenderProcessWillLaunch(this); 580 GetContentClient()->browser()->RenderProcessWillLaunch(this);
581 581
582 CreateMessageFilters(); 582 CreateMessageFilters();
583 RegisterMojoServices();
583 584
584 if (run_renderer_in_process()) { 585 if (run_renderer_in_process()) {
585 DCHECK(g_renderer_main_thread_factory); 586 DCHECK(g_renderer_main_thread_factory);
586 // Crank up a thread and run the initialization there. With the way that 587 // Crank up a thread and run the initialization there. With the way that
587 // messages flow between the browser and renderer, this thread is required 588 // messages flow between the browser and renderer, this thread is required
588 // to prevent a deadlock in single-process mode. Since the primordial 589 // to prevent a deadlock in single-process mode. Since the primordial
589 // thread in the renderer process runs the WebKit code and can sometimes 590 // thread in the renderer process runs the WebKit code and can sometimes
590 // make blocking calls to the UI thread (i.e. this thread), they need to run 591 // make blocking calls to the UI thread (i.e. this thread), they need to run
591 // on separate threads. 592 // on separate threads.
592 in_process_renderer_.reset(g_renderer_main_thread_factory(channel_id)); 593 in_process_renderer_.reset(g_renderer_main_thread_factory(channel_id));
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 AddFilter(new ProfilerMessageFilter(PROCESS_TYPE_RENDERER)); 849 AddFilter(new ProfilerMessageFilter(PROCESS_TYPE_RENDERER));
849 AddFilter(new HistogramMessageFilter()); 850 AddFilter(new HistogramMessageFilter());
850 #if defined(USE_TCMALLOC) && (defined(OS_LINUX) || defined(OS_ANDROID)) 851 #if defined(USE_TCMALLOC) && (defined(OS_LINUX) || defined(OS_ANDROID))
851 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 852 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
852 switches::kEnableMemoryBenchmarking)) 853 switches::kEnableMemoryBenchmarking))
853 AddFilter(new MemoryBenchmarkMessageFilter()); 854 AddFilter(new MemoryBenchmarkMessageFilter());
854 #endif 855 #endif
855 AddFilter(new VibrationMessageFilter()); 856 AddFilter(new VibrationMessageFilter());
856 AddFilter(new PushMessagingMessageFilter( 857 AddFilter(new PushMessagingMessageFilter(
857 GetID(), storage_partition_impl_->GetServiceWorkerContext())); 858 GetID(), storage_partition_impl_->GetServiceWorkerContext()));
858 AddFilter(new BatteryStatusMessageFilter());
859 #if defined(OS_ANDROID) 859 #if defined(OS_ANDROID)
860 AddFilter(new ScreenOrientationMessageFilterAndroid()); 860 AddFilter(new ScreenOrientationMessageFilterAndroid());
861 #endif 861 #endif
862 } 862 }
863 863
864 void RenderProcessHostImpl::RegisterMojoServices() {
865 mojo_application_host_->service_registry()->AddService(
866 base::Bind(&device::BatteryMonitorImpl::Create));
867 }
868
864 int RenderProcessHostImpl::GetNextRoutingID() { 869 int RenderProcessHostImpl::GetNextRoutingID() {
865 return widget_helper_->GetNextRoutingID(); 870 return widget_helper_->GetNextRoutingID();
866 } 871 }
867 872
868
869 void RenderProcessHostImpl::ResumeDeferredNavigation( 873 void RenderProcessHostImpl::ResumeDeferredNavigation(
870 const GlobalRequestID& request_id) { 874 const GlobalRequestID& request_id) {
871 widget_helper_->ResumeDeferredNavigation(request_id); 875 widget_helper_->ResumeDeferredNavigation(request_id);
872 } 876 }
873 877
874 void RenderProcessHostImpl::ResumeResponseDeferredAtStart( 878 void RenderProcessHostImpl::ResumeResponseDeferredAtStart(
875 const GlobalRequestID& request_id) { 879 const GlobalRequestID& request_id) {
876 widget_helper_->ResumeResponseDeferredAtStart(request_id); 880 widget_helper_->ResumeResponseDeferredAtStart(request_id);
877 } 881 }
878 882
(...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after
2203 2207
2204 void RenderProcessHostImpl::DecrementWorkerRefCount() { 2208 void RenderProcessHostImpl::DecrementWorkerRefCount() {
2205 DCHECK_CURRENTLY_ON(BrowserThread::UI); 2209 DCHECK_CURRENTLY_ON(BrowserThread::UI);
2206 DCHECK_GT(worker_ref_count_, 0); 2210 DCHECK_GT(worker_ref_count_, 0);
2207 --worker_ref_count_; 2211 --worker_ref_count_;
2208 if (worker_ref_count_ == 0) 2212 if (worker_ref_count_ == 0)
2209 Cleanup(); 2213 Cleanup();
2210 } 2214 }
2211 2215
2212 } // namespace content 2216 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.h ('k') | content/common/battery_status_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698