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