| 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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 AddFilter(new AppCacheDispatcherHost( | 680 AddFilter(new AppCacheDispatcherHost( |
| 685 storage_partition_impl_->GetAppCacheService(), | 681 storage_partition_impl_->GetAppCacheService(), |
| 686 GetID())); | 682 GetID())); |
| 687 AddFilter(new ClipboardMessageFilter); | 683 AddFilter(new ClipboardMessageFilter); |
| 688 AddFilter(new DOMStorageMessageFilter( | 684 AddFilter(new DOMStorageMessageFilter( |
| 689 GetID(), | 685 GetID(), |
| 690 storage_partition_impl_->GetDOMStorageContext())); | 686 storage_partition_impl_->GetDOMStorageContext())); |
| 691 AddFilter(new IndexedDBDispatcherHost( | 687 AddFilter(new IndexedDBDispatcherHost( |
| 692 storage_partition_impl_->GetIndexedDBContext())); | 688 storage_partition_impl_->GetIndexedDBContext())); |
| 693 | 689 |
| 694 if (IsGuest()) { | 690 geolocation_dispatcher_host_ = GeolocationDispatcherHost::New( |
| 695 if (!g_browser_plugin_geolocation_context.Get().get()) { | 691 GetID(), browser_context->GetGeolocationPermissionContext()); |
| 696 g_browser_plugin_geolocation_context.Get() = | |
| 697 new BrowserPluginGeolocationPermissionContext(); | |
| 698 } | |
| 699 geolocation_dispatcher_host_ = GeolocationDispatcherHost::New( | |
| 700 GetID(), g_browser_plugin_geolocation_context.Get().get()); | |
| 701 } else { | |
| 702 geolocation_dispatcher_host_ = GeolocationDispatcherHost::New( | |
| 703 GetID(), browser_context->GetGeolocationPermissionContext()); | |
| 704 } | |
| 705 AddFilter(geolocation_dispatcher_host_); | 692 AddFilter(geolocation_dispatcher_host_); |
| 706 gpu_message_filter_ = new GpuMessageFilter(GetID(), widget_helper_.get()); | 693 gpu_message_filter_ = new GpuMessageFilter(GetID(), widget_helper_.get()); |
| 707 AddFilter(gpu_message_filter_); | 694 AddFilter(gpu_message_filter_); |
| 708 #if defined(ENABLE_WEBRTC) | 695 #if defined(ENABLE_WEBRTC) |
| 709 AddFilter(new WebRTCIdentityServiceHost( | 696 AddFilter(new WebRTCIdentityServiceHost( |
| 710 GetID(), storage_partition_impl_->GetWebRTCIdentityStore())); | 697 GetID(), storage_partition_impl_->GetWebRTCIdentityStore())); |
| 711 peer_connection_tracker_host_ = new PeerConnectionTrackerHost(GetID()); | 698 peer_connection_tracker_host_ = new PeerConnectionTrackerHost(GetID()); |
| 712 AddFilter(peer_connection_tracker_host_.get()); | 699 AddFilter(peer_connection_tracker_host_.get()); |
| 713 AddFilter(new MediaStreamDispatcherHost( | 700 AddFilter(new MediaStreamDispatcherHost( |
| 714 GetID(), | 701 GetID(), |
| (...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2139 | 2126 |
| 2140 void RenderProcessHostImpl::SetWebUIHandle( | 2127 void RenderProcessHostImpl::SetWebUIHandle( |
| 2141 int32 view_routing_id, | 2128 int32 view_routing_id, |
| 2142 mojo::ScopedMessagePipeHandle handle) { | 2129 mojo::ScopedMessagePipeHandle handle) { |
| 2143 if (!render_process_host_mojo_) | 2130 if (!render_process_host_mojo_) |
| 2144 render_process_host_mojo_.reset(new RenderProcessHostMojoImpl(this)); | 2131 render_process_host_mojo_.reset(new RenderProcessHostMojoImpl(this)); |
| 2145 render_process_host_mojo_->SetWebUIHandle(view_routing_id, handle.Pass()); | 2132 render_process_host_mojo_->SetWebUIHandle(view_routing_id, handle.Pass()); |
| 2146 } | 2133 } |
| 2147 | 2134 |
| 2148 } // namespace content | 2135 } // namespace content |
| OLD | NEW |