| 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" |
| 11 #include "base/feature_list.h" |
| 11 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 12 #include "base/guid.h" | 13 #include "base/guid.h" |
| 13 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
| 14 #include "base/location.h" | 15 #include "base/location.h" |
| 15 #include "base/logging.h" | 16 #include "base/logging.h" |
| 16 #include "base/memory/memory_coordinator_client_registry.h" | 17 #include "base/memory/memory_coordinator_client_registry.h" |
| 17 #include "base/memory/ptr_util.h" | 18 #include "base/memory/ptr_util.h" |
| 18 #include "base/memory/shared_memory.h" | 19 #include "base/memory/shared_memory.h" |
| 19 #include "base/metrics/histogram_macros.h" | 20 #include "base/metrics/histogram_macros.h" |
| 20 #include "base/numerics/safe_conversions.h" | 21 #include "base/numerics/safe_conversions.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 34 #include "content/child/quota_message_filter.h" | 35 #include "content/child/quota_message_filter.h" |
| 35 #include "content/child/storage_util.h" | 36 #include "content/child/storage_util.h" |
| 36 #include "content/child/thread_safe_sender.h" | 37 #include "content/child/thread_safe_sender.h" |
| 37 #include "content/child/web_database_observer_impl.h" | 38 #include "content/child/web_database_observer_impl.h" |
| 38 #include "content/child/web_url_loader_impl.h" | 39 #include "content/child/web_url_loader_impl.h" |
| 39 #include "content/child/webfileutilities_impl.h" | 40 #include "content/child/webfileutilities_impl.h" |
| 40 #include "content/child/webmessageportchannel_impl.h" | 41 #include "content/child/webmessageportchannel_impl.h" |
| 41 #include "content/common/file_utilities_messages.h" | 42 #include "content/common/file_utilities_messages.h" |
| 42 #include "content/common/frame_messages.h" | 43 #include "content/common/frame_messages.h" |
| 43 #include "content/common/render_process_messages.h" | 44 #include "content/common/render_process_messages.h" |
| 45 #include "content/common/worker_fetch_context_factory.mojom.h" |
| 46 #include "content/public/common/content_features.h" |
| 44 #include "content/public/common/content_switches.h" | 47 #include "content/public/common/content_switches.h" |
| 45 #include "content/public/common/service_manager_connection.h" | 48 #include "content/public/common/service_manager_connection.h" |
| 46 #include "content/public/common/webplugininfo.h" | 49 #include "content/public/common/webplugininfo.h" |
| 47 #include "content/public/renderer/content_renderer_client.h" | 50 #include "content/public/renderer/content_renderer_client.h" |
| 48 #include "content/public/renderer/media_stream_utils.h" | 51 #include "content/public/renderer/media_stream_utils.h" |
| 49 #include "content/public/renderer/render_frame.h" | 52 #include "content/public/renderer/render_frame.h" |
| 50 #include "content/renderer/cache_storage/webserviceworkercachestorage_impl.h" | 53 #include "content/renderer/cache_storage/webserviceworkercachestorage_impl.h" |
| 51 #include "content/renderer/device_sensors/device_light_event_pump.h" | 54 #include "content/renderer/device_sensors/device_light_event_pump.h" |
| 52 #include "content/renderer/device_sensors/device_motion_event_pump.h" | 55 #include "content/renderer/device_sensors/device_motion_event_pump.h" |
| 53 #include "content/renderer/device_sensors/device_orientation_event_pump.h" | 56 #include "content/renderer/device_sensors/device_orientation_event_pump.h" |
| 54 #include "content/renderer/dom_storage/local_storage_cached_areas.h" | 57 #include "content/renderer/dom_storage/local_storage_cached_areas.h" |
| 55 #include "content/renderer/dom_storage/local_storage_namespace.h" | 58 #include "content/renderer/dom_storage/local_storage_namespace.h" |
| 56 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" | 59 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" |
| 57 #include "content/renderer/gamepad_shared_memory_reader.h" | 60 #include "content/renderer/gamepad_shared_memory_reader.h" |
| 58 #include "content/renderer/image_capture/image_capture_frame_grabber.h" | 61 #include "content/renderer/image_capture/image_capture_frame_grabber.h" |
| 59 #include "content/renderer/media/audio_decoder.h" | 62 #include "content/renderer/media/audio_decoder.h" |
| 60 #include "content/renderer/media/audio_device_factory.h" | 63 #include "content/renderer/media/audio_device_factory.h" |
| 61 #include "content/renderer/media/renderer_webaudiodevice_impl.h" | 64 #include "content/renderer/media/renderer_webaudiodevice_impl.h" |
| 62 #include "content/renderer/media/renderer_webmidiaccessor_impl.h" | 65 #include "content/renderer/media/renderer_webmidiaccessor_impl.h" |
| 63 #include "content/renderer/media_capture_from_element/canvas_capture_handler.h" | 66 #include "content/renderer/media_capture_from_element/canvas_capture_handler.h" |
| 64 #include "content/renderer/media_capture_from_element/html_audio_element_capture
r_source.h" | 67 #include "content/renderer/media_capture_from_element/html_audio_element_capture
r_source.h" |
| 65 #include "content/renderer/media_capture_from_element/html_video_element_capture
r_source.h" | 68 #include "content/renderer/media_capture_from_element/html_video_element_capture
r_source.h" |
| 66 #include "content/renderer/media_recorder/media_recorder_handler.h" | 69 #include "content/renderer/media_recorder/media_recorder_handler.h" |
| 67 #include "content/renderer/mojo/blink_interface_provider_impl.h" | 70 #include "content/renderer/mojo/blink_interface_provider_impl.h" |
| 68 #include "content/renderer/render_thread_impl.h" | 71 #include "content/renderer/render_thread_impl.h" |
| 69 #include "content/renderer/renderer_clipboard_delegate.h" | 72 #include "content/renderer/renderer_clipboard_delegate.h" |
| 73 #include "content/renderer/service_worker/worker_fetch_context_info_impl.h" |
| 70 #include "content/renderer/webclipboard_impl.h" | 74 #include "content/renderer/webclipboard_impl.h" |
| 71 #include "content/renderer/webgraphicscontext3d_provider_impl.h" | 75 #include "content/renderer/webgraphicscontext3d_provider_impl.h" |
| 72 #include "content/renderer/webpublicsuffixlist_impl.h" | 76 #include "content/renderer/webpublicsuffixlist_impl.h" |
| 73 #include "gpu/command_buffer/client/gles2_interface.h" | 77 #include "gpu/command_buffer/client/gles2_interface.h" |
| 74 #include "gpu/config/gpu_info.h" | 78 #include "gpu/config/gpu_info.h" |
| 75 #include "gpu/ipc/client/gpu_channel_host.h" | 79 #include "gpu/ipc/client/gpu_channel_host.h" |
| 76 #include "gpu/ipc/common/gpu_stream_constants.h" | 80 #include "gpu/ipc/common/gpu_stream_constants.h" |
| 77 #include "ipc/ipc_sync_message_filter.h" | 81 #include "ipc/ipc_sync_message_filter.h" |
| 78 #include "media/audio/audio_output_device.h" | 82 #include "media/audio/audio_output_device.h" |
| 79 #include "media/blink/webcontentdecryptionmodule_impl.h" | 83 #include "media/blink/webcontentdecryptionmodule_impl.h" |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 // Let the browser know we generated cacheable metadata for this resource in | 424 // Let the browser know we generated cacheable metadata for this resource in |
| 421 // CacheStorage. The browser may cache it and return it on subsequent | 425 // CacheStorage. The browser may cache it and return it on subsequent |
| 422 // responses to speed the processing of this resource. | 426 // responses to speed the processing of this resource. |
| 423 std::vector<char> copy(data, data + size); | 427 std::vector<char> copy(data, data + size); |
| 424 RenderThread::Get()->Send( | 428 RenderThread::Get()->Send( |
| 425 new RenderProcessHostMsg_DidGenerateCacheableMetadataInCacheStorage( | 429 new RenderProcessHostMsg_DidGenerateCacheableMetadataInCacheStorage( |
| 426 url, base::Time::FromInternalValue(response_time), copy, | 430 url, base::Time::FromInternalValue(response_time), copy, |
| 427 cacheStorageOrigin, cacheStorageCacheName.utf8())); | 431 cacheStorageOrigin, cacheStorageCacheName.utf8())); |
| 428 } | 432 } |
| 429 | 433 |
| 434 std::unique_ptr<blink::WebWorkerFetchContextInfo> |
| 435 RendererBlinkPlatformImpl::createWorkerFetchContextInfo() { |
| 436 if (!base::FeatureList::IsEnabled(features::kOffMainThreadFetch)) |
| 437 return nullptr; |
| 438 mojom::WorkerFetchContextFactoryPtr worker_fetch_context_factory; |
| 439 interfaceProvider()->getInterface( |
| 440 mojo::MakeRequest(&worker_fetch_context_factory)); |
| 441 return base::MakeUnique<WorkerFetchContextInfoImpl>( |
| 442 worker_fetch_context_factory.PassInterface()); |
| 443 } |
| 444 |
| 430 WebString RendererBlinkPlatformImpl::defaultLocale() { | 445 WebString RendererBlinkPlatformImpl::defaultLocale() { |
| 431 return WebString::fromASCII(RenderThread::Get()->GetLocale()); | 446 return WebString::fromASCII(RenderThread::Get()->GetLocale()); |
| 432 } | 447 } |
| 433 | 448 |
| 434 void RendererBlinkPlatformImpl::suddenTerminationChanged(bool enabled) { | 449 void RendererBlinkPlatformImpl::suddenTerminationChanged(bool enabled) { |
| 435 if (enabled) { | 450 if (enabled) { |
| 436 // We should not get more enables than disables, but we want it to be a | 451 // We should not get more enables than disables, but we want it to be a |
| 437 // non-fatal error if it does happen. | 452 // non-fatal error if it does happen. |
| 438 DCHECK_GT(sudden_termination_disables_, 0); | 453 DCHECK_GT(sudden_termination_disables_, 0); |
| 439 sudden_termination_disables_ = std::max(sudden_termination_disables_ - 1, | 454 sudden_termination_disables_ = std::max(sudden_termination_disables_ - 1, |
| (...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1273 //------------------------------------------------------------------------------ | 1288 //------------------------------------------------------------------------------ |
| 1274 void RendererBlinkPlatformImpl::requestPurgeMemory() { | 1289 void RendererBlinkPlatformImpl::requestPurgeMemory() { |
| 1275 // TODO(tasak|bashi): We should use ChildMemoryCoordinator here, but | 1290 // TODO(tasak|bashi): We should use ChildMemoryCoordinator here, but |
| 1276 // ChildMemoryCoordinator isn't always available as it's only initialized | 1291 // ChildMemoryCoordinator isn't always available as it's only initialized |
| 1277 // when kMemoryCoordinatorV0 is enabled. | 1292 // when kMemoryCoordinatorV0 is enabled. |
| 1278 // Use ChildMemoryCoordinator when memory coordinator is always enabled. | 1293 // Use ChildMemoryCoordinator when memory coordinator is always enabled. |
| 1279 base::MemoryCoordinatorClientRegistry::GetInstance()->PurgeMemory(); | 1294 base::MemoryCoordinatorClientRegistry::GetInstance()->PurgeMemory(); |
| 1280 } | 1295 } |
| 1281 | 1296 |
| 1282 } // namespace content | 1297 } // namespace content |
| OLD | NEW |