| OLD | NEW |
| 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 Loading... |
| 33 #include "base/supports_user_data.h" | 33 #include "base/supports_user_data.h" |
| 34 #include "base/sys_info.h" | 34 #include "base/sys_info.h" |
| 35 #include "base/threading/thread.h" | 35 #include "base/threading/thread.h" |
| 36 #include "base/threading/thread_restrictions.h" | 36 #include "base/threading/thread_restrictions.h" |
| 37 #include "base/tracked_objects.h" | 37 #include "base/tracked_objects.h" |
| 38 #include "cc/base/switches.h" | 38 #include "cc/base/switches.h" |
| 39 #include "content/browser/appcache/appcache_dispatcher_host.h" | 39 #include "content/browser/appcache/appcache_dispatcher_host.h" |
| 40 #include "content/browser/appcache/chrome_appcache_service.h" | 40 #include "content/browser/appcache/chrome_appcache_service.h" |
| 41 #include "content/browser/browser_main.h" | 41 #include "content/browser/browser_main.h" |
| 42 #include "content/browser/browser_main_loop.h" | 42 #include "content/browser/browser_main_loop.h" |
| 43 #include "content/browser/browser_plugin/browser_plugin_geolocation_permission_c
ontext.h" | |
| 44 #include "content/browser/browser_plugin/browser_plugin_message_filter.h" | 43 #include "content/browser/browser_plugin/browser_plugin_message_filter.h" |
| 45 #include "content/browser/child_process_security_policy_impl.h" | 44 #include "content/browser/child_process_security_policy_impl.h" |
| 46 #include "content/browser/device_orientation/device_motion_message_filter.h" | 45 #include "content/browser/device_orientation/device_motion_message_filter.h" |
| 47 #include "content/browser/device_orientation/device_orientation_message_filter.h
" | 46 #include "content/browser/device_orientation/device_orientation_message_filter.h
" |
| 48 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" | 47 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" |
| 49 #include "content/browser/dom_storage/dom_storage_message_filter.h" | 48 #include "content/browser/dom_storage/dom_storage_message_filter.h" |
| 50 #include "content/browser/download/mhtml_generation_manager.h" | 49 #include "content/browser/download/mhtml_generation_manager.h" |
| 51 #include "content/browser/fileapi/chrome_blob_storage_context.h" | 50 #include "content/browser/fileapi/chrome_blob_storage_context.h" |
| 52 #include "content/browser/fileapi/fileapi_message_filter.h" | 51 #include "content/browser/fileapi/fileapi_message_filter.h" |
| 53 #include "content/browser/frame_host/render_frame_message_filter.h" | 52 #include "content/browser/frame_host/render_frame_message_filter.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 // Does nothing. Just to avoid races between enable and disable. | 221 // Does nothing. Just to avoid races between enable and disable. |
| 223 void DisableAecDumpOnFileThread() { | 222 void DisableAecDumpOnFileThread() { |
| 224 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 223 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 225 } | 224 } |
| 226 #endif | 225 #endif |
| 227 | 226 |
| 228 // the global list of all renderer processes | 227 // the global list of all renderer processes |
| 229 base::LazyInstance<IDMap<RenderProcessHost> >::Leaky | 228 base::LazyInstance<IDMap<RenderProcessHost> >::Leaky |
| 230 g_all_hosts = LAZY_INSTANCE_INITIALIZER; | 229 g_all_hosts = LAZY_INSTANCE_INITIALIZER; |
| 231 | 230 |
| 232 base::LazyInstance<scoped_refptr<BrowserPluginGeolocationPermissionContext> > | |
| 233 g_browser_plugin_geolocation_context = LAZY_INSTANCE_INITIALIZER; | |
| 234 | |
| 235 // Map of site to process, to ensure we only have one RenderProcessHost per | 231 // Map of site to process, to ensure we only have one RenderProcessHost per |
| 236 // site in process-per-site mode. Each map is specific to a BrowserContext. | 232 // site in process-per-site mode. Each map is specific to a BrowserContext. |
| 237 class SiteProcessMap : public base::SupportsUserData::Data { | 233 class SiteProcessMap : public base::SupportsUserData::Data { |
| 238 public: | 234 public: |
| 239 typedef base::hash_map<std::string, RenderProcessHost*> SiteToProcessMap; | 235 typedef base::hash_map<std::string, RenderProcessHost*> SiteToProcessMap; |
| 240 SiteProcessMap() {} | 236 SiteProcessMap() {} |
| 241 | 237 |
| 242 void RegisterProcess(const std::string& site, RenderProcessHost* process) { | 238 void RegisterProcess(const std::string& site, RenderProcessHost* process) { |
| 243 map_[site] = process; | 239 map_[site] = process; |
| 244 } | 240 } |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 AddFilter(new ClipboardMessageFilter); | 679 AddFilter(new ClipboardMessageFilter); |
| 684 AddFilter(new DOMStorageMessageFilter( | 680 AddFilter(new DOMStorageMessageFilter( |
| 685 GetID(), | 681 GetID(), |
| 686 storage_partition_impl_->GetDOMStorageContext())); | 682 storage_partition_impl_->GetDOMStorageContext())); |
| 687 AddFilter(new IndexedDBDispatcherHost( | 683 AddFilter(new IndexedDBDispatcherHost( |
| 688 GetID(), | 684 GetID(), |
| 689 storage_partition_impl_->GetURLRequestContext(), | 685 storage_partition_impl_->GetURLRequestContext(), |
| 690 storage_partition_impl_->GetIndexedDBContext(), | 686 storage_partition_impl_->GetIndexedDBContext(), |
| 691 ChromeBlobStorageContext::GetFor(browser_context))); | 687 ChromeBlobStorageContext::GetFor(browser_context))); |
| 692 | 688 |
| 693 if (IsGuest()) { | 689 geolocation_dispatcher_host_ = GeolocationDispatcherHost::New( |
| 694 if (!g_browser_plugin_geolocation_context.Get().get()) { | 690 GetID(), browser_context->GetGeolocationPermissionContext()); |
| 695 g_browser_plugin_geolocation_context.Get() = | |
| 696 new BrowserPluginGeolocationPermissionContext(); | |
| 697 } | |
| 698 geolocation_dispatcher_host_ = GeolocationDispatcherHost::New( | |
| 699 GetID(), g_browser_plugin_geolocation_context.Get().get()); | |
| 700 } else { | |
| 701 geolocation_dispatcher_host_ = GeolocationDispatcherHost::New( | |
| 702 GetID(), browser_context->GetGeolocationPermissionContext()); | |
| 703 } | |
| 704 AddFilter(geolocation_dispatcher_host_); | 691 AddFilter(geolocation_dispatcher_host_); |
| 705 gpu_message_filter_ = new GpuMessageFilter(GetID(), widget_helper_.get()); | 692 gpu_message_filter_ = new GpuMessageFilter(GetID(), widget_helper_.get()); |
| 706 AddFilter(gpu_message_filter_); | 693 AddFilter(gpu_message_filter_); |
| 707 #if defined(ENABLE_WEBRTC) | 694 #if defined(ENABLE_WEBRTC) |
| 708 AddFilter(new WebRTCIdentityServiceHost( | 695 AddFilter(new WebRTCIdentityServiceHost( |
| 709 GetID(), storage_partition_impl_->GetWebRTCIdentityStore())); | 696 GetID(), storage_partition_impl_->GetWebRTCIdentityStore())); |
| 710 peer_connection_tracker_host_ = new PeerConnectionTrackerHost(GetID()); | 697 peer_connection_tracker_host_ = new PeerConnectionTrackerHost(GetID()); |
| 711 AddFilter(peer_connection_tracker_host_.get()); | 698 AddFilter(peer_connection_tracker_host_.get()); |
| 712 AddFilter(new MediaStreamDispatcherHost( | 699 AddFilter(new MediaStreamDispatcherHost( |
| 713 GetID(), | 700 GetID(), |
| (...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2138 | 2125 |
| 2139 void RenderProcessHostImpl::SetWebUIHandle( | 2126 void RenderProcessHostImpl::SetWebUIHandle( |
| 2140 int32 view_routing_id, | 2127 int32 view_routing_id, |
| 2141 mojo::ScopedMessagePipeHandle handle) { | 2128 mojo::ScopedMessagePipeHandle handle) { |
| 2142 if (!render_process_host_mojo_) | 2129 if (!render_process_host_mojo_) |
| 2143 render_process_host_mojo_.reset(new RenderProcessHostMojoImpl(this)); | 2130 render_process_host_mojo_.reset(new RenderProcessHostMojoImpl(this)); |
| 2144 render_process_host_mojo_->SetWebUIHandle(view_routing_id, handle.Pass()); | 2131 render_process_host_mojo_->SetWebUIHandle(view_routing_id, handle.Pass()); |
| 2145 } | 2132 } |
| 2146 | 2133 |
| 2147 } // namespace content | 2134 } // namespace content |
| OLD | NEW |