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. |
| 321 // TODO(yhirano|scottmg): Make the URLLoaderFactory always a per-frame |
| 322 // thing? See https://crbug.com/712913. |
| 323 blink::WebLocalFrame* const web_frame = |
| 324 blink::WebLocalFrame::FrameForCurrentContext(); |
| 325 RenderFrameImpl* render_frame = |
| 326 static_cast<RenderFrameImpl*>(RenderFrame::FromWebFrame(web_frame)); |
| 327 if (render_frame && render_frame->GetURLLoaderFactory()) { |
| 328 factory = render_frame->GetURLLoaderFactory(); |
| 329 } else { |
| 330 if (!network_service_url_loader_factory_) { |
| 331 connector_->BindInterface(mojom::kNetworkServiceName, |
| 332 &network_service_url_loader_factory_); |
| 333 } |
| 334 factory = network_service_url_loader_factory_.get(); |
322 } | 335 } |
323 } | 336 } |
324 | 337 |
325 // There may be no child thread in RenderViewTests. These tests can still use | 338 // There may be no child thread in RenderViewTests. These tests can still use |
326 // data URLs to bypass the ResourceDispatcher. | 339 // data URLs to bypass the ResourceDispatcher. |
327 return base::MakeUnique<WebURLLoaderImpl>( | 340 return base::MakeUnique<WebURLLoaderImpl>( |
328 child_thread ? child_thread->resource_dispatcher() : nullptr, factory); | 341 child_thread ? child_thread->resource_dispatcher() : nullptr, factory); |
329 } | 342 } |
330 | 343 |
331 blink::WebThread* RendererBlinkPlatformImpl::CurrentThread() { | 344 blink::WebThread* RendererBlinkPlatformImpl::CurrentThread() { |
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1273 //------------------------------------------------------------------------------ | 1286 //------------------------------------------------------------------------------ |
1274 void RendererBlinkPlatformImpl::RequestPurgeMemory() { | 1287 void RendererBlinkPlatformImpl::RequestPurgeMemory() { |
1275 // TODO(tasak|bashi): We should use ChildMemoryCoordinator here, but | 1288 // TODO(tasak|bashi): We should use ChildMemoryCoordinator here, but |
1276 // ChildMemoryCoordinator isn't always available as it's only initialized | 1289 // ChildMemoryCoordinator isn't always available as it's only initialized |
1277 // when kMemoryCoordinatorV0 is enabled. | 1290 // when kMemoryCoordinatorV0 is enabled. |
1278 // Use ChildMemoryCoordinator when memory coordinator is always enabled. | 1291 // Use ChildMemoryCoordinator when memory coordinator is always enabled. |
1279 base::MemoryCoordinatorClientRegistry::GetInstance()->PurgeMemory(); | 1292 base::MemoryCoordinatorClientRegistry::GetInstance()->PurgeMemory(); |
1280 } | 1293 } |
1281 | 1294 |
1282 } // namespace content | 1295 } // namespace content |
OLD | NEW |