| 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 #include "content/renderer/renderer_blink_platform_impl.h" | 5 #include "content/renderer/renderer_blink_platform_impl.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "base/threading/thread_task_runner_handle.h" | 24 #include "base/threading/thread_task_runner_handle.h" |
| 25 #include "build/build_config.h" | 25 #include "build/build_config.h" |
| 26 #include "components/url_formatter/url_formatter.h" | 26 #include "components/url_formatter/url_formatter.h" |
| 27 #include "content/child/blob_storage/webblobregistry_impl.h" | 27 #include "content/child/blob_storage/webblobregistry_impl.h" |
| 28 #include "content/child/database_util.h" | 28 #include "content/child/database_util.h" |
| 29 #include "content/child/file_info_util.h" | 29 #include "content/child/file_info_util.h" |
| 30 #include "content/child/fileapi/webfilesystem_impl.h" | 30 #include "content/child/fileapi/webfilesystem_impl.h" |
| 31 #include "content/child/indexed_db/webidbfactory_impl.h" | 31 #include "content/child/indexed_db/webidbfactory_impl.h" |
| 32 #include "content/child/quota_dispatcher.h" | 32 #include "content/child/quota_dispatcher.h" |
| 33 #include "content/child/quota_message_filter.h" | 33 #include "content/child/quota_message_filter.h" |
| 34 #include "content/child/service_worker/service_worker_dispatcher.h" |
| 34 #include "content/child/storage_util.h" | 35 #include "content/child/storage_util.h" |
| 35 #include "content/child/thread_safe_sender.h" | 36 #include "content/child/thread_safe_sender.h" |
| 36 #include "content/child/web_database_observer_impl.h" | 37 #include "content/child/web_database_observer_impl.h" |
| 37 #include "content/child/web_url_loader_impl.h" | 38 #include "content/child/web_url_loader_impl.h" |
| 38 #include "content/child/webfileutilities_impl.h" | 39 #include "content/child/webfileutilities_impl.h" |
| 39 #include "content/child/webmessageportchannel_impl.h" | 40 #include "content/child/webmessageportchannel_impl.h" |
| 40 #include "content/common/file_utilities_messages.h" | 41 #include "content/common/file_utilities_messages.h" |
| 41 #include "content/common/frame_messages.h" | 42 #include "content/common/frame_messages.h" |
| 42 #include "content/common/render_process_messages.h" | 43 #include "content/common/render_process_messages.h" |
| 43 #include "content/public/common/content_switches.h" | 44 #include "content/public/common/content_switches.h" |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 sandbox_support_.reset(); | 301 sandbox_support_.reset(); |
| 301 #endif | 302 #endif |
| 302 } | 303 } |
| 303 | 304 |
| 304 //------------------------------------------------------------------------------ | 305 //------------------------------------------------------------------------------ |
| 305 | 306 |
| 306 std::unique_ptr<blink::WebURLLoader> | 307 std::unique_ptr<blink::WebURLLoader> |
| 307 RendererBlinkPlatformImpl::CreateURLLoader() { | 308 RendererBlinkPlatformImpl::CreateURLLoader() { |
| 308 ChildThreadImpl* child_thread = ChildThreadImpl::current(); | 309 ChildThreadImpl* child_thread = ChildThreadImpl::current(); |
| 309 | 310 |
| 310 mojom::URLLoaderFactory* factory = | 311 const bool network_service_enabled = |
| 311 url_loader_factory_ ? url_loader_factory_.get() | 312 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 312 : network_service_url_loader_factory_.get(); | 313 switches::kEnableNetworkService); |
| 313 if (!factory && child_thread) { | 314 |
| 314 bool network_service_enabled = | 315 mojom::URLLoaderFactory* factory = nullptr; |
| 315 base::CommandLine::ForCurrentProcess()->HasSwitch( | 316 if (!network_service_enabled) { |
| 316 switches::kEnableNetworkService); | 317 if (child_thread) { |
| 317 if (network_service_enabled) { | |
| 318 connector_->BindInterface(mojom::kNetworkServiceName, | |
| 319 &network_service_url_loader_factory_); | |
| 320 factory = network_service_url_loader_factory_.get(); | |
| 321 } else { | |
| 322 child_thread->channel()->GetRemoteAssociatedInterface( | 318 child_thread->channel()->GetRemoteAssociatedInterface( |
| 323 &url_loader_factory_); | 319 &url_loader_factory_); |
| 324 factory = url_loader_factory_.get(); | 320 } |
| 321 factory = url_loader_factory_.get(); |
| 322 } else { |
| 323 ServiceWorkerDispatcher* sw_dispatcher = |
| 324 ServiceWorkerDispatcher::GetThreadSpecificInstance(); |
| 325 if (sw_dispatcher && sw_dispatcher->GetURLLoaderFactory()) { |
| 326 factory = sw_dispatcher->GetURLLoaderFactory(); |
| 327 } else { |
| 328 if (!network_service_url_loader_factory_) { |
| 329 connector_->BindInterface(mojom::kNetworkServiceName, |
| 330 &network_service_url_loader_factory_); |
| 331 } |
| 332 factory = network_service_url_loader_factory_.get(); |
| 325 } | 333 } |
| 326 } | 334 } |
| 327 | 335 |
| 328 // There may be no child thread in RenderViewTests. These tests can still use | 336 // There may be no child thread in RenderViewTests. These tests can still use |
| 329 // data URLs to bypass the ResourceDispatcher. | 337 // data URLs to bypass the ResourceDispatcher. |
| 330 return base::MakeUnique<WebURLLoaderImpl>( | 338 return base::MakeUnique<WebURLLoaderImpl>( |
| 331 child_thread ? child_thread->resource_dispatcher() : nullptr, factory); | 339 child_thread ? child_thread->resource_dispatcher() : nullptr, factory); |
| 332 } | 340 } |
| 333 | 341 |
| 334 blink::WebThread* RendererBlinkPlatformImpl::CurrentThread() { | 342 blink::WebThread* RendererBlinkPlatformImpl::CurrentThread() { |
| (...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1291 //------------------------------------------------------------------------------ | 1299 //------------------------------------------------------------------------------ |
| 1292 void RendererBlinkPlatformImpl::RequestPurgeMemory() { | 1300 void RendererBlinkPlatformImpl::RequestPurgeMemory() { |
| 1293 // TODO(tasak|bashi): We should use ChildMemoryCoordinator here, but | 1301 // TODO(tasak|bashi): We should use ChildMemoryCoordinator here, but |
| 1294 // ChildMemoryCoordinator isn't always available as it's only initialized | 1302 // ChildMemoryCoordinator isn't always available as it's only initialized |
| 1295 // when kMemoryCoordinatorV0 is enabled. | 1303 // when kMemoryCoordinatorV0 is enabled. |
| 1296 // Use ChildMemoryCoordinator when memory coordinator is always enabled. | 1304 // Use ChildMemoryCoordinator when memory coordinator is always enabled. |
| 1297 base::MemoryCoordinatorClientRegistry::GetInstance()->PurgeMemory(); | 1305 base::MemoryCoordinatorClientRegistry::GetInstance()->PurgeMemory(); |
| 1298 } | 1306 } |
| 1299 | 1307 |
| 1300 } // namespace content | 1308 } // namespace content |
| OLD | NEW |