OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 | 719 |
720 // Setup the IPC channel. | 720 // Setup the IPC channel. |
721 const std::string channel_id = | 721 const std::string channel_id = |
722 IPC::Channel::GenerateVerifiedChannelID(std::string()); | 722 IPC::Channel::GenerateVerifiedChannelID(std::string()); |
723 channel_ = CreateChannelProxy(channel_id); | 723 channel_ = CreateChannelProxy(channel_id); |
724 | 724 |
725 // Call the embedder first so that their IPC filters have priority. | 725 // Call the embedder first so that their IPC filters have priority. |
726 GetContentClient()->browser()->RenderProcessWillLaunch(this); | 726 GetContentClient()->browser()->RenderProcessWillLaunch(this); |
727 | 727 |
728 CreateMessageFilters(); | 728 CreateMessageFilters(); |
729 RegisterMojoServices(); | 729 RegisterMojoInterfaces(); |
730 | 730 |
731 if (run_renderer_in_process()) { | 731 if (run_renderer_in_process()) { |
732 DCHECK(g_renderer_main_thread_factory); | 732 DCHECK(g_renderer_main_thread_factory); |
733 // Crank up a thread and run the initialization there. With the way that | 733 // Crank up a thread and run the initialization there. With the way that |
734 // messages flow between the browser and renderer, this thread is required | 734 // messages flow between the browser and renderer, this thread is required |
735 // to prevent a deadlock in single-process mode. Since the primordial | 735 // to prevent a deadlock in single-process mode. Since the primordial |
736 // thread in the renderer process runs the WebKit code and can sometimes | 736 // thread in the renderer process runs the WebKit code and can sometimes |
737 // make blocking calls to the UI thread (i.e. this thread), they need to run | 737 // make blocking calls to the UI thread (i.e. this thread), they need to run |
738 // on separate threads. | 738 // on separate threads. |
739 in_process_renderer_.reset( | 739 in_process_renderer_.reset( |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1016 AddFilter(new ProfilerMessageFilter(PROCESS_TYPE_RENDERER)); | 1016 AddFilter(new ProfilerMessageFilter(PROCESS_TYPE_RENDERER)); |
1017 AddFilter(new HistogramMessageFilter()); | 1017 AddFilter(new HistogramMessageFilter()); |
1018 AddFilter(new MemoryMessageFilter(this)); | 1018 AddFilter(new MemoryMessageFilter(this)); |
1019 AddFilter(new PushMessagingMessageFilter( | 1019 AddFilter(new PushMessagingMessageFilter( |
1020 GetID(), storage_partition_impl_->GetServiceWorkerContext())); | 1020 GetID(), storage_partition_impl_->GetServiceWorkerContext())); |
1021 #if defined(OS_ANDROID) | 1021 #if defined(OS_ANDROID) |
1022 AddFilter(new ScreenOrientationMessageFilterAndroid()); | 1022 AddFilter(new ScreenOrientationMessageFilterAndroid()); |
1023 #endif | 1023 #endif |
1024 } | 1024 } |
1025 | 1025 |
1026 void RenderProcessHostImpl::RegisterMojoServices() { | 1026 void RenderProcessHostImpl::RegisterMojoInterfaces() { |
1027 #if !defined(OS_ANDROID) | 1027 #if !defined(OS_ANDROID) |
1028 mojo_application_host_->service_registry()->AddService( | 1028 mojo_application_host_->service_registry()->AddService( |
1029 base::Bind(&device::BatteryMonitorImpl::Create)); | 1029 base::Bind(&device::BatteryMonitorImpl::Create)); |
1030 #endif | 1030 #endif |
1031 | 1031 |
1032 mojo_application_host_->service_registry()->AddService( | 1032 mojo_application_host_->service_registry()->AddService( |
1033 base::Bind(&PermissionServiceContext::CreateService, | 1033 base::Bind(&PermissionServiceContext::CreateService, |
1034 base::Unretained(permission_service_context_.get()))); | 1034 base::Unretained(permission_service_context_.get()))); |
1035 | 1035 |
1036 // TODO(mcasas): finalize arguments. | 1036 // TODO(mcasas): finalize arguments. |
(...skipping 1777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2814 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 2814 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
2815 | 2815 |
2816 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias | 2816 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias |
2817 // enough information here so that we can determine what the bad message was. | 2817 // enough information here so that we can determine what the bad message was. |
2818 base::debug::Alias(&error); | 2818 base::debug::Alias(&error); |
2819 bad_message::ReceivedBadMessage(process.get(), | 2819 bad_message::ReceivedBadMessage(process.get(), |
2820 bad_message::RPH_MOJO_PROCESS_ERROR); | 2820 bad_message::RPH_MOJO_PROCESS_ERROR); |
2821 } | 2821 } |
2822 | 2822 |
2823 } // namespace content | 2823 } // namespace content |
OLD | NEW |