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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 int render_child_id) | 210 int render_child_id) |
211 : request_context_(browser_context->GetRequestContextForRenderProcess( | 211 : request_context_(browser_context->GetRequestContextForRenderProcess( |
212 render_child_id)), | 212 render_child_id)), |
213 media_request_context_( | 213 media_request_context_( |
214 browser_context->GetMediaRequestContextForRenderProcess( | 214 browser_context->GetMediaRequestContextForRenderProcess( |
215 render_child_id)) { | 215 render_child_id)) { |
216 } | 216 } |
217 | 217 |
218 virtual net::URLRequestContext* GetRequestContext( | 218 virtual net::URLRequestContext* GetRequestContext( |
219 ResourceType::Type resource_type) OVERRIDE { | 219 ResourceType::Type resource_type) OVERRIDE { |
220 net::URLRequestContextGetter* request_context = request_context_; | 220 net::URLRequestContextGetter* request_context = request_context_.get(); |
221 // If the request has resource type of ResourceType::MEDIA, we use a request | 221 // If the request has resource type of ResourceType::MEDIA, we use a request |
222 // context specific to media for handling it because these resources have | 222 // context specific to media for handling it because these resources have |
223 // specific needs for caching. | 223 // specific needs for caching. |
224 if (resource_type == ResourceType::MEDIA) | 224 if (resource_type == ResourceType::MEDIA) |
225 request_context = media_request_context_; | 225 request_context = media_request_context_.get(); |
226 return request_context->GetURLRequestContext(); | 226 return request_context->GetURLRequestContext(); |
227 } | 227 } |
228 | 228 |
229 private: | 229 private: |
230 virtual ~RendererURLRequestContextSelector() {} | 230 virtual ~RendererURLRequestContextSelector() {} |
231 | 231 |
232 scoped_refptr<net::URLRequestContextGetter> request_context_; | 232 scoped_refptr<net::URLRequestContextGetter> request_context_; |
233 scoped_refptr<net::URLRequestContextGetter> media_request_context_; | 233 scoped_refptr<net::URLRequestContextGetter> media_request_context_; |
234 }; | 234 }; |
235 | 235 |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 | 554 |
555 void RenderProcessHostImpl::CreateMessageFilters() { | 555 void RenderProcessHostImpl::CreateMessageFilters() { |
556 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 556 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
557 channel_->AddFilter(new ResourceSchedulerFilter(GetID())); | 557 channel_->AddFilter(new ResourceSchedulerFilter(GetID())); |
558 MediaInternals* media_internals = MediaInternals::GetInstance();; | 558 MediaInternals* media_internals = MediaInternals::GetInstance();; |
559 // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages | 559 // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages |
560 // from guests. | 560 // from guests. |
561 if (supports_browser_plugin_) { | 561 if (supports_browser_plugin_) { |
562 scoped_refptr<BrowserPluginMessageFilter> bp_message_filter( | 562 scoped_refptr<BrowserPluginMessageFilter> bp_message_filter( |
563 new BrowserPluginMessageFilter(GetID(), IsGuest())); | 563 new BrowserPluginMessageFilter(GetID(), IsGuest())); |
564 channel_->AddFilter(bp_message_filter); | 564 channel_->AddFilter(bp_message_filter.get()); |
565 } | 565 } |
566 | 566 |
567 scoped_refptr<RenderMessageFilter> render_message_filter( | 567 scoped_refptr<RenderMessageFilter> render_message_filter( |
568 new RenderMessageFilter( | 568 new RenderMessageFilter( |
569 GetID(), | 569 GetID(), |
570 #if defined(ENABLE_PLUGINS) | 570 #if defined(ENABLE_PLUGINS) |
571 PluginServiceImpl::GetInstance(), | 571 PluginServiceImpl::GetInstance(), |
572 #else | 572 #else |
573 NULL, | 573 NULL, |
574 #endif | 574 #endif |
575 GetBrowserContext(), | 575 GetBrowserContext(), |
576 GetBrowserContext()->GetRequestContextForRenderProcess(GetID()), | 576 GetBrowserContext()->GetRequestContextForRenderProcess(GetID()), |
577 widget_helper_, | 577 widget_helper_.get(), |
578 media_internals, | 578 media_internals, |
579 storage_partition_impl_->GetDOMStorageContext())); | 579 storage_partition_impl_->GetDOMStorageContext())); |
580 channel_->AddFilter(render_message_filter); | 580 channel_->AddFilter(render_message_filter.get()); |
581 BrowserContext* browser_context = GetBrowserContext(); | 581 BrowserContext* browser_context = GetBrowserContext(); |
582 ResourceContext* resource_context = browser_context->GetResourceContext(); | 582 ResourceContext* resource_context = browser_context->GetResourceContext(); |
583 | 583 |
584 ResourceMessageFilter* resource_message_filter = new ResourceMessageFilter( | 584 ResourceMessageFilter* resource_message_filter = new ResourceMessageFilter( |
585 GetID(), PROCESS_TYPE_RENDERER, resource_context, | 585 GetID(), PROCESS_TYPE_RENDERER, resource_context, |
586 storage_partition_impl_->GetAppCacheService(), | 586 storage_partition_impl_->GetAppCacheService(), |
587 ChromeBlobStorageContext::GetFor(browser_context), | 587 ChromeBlobStorageContext::GetFor(browser_context), |
588 storage_partition_impl_->GetFileSystemContext(), | 588 storage_partition_impl_->GetFileSystemContext(), |
589 new RendererURLRequestContextSelector(browser_context, GetID())); | 589 new RendererURLRequestContextSelector(browser_context, GetID())); |
590 | 590 |
(...skipping 13 matching lines...) Expand all Loading... |
604 channel_->AddFilter(new ClipboardMessageFilter(browser_context)); | 604 channel_->AddFilter(new ClipboardMessageFilter(browser_context)); |
605 channel_->AddFilter( | 605 channel_->AddFilter( |
606 new DOMStorageMessageFilter( | 606 new DOMStorageMessageFilter( |
607 GetID(), | 607 GetID(), |
608 storage_partition_impl_->GetDOMStorageContext())); | 608 storage_partition_impl_->GetDOMStorageContext())); |
609 channel_->AddFilter( | 609 channel_->AddFilter( |
610 new IndexedDBDispatcherHost( | 610 new IndexedDBDispatcherHost( |
611 GetID(), | 611 GetID(), |
612 storage_partition_impl_->GetIndexedDBContext())); | 612 storage_partition_impl_->GetIndexedDBContext())); |
613 if (IsGuest()) { | 613 if (IsGuest()) { |
614 if (!g_browser_plugin_geolocation_context.Get()) { | 614 if (!g_browser_plugin_geolocation_context.Get().get()) { |
615 g_browser_plugin_geolocation_context.Get() = | 615 g_browser_plugin_geolocation_context.Get() = |
616 new BrowserPluginGeolocationPermissionContext(); | 616 new BrowserPluginGeolocationPermissionContext(); |
617 } | 617 } |
618 channel_->AddFilter(GeolocationDispatcherHost::New( | 618 channel_->AddFilter(GeolocationDispatcherHost::New( |
619 GetID(), g_browser_plugin_geolocation_context.Get())); | 619 GetID(), g_browser_plugin_geolocation_context.Get().get())); |
620 } else { | 620 } else { |
621 channel_->AddFilter(GeolocationDispatcherHost::New( | 621 channel_->AddFilter(GeolocationDispatcherHost::New( |
622 GetID(), browser_context->GetGeolocationPermissionContext())); | 622 GetID(), browser_context->GetGeolocationPermissionContext())); |
623 } | 623 } |
624 gpu_message_filter_ = new GpuMessageFilter(GetID(), widget_helper_.get()); | 624 gpu_message_filter_ = new GpuMessageFilter(GetID(), widget_helper_.get()); |
625 channel_->AddFilter(gpu_message_filter_); | 625 channel_->AddFilter(gpu_message_filter_); |
626 #if defined(ENABLE_WEBRTC) | 626 #if defined(ENABLE_WEBRTC) |
627 peer_connection_tracker_host_ = new PeerConnectionTrackerHost(GetID()); | 627 peer_connection_tracker_host_ = new PeerConnectionTrackerHost(GetID()); |
628 channel_->AddFilter(peer_connection_tracker_host_); | 628 channel_->AddFilter(peer_connection_tracker_host_.get()); |
629 channel_->AddFilter(new MediaStreamDispatcherHost(GetID())); | 629 channel_->AddFilter(new MediaStreamDispatcherHost(GetID())); |
630 #endif | 630 #endif |
631 #if defined(ENABLE_PLUGINS) | 631 #if defined(ENABLE_PLUGINS) |
632 channel_->AddFilter(new PepperMessageFilter(GetID(), browser_context)); | 632 channel_->AddFilter(new PepperMessageFilter(GetID(), browser_context)); |
633 #endif | 633 #endif |
634 #if defined(ENABLE_INPUT_SPEECH) | 634 #if defined(ENABLE_INPUT_SPEECH) |
635 channel_->AddFilter(new InputTagSpeechDispatcherHost( | 635 channel_->AddFilter(new InputTagSpeechDispatcherHost( |
636 IsGuest(), GetID(), storage_partition_impl_->GetURLRequestContext(), | 636 IsGuest(), GetID(), storage_partition_impl_->GetURLRequestContext(), |
637 browser_context->GetSpeechRecognitionPreferences())); | 637 browser_context->GetSpeechRecognitionPreferences())); |
638 #endif | 638 #endif |
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1767 TRACE_EVENT0("renderer_host", | 1767 TRACE_EVENT0("renderer_host", |
1768 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); | 1768 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); |
1769 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; | 1769 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
1770 ack_params.sync_point = 0; | 1770 ack_params.sync_point = 0; |
1771 RenderWidgetHostImpl::AcknowledgeBufferPresent(params.route_id, | 1771 RenderWidgetHostImpl::AcknowledgeBufferPresent(params.route_id, |
1772 params.gpu_process_host_id, | 1772 params.gpu_process_host_id, |
1773 ack_params); | 1773 ack_params); |
1774 } | 1774 } |
1775 | 1775 |
1776 } // namespace content | 1776 } // namespace content |
OLD | NEW |