Chromium Code Reviews| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 #include "content/renderer/image_capture/image_capture_frame_grabber.h" | 56 #include "content/renderer/image_capture/image_capture_frame_grabber.h" |
| 57 #include "content/renderer/media/audio_decoder.h" | 57 #include "content/renderer/media/audio_decoder.h" |
| 58 #include "content/renderer/media/audio_device_factory.h" | 58 #include "content/renderer/media/audio_device_factory.h" |
| 59 #include "content/renderer/media/renderer_webaudiodevice_impl.h" | 59 #include "content/renderer/media/renderer_webaudiodevice_impl.h" |
| 60 #include "content/renderer/media/renderer_webmidiaccessor_impl.h" | 60 #include "content/renderer/media/renderer_webmidiaccessor_impl.h" |
| 61 #include "content/renderer/media_capture_from_element/canvas_capture_handler.h" | 61 #include "content/renderer/media_capture_from_element/canvas_capture_handler.h" |
| 62 #include "content/renderer/media_capture_from_element/html_audio_element_capture r_source.h" | 62 #include "content/renderer/media_capture_from_element/html_audio_element_capture r_source.h" |
| 63 #include "content/renderer/media_capture_from_element/html_video_element_capture r_source.h" | 63 #include "content/renderer/media_capture_from_element/html_video_element_capture r_source.h" |
| 64 #include "content/renderer/media_recorder/media_recorder_handler.h" | 64 #include "content/renderer/media_recorder/media_recorder_handler.h" |
| 65 #include "content/renderer/mojo/blink_interface_provider_impl.h" | 65 #include "content/renderer/mojo/blink_interface_provider_impl.h" |
| 66 #include "content/renderer/render_frame_impl.h" | |
| 66 #include "content/renderer/render_thread_impl.h" | 67 #include "content/renderer/render_thread_impl.h" |
| 67 #include "content/renderer/renderer_clipboard_delegate.h" | 68 #include "content/renderer/renderer_clipboard_delegate.h" |
| 68 #include "content/renderer/webclipboard_impl.h" | 69 #include "content/renderer/webclipboard_impl.h" |
| 69 #include "content/renderer/webgraphicscontext3d_provider_impl.h" | 70 #include "content/renderer/webgraphicscontext3d_provider_impl.h" |
| 70 #include "content/renderer/webpublicsuffixlist_impl.h" | 71 #include "content/renderer/webpublicsuffixlist_impl.h" |
| 71 #include "device/gamepad/public/cpp/gamepads.h" | 72 #include "device/gamepad/public/cpp/gamepads.h" |
| 72 #include "gpu/command_buffer/client/gles2_interface.h" | 73 #include "gpu/command_buffer/client/gles2_interface.h" |
| 73 #include "gpu/config/gpu_info.h" | 74 #include "gpu/config/gpu_info.h" |
| 74 #include "gpu/ipc/client/gpu_channel_host.h" | 75 #include "gpu/ipc/client/gpu_channel_host.h" |
| 75 #include "gpu/ipc/common/gpu_stream_constants.h" | 76 #include "gpu/ipc/common/gpu_stream_constants.h" |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 297 sandbox_support_.reset(); | 298 sandbox_support_.reset(); |
| 298 #endif | 299 #endif |
| 299 } | 300 } |
| 300 | 301 |
| 301 //------------------------------------------------------------------------------ | 302 //------------------------------------------------------------------------------ |
| 302 | 303 |
| 303 std::unique_ptr<blink::WebURLLoader> | 304 std::unique_ptr<blink::WebURLLoader> |
| 304 RendererBlinkPlatformImpl::CreateURLLoader() { | 305 RendererBlinkPlatformImpl::CreateURLLoader() { |
| 305 ChildThreadImpl* child_thread = ChildThreadImpl::current(); | 306 ChildThreadImpl* child_thread = ChildThreadImpl::current(); |
| 306 | 307 |
| 307 mojom::URLLoaderFactory* factory = | 308 const bool network_service_enabled = |
| 308 url_loader_factory_ ? url_loader_factory_.get() | 309 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 309 : network_service_url_loader_factory_.get(); | 310 switches::kEnableNetworkService); |
| 310 if (!factory && child_thread) { | 311 |
| 311 bool network_service_enabled = | 312 mojom::URLLoaderFactory* factory = nullptr; |
| 312 base::CommandLine::ForCurrentProcess()->HasSwitch( | 313 if (!network_service_enabled) { |
| 313 switches::kEnableNetworkService); | 314 if (child_thread) { |
| 314 if (network_service_enabled) { | |
| 315 connector_->BindInterface(mojom::kNetworkServiceName, | |
| 316 &network_service_url_loader_factory_); | |
| 317 factory = network_service_url_loader_factory_.get(); | |
| 318 } else { | |
| 319 child_thread->channel()->GetRemoteAssociatedInterface( | 315 child_thread->channel()->GetRemoteAssociatedInterface( |
| 320 &url_loader_factory_); | 316 &url_loader_factory_); |
| 321 factory = url_loader_factory_.get(); | 317 } |
| 318 factory = url_loader_factory_.get(); | |
| 319 } else { | |
| 320 // If there's a URLLoaderFactory attached to the frame, use it. | |
|
kinuko
2017/05/02 03:37:50
Can you put a short todo comment like: "TODO(crbug
scottmg
2017/05/02 15:19:22
Done.
| |
| 321 blink::WebLocalFrame* const web_frame = | |
| 322 blink::WebLocalFrame::FrameForCurrentContext(); | |
| 323 RenderFrameImpl* render_frame = | |
| 324 static_cast<RenderFrameImpl*>(RenderFrame::FromWebFrame(web_frame)); | |
| 325 if (render_frame && render_frame->GetURLLoaderFactory()) { | |
| 326 factory = render_frame->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(); | |
| 322 } | 333 } |
| 323 } | 334 } |
| 324 | 335 |
| 325 // 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 |
| 326 // data URLs to bypass the ResourceDispatcher. | 337 // data URLs to bypass the ResourceDispatcher. |
| 327 return base::MakeUnique<WebURLLoaderImpl>( | 338 return base::MakeUnique<WebURLLoaderImpl>( |
| 328 child_thread ? child_thread->resource_dispatcher() : nullptr, factory); | 339 child_thread ? child_thread->resource_dispatcher() : nullptr, factory); |
| 329 } | 340 } |
| 330 | 341 |
| 331 blink::WebThread* RendererBlinkPlatformImpl::CurrentThread() { | 342 blink::WebThread* RendererBlinkPlatformImpl::CurrentThread() { |
| (...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1273 //------------------------------------------------------------------------------ | 1284 //------------------------------------------------------------------------------ |
| 1274 void RendererBlinkPlatformImpl::RequestPurgeMemory() { | 1285 void RendererBlinkPlatformImpl::RequestPurgeMemory() { |
| 1275 // TODO(tasak|bashi): We should use ChildMemoryCoordinator here, but | 1286 // TODO(tasak|bashi): We should use ChildMemoryCoordinator here, but |
| 1276 // ChildMemoryCoordinator isn't always available as it's only initialized | 1287 // ChildMemoryCoordinator isn't always available as it's only initialized |
| 1277 // when kMemoryCoordinatorV0 is enabled. | 1288 // when kMemoryCoordinatorV0 is enabled. |
| 1278 // Use ChildMemoryCoordinator when memory coordinator is always enabled. | 1289 // Use ChildMemoryCoordinator when memory coordinator is always enabled. |
| 1279 base::MemoryCoordinatorClientRegistry::GetInstance()->PurgeMemory(); | 1290 base::MemoryCoordinatorClientRegistry::GetInstance()->PurgeMemory(); |
| 1280 } | 1291 } |
| 1281 | 1292 |
| 1282 } // namespace content | 1293 } // namespace content |
| OLD | NEW |