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

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

Issue 2925903004: Add support for blob urls for subresources. (Closed)
Patch Set: Created 3 years, 6 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "cc/base/switches.h" 54 #include "cc/base/switches.h"
55 #include "cc/output/buffer_to_texture_target_map.h" 55 #include "cc/output/buffer_to_texture_target_map.h"
56 #include "components/metrics/single_sample_metrics.h" 56 #include "components/metrics/single_sample_metrics.h"
57 #include "components/tracing/common/tracing_switches.h" 57 #include "components/tracing/common/tracing_switches.h"
58 #include "content/browser/appcache/appcache_dispatcher_host.h" 58 #include "content/browser/appcache/appcache_dispatcher_host.h"
59 #include "content/browser/appcache/chrome_appcache_service.h" 59 #include "content/browser/appcache/chrome_appcache_service.h"
60 #include "content/browser/background_fetch/background_fetch_service_impl.h" 60 #include "content/browser/background_fetch/background_fetch_service_impl.h"
61 #include "content/browser/background_sync/background_sync_service_impl.h" 61 #include "content/browser/background_sync/background_sync_service_impl.h"
62 #include "content/browser/bad_message.h" 62 #include "content/browser/bad_message.h"
63 #include "content/browser/blob_storage/blob_dispatcher_host.h" 63 #include "content/browser/blob_storage/blob_dispatcher_host.h"
64 #include "content/browser/blob_storage/blob_url_loader_factory.h"
64 #include "content/browser/blob_storage/chrome_blob_storage_context.h" 65 #include "content/browser/blob_storage/chrome_blob_storage_context.h"
65 #include "content/browser/broadcast_channel/broadcast_channel_provider.h" 66 #include "content/browser/broadcast_channel/broadcast_channel_provider.h"
66 #include "content/browser/browser_child_process_host_impl.h" 67 #include "content/browser/browser_child_process_host_impl.h"
67 #include "content/browser/browser_main.h" 68 #include "content/browser/browser_main.h"
68 #include "content/browser/browser_main_loop.h" 69 #include "content/browser/browser_main_loop.h"
69 #include "content/browser/browser_plugin/browser_plugin_message_filter.h" 70 #include "content/browser/browser_plugin/browser_plugin_message_filter.h"
70 #include "content/browser/cache_storage/cache_storage_context_impl.h" 71 #include "content/browser/cache_storage/cache_storage_context_impl.h"
71 #include "content/browser/cache_storage/cache_storage_dispatcher_host.h" 72 #include "content/browser/cache_storage/cache_storage_dispatcher_host.h"
72 #include "content/browser/child_process_security_policy_impl.h" 73 #include "content/browser/child_process_security_policy_impl.h"
73 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" 74 #include "content/browser/dom_storage/dom_storage_context_wrapper.h"
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 id_, 941 id_,
941 storage_partition_impl_->GetURLRequestContext(), 942 storage_partition_impl_->GetURLRequestContext(),
942 storage_partition_impl_->GetIndexedDBContext(), 943 storage_partition_impl_->GetIndexedDBContext(),
943 ChromeBlobStorageContext::GetFor(browser_context_))), 944 ChromeBlobStorageContext::GetFor(browser_context_))),
944 channel_connected_(false), 945 channel_connected_(false),
945 sent_render_process_ready_(false), 946 sent_render_process_ready_(false),
946 #if defined(OS_ANDROID) 947 #if defined(OS_ANDROID)
947 never_signaled_(base::WaitableEvent::ResetPolicy::MANUAL, 948 never_signaled_(base::WaitableEvent::ResetPolicy::MANUAL,
948 base::WaitableEvent::InitialState::NOT_SIGNALED), 949 base::WaitableEvent::InitialState::NOT_SIGNALED),
949 #endif 950 #endif
951 renderer_host_binding_(this),
950 instance_weak_factory_( 952 instance_weak_factory_(
951 new base::WeakPtrFactory<RenderProcessHostImpl>(this)), 953 new base::WeakPtrFactory<RenderProcessHostImpl>(this)),
952 frame_sink_provider_(id_), 954 frame_sink_provider_(id_),
953 weak_factory_(this) { 955 weak_factory_(this) {
954 widget_helper_ = new RenderWidgetHelper(); 956 widget_helper_ = new RenderWidgetHelper();
955 957
956 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); 958 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID());
957 959
958 CHECK(!BrowserMainRunner::ExitedMainMessageLoop()); 960 CHECK(!BrowserMainRunner::ExitedMainMessageLoop());
959 RegisterHost(GetID(), this); 961 RegisterHost(GetID(), this);
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
1555 1557
1556 AddUIThreadInterface(registry.get(), base::Bind(&FieldTrialRecorder::Create)); 1558 AddUIThreadInterface(registry.get(), base::Bind(&FieldTrialRecorder::Create));
1557 1559
1558 associated_interfaces_.reset(new AssociatedInterfaceRegistryImpl()); 1560 associated_interfaces_.reset(new AssociatedInterfaceRegistryImpl());
1559 GetContentClient()->browser()->ExposeInterfacesToRenderer( 1561 GetContentClient()->browser()->ExposeInterfacesToRenderer(
1560 registry.get(), associated_interfaces_.get(), this); 1562 registry.get(), associated_interfaces_.get(), this);
1561 static_cast<AssociatedInterfaceRegistry*>(associated_interfaces_.get()) 1563 static_cast<AssociatedInterfaceRegistry*>(associated_interfaces_.get())
1562 ->AddInterface(base::Bind(&RenderProcessHostImpl::BindRouteProvider, 1564 ->AddInterface(base::Bind(&RenderProcessHostImpl::BindRouteProvider,
1563 base::Unretained(this))); 1565 base::Unretained(this)));
1564 1566
1567 AddUIThreadInterface(registry.get(),
1568 base::Bind(&RenderProcessHostImpl::CreateRendererHost,
1569 base::Unretained(this)));
1570
1565 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1571 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1566 switches::kEnableNetworkService)) { 1572 switches::kEnableNetworkService)) {
1567 AddUIThreadInterface( 1573 AddUIThreadInterface(
1568 registry.get(), 1574 registry.get(),
1569 base::Bind(&RenderProcessHostImpl::CreateURLLoaderFactory, 1575 base::Bind(&RenderProcessHostImpl::CreateURLLoaderFactory,
1570 base::Unretained(this))); 1576 base::Unretained(this)));
1571 } 1577 }
1572 1578
1573 ServiceManagerConnection* service_manager_connection = 1579 ServiceManagerConnection* service_manager_connection =
1574 BrowserContext::GetServiceManagerConnectionFor(browser_context_); 1580 BrowserContext::GetServiceManagerConnectionFor(browser_context_);
(...skipping 23 matching lines...) Expand all
1598 void RenderProcessHostImpl::GetAssociatedInterface( 1604 void RenderProcessHostImpl::GetAssociatedInterface(
1599 const std::string& name, 1605 const std::string& name,
1600 mojom::AssociatedInterfaceAssociatedRequest request) { 1606 mojom::AssociatedInterfaceAssociatedRequest request) {
1601 int32_t routing_id = 1607 int32_t routing_id =
1602 associated_interface_provider_bindings_.dispatch_context(); 1608 associated_interface_provider_bindings_.dispatch_context();
1603 IPC::Listener* listener = listeners_.Lookup(routing_id); 1609 IPC::Listener* listener = listeners_.Lookup(routing_id);
1604 if (listener) 1610 if (listener)
1605 listener->OnAssociatedInterfaceRequest(name, request.PassHandle()); 1611 listener->OnAssociatedInterfaceRequest(name, request.PassHandle());
1606 } 1612 }
1607 1613
1614 void RenderProcessHostImpl::GetBlobURLLoaderFactory(
1615 mojom::URLLoaderFactoryRequest request) {
1616 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
1617 switches::kEnableNetworkService)) {
1618 NOTREACHED();
1619 return;
1620 }
1621 storage_partition_impl_->GetBlobURLLoaderFactory()->HandleRequest(
1622 std::move(request));
1623 }
1624
1608 void RenderProcessHostImpl::CreateMusGpuRequest( 1625 void RenderProcessHostImpl::CreateMusGpuRequest(
1609 const service_manager::BindSourceInfo& source_info, 1626 const service_manager::BindSourceInfo& source_info,
1610 ui::mojom::GpuRequest request) { 1627 ui::mojom::GpuRequest request) {
1611 DCHECK_CURRENTLY_ON(BrowserThread::IO); 1628 DCHECK_CURRENTLY_ON(BrowserThread::IO);
1612 if (!gpu_client_) 1629 if (!gpu_client_)
1613 gpu_client_.reset(new GpuClient(GetID())); 1630 gpu_client_.reset(new GpuClient(GetID()));
1614 gpu_client_->Add(std::move(request)); 1631 gpu_client_->Add(std::move(request));
1615 } 1632 }
1616 1633
1617 void RenderProcessHostImpl::CreateOffscreenCanvasProvider( 1634 void RenderProcessHostImpl::CreateOffscreenCanvasProvider(
(...skipping 18 matching lines...) Expand all
1636 void RenderProcessHostImpl::CreateStoragePartitionService( 1653 void RenderProcessHostImpl::CreateStoragePartitionService(
1637 const service_manager::BindSourceInfo& source_info, 1654 const service_manager::BindSourceInfo& source_info,
1638 mojom::StoragePartitionServiceRequest request) { 1655 mojom::StoragePartitionServiceRequest request) {
1639 // DO NOT REMOVE THIS COMMAND LINE CHECK WITHOUT SECURITY REVIEW! 1656 // DO NOT REMOVE THIS COMMAND LINE CHECK WITHOUT SECURITY REVIEW!
1640 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1657 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1641 switches::kMojoLocalStorage)) { 1658 switches::kMojoLocalStorage)) {
1642 storage_partition_impl_->Bind(std::move(request)); 1659 storage_partition_impl_->Bind(std::move(request));
1643 } 1660 }
1644 } 1661 }
1645 1662
1663 void RenderProcessHostImpl::CreateRendererHost(
1664 const service_manager::BindSourceInfo& source_info,
1665 mojom::RendererHostRequest request) {
1666 renderer_host_binding_.Bind(std::move(request));
1667 }
1668
1646 void RenderProcessHostImpl::CreateURLLoaderFactory( 1669 void RenderProcessHostImpl::CreateURLLoaderFactory(
1647 const service_manager::BindSourceInfo& source_info, 1670 const service_manager::BindSourceInfo& source_info,
1648 mojom::URLLoaderFactoryRequest request) { 1671 mojom::URLLoaderFactoryRequest request) {
1649 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 1672 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
1650 switches::kEnableNetworkService)) { 1673 switches::kEnableNetworkService)) {
1651 NOTREACHED(); 1674 NOTREACHED();
1652 return; 1675 return;
1653 } 1676 }
1654 storage_partition_impl_->network_context()->CreateURLLoaderFactory( 1677 storage_partition_impl_->network_context()->CreateURLLoaderFactory(
1655 std::move(request), id_); 1678 std::move(request), id_);
(...skipping 1932 matching lines...) Expand 10 before | Expand all | Expand 10 after
3588 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; 3611 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error;
3589 3612
3590 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. 3613 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing.
3591 // Capture the error message in a crash key value. 3614 // Capture the error message in a crash key value.
3592 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); 3615 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error);
3593 bad_message::ReceivedBadMessage(render_process_id, 3616 bad_message::ReceivedBadMessage(render_process_id,
3594 bad_message::RPH_MOJO_PROCESS_ERROR); 3617 bad_message::RPH_MOJO_PROCESS_ERROR);
3595 } 3618 }
3596 3619
3597 } // namespace content 3620 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698