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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 #if !defined(OS_ANDROID) && !defined(OS_WIN) | 295 #if !defined(OS_ANDROID) && !defined(OS_WIN) |
296 // SandboxSupport contains a map of WebFontFamily objects, which hold | 296 // SandboxSupport contains a map of WebFontFamily objects, which hold |
297 // WebCStrings, which become invalidated when blink is shut down. Hence, we | 297 // WebCStrings, which become invalidated when blink is shut down. Hence, we |
298 // need to clear that map now, just before blink::shutdown() is called. | 298 // need to clear that map now, just before blink::shutdown() is called. |
299 sandbox_support_.reset(); | 299 sandbox_support_.reset(); |
300 #endif | 300 #endif |
301 } | 301 } |
302 | 302 |
303 //------------------------------------------------------------------------------ | 303 //------------------------------------------------------------------------------ |
304 | 304 |
305 blink::WebURLLoader* RendererBlinkPlatformImpl::CreateURLLoader() { | 305 std::unique_ptr<blink::WebURLLoader> |
| 306 RendererBlinkPlatformImpl::CreateURLLoader() { |
306 ChildThreadImpl* child_thread = ChildThreadImpl::current(); | 307 ChildThreadImpl* child_thread = ChildThreadImpl::current(); |
307 | 308 |
308 mojom::URLLoaderFactory* factory = | 309 mojom::URLLoaderFactory* factory = |
309 url_loader_factory_ ? url_loader_factory_.get() | 310 url_loader_factory_ ? url_loader_factory_.get() |
310 : network_service_url_loader_factory_.get(); | 311 : network_service_url_loader_factory_.get(); |
311 if (!factory && child_thread) { | 312 if (!factory && child_thread) { |
312 bool network_service_enabled = | 313 bool network_service_enabled = |
313 base::CommandLine::ForCurrentProcess()->HasSwitch( | 314 base::CommandLine::ForCurrentProcess()->HasSwitch( |
314 switches::kEnableNetworkService); | 315 switches::kEnableNetworkService); |
315 if (network_service_enabled) { | 316 if (network_service_enabled) { |
316 connector_->BindInterface(mojom::kNetworkServiceName, | 317 connector_->BindInterface(mojom::kNetworkServiceName, |
317 &network_service_url_loader_factory_); | 318 &network_service_url_loader_factory_); |
318 factory = network_service_url_loader_factory_.get(); | 319 factory = network_service_url_loader_factory_.get(); |
319 } else { | 320 } else { |
320 child_thread->channel()->GetRemoteAssociatedInterface( | 321 child_thread->channel()->GetRemoteAssociatedInterface( |
321 &url_loader_factory_); | 322 &url_loader_factory_); |
322 factory = url_loader_factory_.get(); | 323 factory = url_loader_factory_.get(); |
323 } | 324 } |
324 } | 325 } |
325 | 326 |
326 // There may be no child thread in RenderViewTests. These tests can still use | 327 // There may be no child thread in RenderViewTests. These tests can still use |
327 // data URLs to bypass the ResourceDispatcher. | 328 // data URLs to bypass the ResourceDispatcher. |
328 return new content::WebURLLoaderImpl( | 329 return base::MakeUnique<WebURLLoaderImpl>( |
329 child_thread ? child_thread->resource_dispatcher() : nullptr, factory); | 330 child_thread ? child_thread->resource_dispatcher() : nullptr, factory); |
330 } | 331 } |
331 | 332 |
332 blink::WebThread* RendererBlinkPlatformImpl::CurrentThread() { | 333 blink::WebThread* RendererBlinkPlatformImpl::CurrentThread() { |
333 if (main_thread_->IsCurrentThread()) | 334 if (main_thread_->IsCurrentThread()) |
334 return main_thread_.get(); | 335 return main_thread_.get(); |
335 return BlinkPlatformImpl::CurrentThread(); | 336 return BlinkPlatformImpl::CurrentThread(); |
336 } | 337 } |
337 | 338 |
338 blink::BlameContext* RendererBlinkPlatformImpl::GetTopLevelBlameContext() { | 339 blink::BlameContext* RendererBlinkPlatformImpl::GetTopLevelBlameContext() { |
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1289 //------------------------------------------------------------------------------ | 1290 //------------------------------------------------------------------------------ |
1290 void RendererBlinkPlatformImpl::RequestPurgeMemory() { | 1291 void RendererBlinkPlatformImpl::RequestPurgeMemory() { |
1291 // TODO(tasak|bashi): We should use ChildMemoryCoordinator here, but | 1292 // TODO(tasak|bashi): We should use ChildMemoryCoordinator here, but |
1292 // ChildMemoryCoordinator isn't always available as it's only initialized | 1293 // ChildMemoryCoordinator isn't always available as it's only initialized |
1293 // when kMemoryCoordinatorV0 is enabled. | 1294 // when kMemoryCoordinatorV0 is enabled. |
1294 // Use ChildMemoryCoordinator when memory coordinator is always enabled. | 1295 // Use ChildMemoryCoordinator when memory coordinator is always enabled. |
1295 base::MemoryCoordinatorClientRegistry::GetInstance()->PurgeMemory(); | 1296 base::MemoryCoordinatorClientRegistry::GetInstance()->PurgeMemory(); |
1296 } | 1297 } |
1297 | 1298 |
1298 } // namespace content | 1299 } // namespace content |
OLD | NEW |