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

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

Issue 352013002: Revert 279557 "Support exposing Mojo services between render fra..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 5 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 #include "content/browser/histogram_message_filter.h" 62 #include "content/browser/histogram_message_filter.h"
63 #include "content/browser/indexed_db/indexed_db_context_impl.h" 63 #include "content/browser/indexed_db/indexed_db_context_impl.h"
64 #include "content/browser/indexed_db/indexed_db_dispatcher_host.h" 64 #include "content/browser/indexed_db/indexed_db_dispatcher_host.h"
65 #include "content/browser/loader/resource_message_filter.h" 65 #include "content/browser/loader/resource_message_filter.h"
66 #include "content/browser/loader/resource_scheduler_filter.h" 66 #include "content/browser/loader/resource_scheduler_filter.h"
67 #include "content/browser/media/capture/audio_mirroring_manager.h" 67 #include "content/browser/media/capture/audio_mirroring_manager.h"
68 #include "content/browser/media/media_internals.h" 68 #include "content/browser/media/media_internals.h"
69 #include "content/browser/media/midi_host.h" 69 #include "content/browser/media/midi_host.h"
70 #include "content/browser/message_port_message_filter.h" 70 #include "content/browser/message_port_message_filter.h"
71 #include "content/browser/mime_registry_message_filter.h" 71 #include "content/browser/mime_registry_message_filter.h"
72 #include "content/browser/mojo/mojo_application_host.h"
72 #include "content/browser/plugin_service_impl.h" 73 #include "content/browser/plugin_service_impl.h"
73 #include "content/browser/profiler_message_filter.h" 74 #include "content/browser/profiler_message_filter.h"
74 #include "content/browser/push_messaging_message_filter.h" 75 #include "content/browser/push_messaging_message_filter.h"
75 #include "content/browser/quota_dispatcher_host.h" 76 #include "content/browser/quota_dispatcher_host.h"
76 #include "content/browser/renderer_host/clipboard_message_filter.h" 77 #include "content/browser/renderer_host/clipboard_message_filter.h"
77 #include "content/browser/renderer_host/database_message_filter.h" 78 #include "content/browser/renderer_host/database_message_filter.h"
78 #include "content/browser/renderer_host/file_utilities_message_filter.h" 79 #include "content/browser/renderer_host/file_utilities_message_filter.h"
79 #include "content/browser/renderer_host/gamepad_browser_message_filter.h" 80 #include "content/browser/renderer_host/gamepad_browser_message_filter.h"
80 #include "content/browser/renderer_host/gpu_message_filter.h" 81 #include "content/browser/renderer_host/gpu_message_filter.h"
81 #include "content/browser/renderer_host/media/audio_input_renderer_host.h" 82 #include "content/browser/renderer_host/media/audio_input_renderer_host.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 #include "content/public/common/content_switches.h" 134 #include "content/public/common/content_switches.h"
134 #include "content/public/common/process_type.h" 135 #include "content/public/common/process_type.h"
135 #include "content/public/common/result_codes.h" 136 #include "content/public/common/result_codes.h"
136 #include "content/public/common/sandboxed_process_launcher_delegate.h" 137 #include "content/public/common/sandboxed_process_launcher_delegate.h"
137 #include "content/public/common/url_constants.h" 138 #include "content/public/common/url_constants.h"
138 #include "gpu/command_buffer/service/gpu_switches.h" 139 #include "gpu/command_buffer/service/gpu_switches.h"
139 #include "ipc/ipc_channel.h" 140 #include "ipc/ipc_channel.h"
140 #include "ipc/ipc_logging.h" 141 #include "ipc/ipc_logging.h"
141 #include "ipc/ipc_switches.h" 142 #include "ipc/ipc_switches.h"
142 #include "media/base/media_switches.h" 143 #include "media/base/media_switches.h"
144 #include "mojo/common/common_type_converters.h"
143 #include "net/url_request/url_request_context_getter.h" 145 #include "net/url_request/url_request_context_getter.h"
144 #include "ppapi/shared_impl/ppapi_switches.h" 146 #include "ppapi/shared_impl/ppapi_switches.h"
145 #include "third_party/skia/include/core/SkBitmap.h" 147 #include "third_party/skia/include/core/SkBitmap.h"
146 #include "ui/base/ui_base_switches.h" 148 #include "ui/base/ui_base_switches.h"
147 #include "ui/events/event_switches.h" 149 #include "ui/events/event_switches.h"
148 #include "ui/gfx/switches.h" 150 #include "ui/gfx/switches.h"
149 #include "ui/gl/gl_switches.h" 151 #include "ui/gl/gl_switches.h"
150 #include "ui/native_theme/native_theme_switches.h" 152 #include "ui/native_theme/native_theme_switches.h"
151 #include "webkit/browser/fileapi/sandbox_file_system_backend.h" 153 #include "webkit/browser/fileapi/sandbox_file_system_backend.h"
152 #include "webkit/common/resource_type.h" 154 #include "webkit/common/resource_type.h"
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 RenderProcessHostImpl::RenderProcessHostImpl( 441 RenderProcessHostImpl::RenderProcessHostImpl(
440 BrowserContext* browser_context, 442 BrowserContext* browser_context,
441 StoragePartitionImpl* storage_partition_impl, 443 StoragePartitionImpl* storage_partition_impl,
442 bool is_isolated_guest) 444 bool is_isolated_guest)
443 : fast_shutdown_started_(false), 445 : fast_shutdown_started_(false),
444 deleting_soon_(false), 446 deleting_soon_(false),
445 #ifndef NDEBUG 447 #ifndef NDEBUG
446 is_self_deleted_(false), 448 is_self_deleted_(false),
447 #endif 449 #endif
448 pending_views_(0), 450 pending_views_(0),
449 mojo_application_host_(new MojoApplicationHost),
450 mojo_activation_required_(false), 451 mojo_activation_required_(false),
451 visible_widgets_(0), 452 visible_widgets_(0),
452 backgrounded_(true), 453 backgrounded_(true),
453 is_initialized_(false), 454 is_initialized_(false),
454 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), 455 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()),
455 browser_context_(browser_context), 456 browser_context_(browser_context),
456 storage_partition_impl_(storage_partition_impl), 457 storage_partition_impl_(storage_partition_impl),
457 sudden_termination_allowed_(true), 458 sudden_termination_allowed_(true),
458 ignore_input_events_(false), 459 ignore_input_events_(false),
459 is_isolated_guest_(is_isolated_guest), 460 is_isolated_guest_(is_isolated_guest),
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 // Setup the IPC channel. 590 // Setup the IPC channel.
590 const std::string channel_id = 591 const std::string channel_id =
591 IPC::Channel::GenerateVerifiedChannelID(std::string()); 592 IPC::Channel::GenerateVerifiedChannelID(std::string());
592 channel_ = IPC::ChannelProxy::Create( 593 channel_ = IPC::ChannelProxy::Create(
593 channel_id, 594 channel_id,
594 IPC::Channel::MODE_SERVER, 595 IPC::Channel::MODE_SERVER,
595 this, 596 this,
596 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get()); 597 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get());
597 598
598 // Setup the Mojo channel. 599 // Setup the Mojo channel.
600 mojo_application_host_.reset(new MojoApplicationHost());
599 mojo_application_host_->Init(); 601 mojo_application_host_->Init();
600 602
601 // Call the embedder first so that their IPC filters have priority. 603 // Call the embedder first so that their IPC filters have priority.
602 GetContentClient()->browser()->RenderProcessWillLaunch(this); 604 GetContentClient()->browser()->RenderProcessWillLaunch(this);
603 605
604 CreateMessageFilters(); 606 CreateMessageFilters();
605 607
606 if (run_renderer_in_process()) { 608 if (run_renderer_in_process()) {
607 DCHECK(g_renderer_main_thread_factory); 609 DCHECK(g_renderer_main_thread_factory);
608 // Crank up a thread and run the initialization there. With the way that 610 // Crank up a thread and run the initialization there. With the way that
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 901
900 void RenderProcessHostImpl::ResumeResponseDeferredAtStart( 902 void RenderProcessHostImpl::ResumeResponseDeferredAtStart(
901 const GlobalRequestID& request_id) { 903 const GlobalRequestID& request_id) {
902 widget_helper_->ResumeResponseDeferredAtStart(request_id); 904 widget_helper_->ResumeResponseDeferredAtStart(request_id);
903 } 905 }
904 906
905 void RenderProcessHostImpl::NotifyTimezoneChange() { 907 void RenderProcessHostImpl::NotifyTimezoneChange() {
906 Send(new ViewMsg_TimezoneChange()); 908 Send(new ViewMsg_TimezoneChange());
907 } 909 }
908 910
909 ServiceRegistry* RenderProcessHostImpl::GetServiceRegistry() {
910 if (!mojo_application_host_)
911 return NULL;
912 return mojo_application_host_->service_registry();
913 }
914
915 void RenderProcessHostImpl::AddRoute( 911 void RenderProcessHostImpl::AddRoute(
916 int32 routing_id, 912 int32 routing_id,
917 IPC::Listener* listener) { 913 IPC::Listener* listener) {
918 listeners_.AddWithID(listener, routing_id); 914 listeners_.AddWithID(listener, routing_id);
919 } 915 }
920 916
921 void RenderProcessHostImpl::RemoveRoute(int32 routing_id) { 917 void RenderProcessHostImpl::RemoveRoute(int32 routing_id) {
922 DCHECK(listeners_.Lookup(routing_id) != NULL); 918 DCHECK(listeners_.Lookup(routing_id) != NULL);
923 listeners_.Remove(routing_id); 919 listeners_.Remove(routing_id);
924 920
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after
1931 1927
1932 IDMap<IPC::Listener>::iterator iter(&listeners_); 1928 IDMap<IPC::Listener>::iterator iter(&listeners_);
1933 while (!iter.IsAtEnd()) { 1929 while (!iter.IsAtEnd()) {
1934 iter.GetCurrentValue()->OnMessageReceived( 1930 iter.GetCurrentValue()->OnMessageReceived(
1935 ViewHostMsg_RenderProcessGone(iter.GetCurrentKey(), 1931 ViewHostMsg_RenderProcessGone(iter.GetCurrentKey(),
1936 static_cast<int>(status), 1932 static_cast<int>(status),
1937 exit_code)); 1933 exit_code));
1938 iter.Advance(); 1934 iter.Advance();
1939 } 1935 }
1940 1936
1941 mojo_application_host_.reset(new MojoApplicationHost); 1937 mojo_application_host_.reset();
1942 mojo_activation_required_ = false;
1943 1938
1944 // It's possible that one of the calls out to the observers might have caused 1939 // It's possible that one of the calls out to the observers might have caused
1945 // this object to be no longer needed. 1940 // this object to be no longer needed.
1946 if (delayed_cleanup_needed_) 1941 if (delayed_cleanup_needed_)
1947 Cleanup(); 1942 Cleanup();
1948 1943
1949 // This object is not deleted at this point and might be reused later. 1944 // This object is not deleted at this point and might be reused later.
1950 // TODO(darin): clean this up 1945 // TODO(darin): clean this up
1951 } 1946 }
1952 1947
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
2252 } 2247 }
2253 2248
2254 void RenderProcessHostImpl::DecrementWorkerRefCount() { 2249 void RenderProcessHostImpl::DecrementWorkerRefCount() {
2255 DCHECK_CURRENTLY_ON(BrowserThread::UI); 2250 DCHECK_CURRENTLY_ON(BrowserThread::UI);
2256 DCHECK_GT(worker_ref_count_, 0); 2251 DCHECK_GT(worker_ref_count_, 0);
2257 --worker_ref_count_; 2252 --worker_ref_count_;
2258 if (worker_ref_count_ == 0) 2253 if (worker_ref_count_ == 0)
2259 Cleanup(); 2254 Cleanup();
2260 } 2255 }
2261 2256
2262 void RenderProcessHostImpl::EnsureMojoActivated() { 2257 void RenderProcessHostImpl::ConnectTo(
2258 const base::StringPiece& service_name,
2259 mojo::ScopedMessagePipeHandle handle) {
2263 mojo_activation_required_ = true; 2260 mojo_activation_required_ = true;
2264 MaybeActivateMojo(); 2261 MaybeActivateMojo();
2262
2263 mojo_application_host_->service_provider()->ConnectToService(
2264 mojo::String::From(service_name),
2265 std::string(),
2266 handle.Pass(),
2267 mojo::String());
2265 } 2268 }
2266 2269
2267 void RenderProcessHostImpl::OnAllocateGpuMemoryBuffer(uint32 width, 2270 void RenderProcessHostImpl::OnAllocateGpuMemoryBuffer(uint32 width,
2268 uint32 height, 2271 uint32 height,
2269 uint32 internalformat, 2272 uint32 internalformat,
2270 uint32 usage, 2273 uint32 usage,
2271 IPC::Message* reply) { 2274 IPC::Message* reply) {
2272 DCHECK_CURRENTLY_ON(BrowserThread::UI); 2275 DCHECK_CURRENTLY_ON(BrowserThread::UI);
2273 if (!GpuMemoryBufferImpl::IsFormatValid(internalformat) || 2276 if (!GpuMemoryBufferImpl::IsFormatValid(internalformat) ||
2274 !GpuMemoryBufferImpl::IsUsageValid(usage)) { 2277 !GpuMemoryBufferImpl::IsUsageValid(usage)) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
2359 void RenderProcessHostImpl::GpuMemoryBufferAllocated( 2362 void RenderProcessHostImpl::GpuMemoryBufferAllocated(
2360 IPC::Message* reply, 2363 IPC::Message* reply,
2361 const gfx::GpuMemoryBufferHandle& handle) { 2364 const gfx::GpuMemoryBufferHandle& handle) {
2362 DCHECK_CURRENTLY_ON(BrowserThread::UI); 2365 DCHECK_CURRENTLY_ON(BrowserThread::UI);
2363 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply, 2366 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply,
2364 handle); 2367 handle);
2365 Send(reply); 2368 Send(reply);
2366 } 2369 }
2367 2370
2368 } // namespace content 2371 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698