Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: content/renderer/renderer_blink_platform_impl.cc

Issue 2804843005: Implement the infrastructure of creating WorkerFetchContext in worker global scope. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 12 matching lines...) Expand all
33 #include "content/child/quota_message_filter.h" 34 #include "content/child/quota_message_filter.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"
44 #include "content/common/worker_fetch_context_factory.mojom.h"
45 #include "content/public/common/content_features.h"
43 #include "content/public/common/content_switches.h" 46 #include "content/public/common/content_switches.h"
44 #include "content/public/common/service_manager_connection.h" 47 #include "content/public/common/service_manager_connection.h"
45 #include "content/public/common/webplugininfo.h" 48 #include "content/public/common/webplugininfo.h"
46 #include "content/public/renderer/content_renderer_client.h" 49 #include "content/public/renderer/content_renderer_client.h"
47 #include "content/public/renderer/media_stream_utils.h" 50 #include "content/public/renderer/media_stream_utils.h"
48 #include "content/public/renderer/render_frame.h" 51 #include "content/public/renderer/render_frame.h"
49 #include "content/renderer/cache_storage/webserviceworkercachestorage_impl.h" 52 #include "content/renderer/cache_storage/webserviceworkercachestorage_impl.h"
50 #include "content/renderer/device_sensors/device_light_event_pump.h" 53 #include "content/renderer/device_sensors/device_light_event_pump.h"
51 #include "content/renderer/device_sensors/device_motion_event_pump.h" 54 #include "content/renderer/device_sensors/device_motion_event_pump.h"
52 #include "content/renderer/device_sensors/device_orientation_event_pump.h" 55 #include "content/renderer/device_sensors/device_orientation_event_pump.h"
53 #include "content/renderer/dom_storage/local_storage_cached_areas.h" 56 #include "content/renderer/dom_storage/local_storage_cached_areas.h"
54 #include "content/renderer/dom_storage/local_storage_namespace.h" 57 #include "content/renderer/dom_storage/local_storage_namespace.h"
55 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" 58 #include "content/renderer/dom_storage/webstoragenamespace_impl.h"
56 #include "content/renderer/gamepad_shared_memory_reader.h" 59 #include "content/renderer/gamepad_shared_memory_reader.h"
57 #include "content/renderer/image_capture/image_capture_frame_grabber.h" 60 #include "content/renderer/image_capture/image_capture_frame_grabber.h"
58 #include "content/renderer/media/audio_decoder.h" 61 #include "content/renderer/media/audio_decoder.h"
59 #include "content/renderer/media/audio_device_factory.h" 62 #include "content/renderer/media/audio_device_factory.h"
60 #include "content/renderer/media/renderer_webaudiodevice_impl.h" 63 #include "content/renderer/media/renderer_webaudiodevice_impl.h"
61 #include "content/renderer/media/renderer_webmidiaccessor_impl.h" 64 #include "content/renderer/media/renderer_webmidiaccessor_impl.h"
62 #include "content/renderer/media_capture_from_element/canvas_capture_handler.h" 65 #include "content/renderer/media_capture_from_element/canvas_capture_handler.h"
63 #include "content/renderer/media_capture_from_element/html_audio_element_capture r_source.h" 66 #include "content/renderer/media_capture_from_element/html_audio_element_capture r_source.h"
64 #include "content/renderer/media_capture_from_element/html_video_element_capture r_source.h" 67 #include "content/renderer/media_capture_from_element/html_video_element_capture r_source.h"
65 #include "content/renderer/media_recorder/media_recorder_handler.h" 68 #include "content/renderer/media_recorder/media_recorder_handler.h"
66 #include "content/renderer/mojo/blink_interface_provider_impl.h" 69 #include "content/renderer/mojo/blink_interface_provider_impl.h"
67 #include "content/renderer/render_thread_impl.h" 70 #include "content/renderer/render_thread_impl.h"
68 #include "content/renderer/renderer_clipboard_delegate.h" 71 #include "content/renderer/renderer_clipboard_delegate.h"
72 #include "content/renderer/service_worker/worker_fetch_context_info_impl.h"
69 #include "content/renderer/webclipboard_impl.h" 73 #include "content/renderer/webclipboard_impl.h"
70 #include "content/renderer/webgraphicscontext3d_provider_impl.h" 74 #include "content/renderer/webgraphicscontext3d_provider_impl.h"
71 #include "content/renderer/webpublicsuffixlist_impl.h" 75 #include "content/renderer/webpublicsuffixlist_impl.h"
72 #include "gpu/command_buffer/client/gles2_interface.h" 76 #include "gpu/command_buffer/client/gles2_interface.h"
73 #include "gpu/config/gpu_info.h" 77 #include "gpu/config/gpu_info.h"
74 #include "gpu/ipc/client/gpu_channel_host.h" 78 #include "gpu/ipc/client/gpu_channel_host.h"
75 #include "gpu/ipc/common/gpu_stream_constants.h" 79 #include "gpu/ipc/common/gpu_stream_constants.h"
76 #include "ipc/ipc_sync_message_filter.h" 80 #include "ipc/ipc_sync_message_filter.h"
77 #include "media/audio/audio_output_device.h" 81 #include "media/audio/audio_output_device.h"
78 #include "media/blink/webcontentdecryptionmodule_impl.h" 82 #include "media/blink/webcontentdecryptionmodule_impl.h"
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 // Let the browser know we generated cacheable metadata for this resource in 439 // Let the browser know we generated cacheable metadata for this resource in
436 // CacheStorage. The browser may cache it and return it on subsequent 440 // CacheStorage. The browser may cache it and return it on subsequent
437 // responses to speed the processing of this resource. 441 // responses to speed the processing of this resource.
438 std::vector<char> copy(data, data + size); 442 std::vector<char> copy(data, data + size);
439 RenderThread::Get()->Send( 443 RenderThread::Get()->Send(
440 new RenderProcessHostMsg_DidGenerateCacheableMetadataInCacheStorage( 444 new RenderProcessHostMsg_DidGenerateCacheableMetadataInCacheStorage(
441 url, base::Time::FromInternalValue(response_time), copy, 445 url, base::Time::FromInternalValue(response_time), copy,
442 cacheStorageOrigin, cacheStorageCacheName.Utf8())); 446 cacheStorageOrigin, cacheStorageCacheName.Utf8()));
443 } 447 }
444 448
449 std::unique_ptr<blink::WebWorkerFetchContextInfo>
450 RendererBlinkPlatformImpl::CreateWorkerFetchContextInfo() {
451 if (!base::FeatureList::IsEnabled(features::kOffMainThreadFetch))
452 return nullptr;
453 mojom::WorkerFetchContextFactoryPtr worker_fetch_context_factory;
454 GetInterfaceProvider()->GetInterface(
455 mojo::MakeRequest(&worker_fetch_context_factory));
456 return base::MakeUnique<WorkerFetchContextInfoImpl>(
457 worker_fetch_context_factory.PassInterface());
458 }
459
445 WebString RendererBlinkPlatformImpl::DefaultLocale() { 460 WebString RendererBlinkPlatformImpl::DefaultLocale() {
446 return WebString::FromASCII(RenderThread::Get()->GetLocale()); 461 return WebString::FromASCII(RenderThread::Get()->GetLocale());
447 } 462 }
448 463
449 void RendererBlinkPlatformImpl::SuddenTerminationChanged(bool enabled) { 464 void RendererBlinkPlatformImpl::SuddenTerminationChanged(bool enabled) {
450 if (enabled) { 465 if (enabled) {
451 // We should not get more enables than disables, but we want it to be a 466 // We should not get more enables than disables, but we want it to be a
452 // non-fatal error if it does happen. 467 // non-fatal error if it does happen.
453 DCHECK_GT(sudden_termination_disables_, 0); 468 DCHECK_GT(sudden_termination_disables_, 0);
454 sudden_termination_disables_ = std::max(sudden_termination_disables_ - 1, 469 sudden_termination_disables_ = std::max(sudden_termination_disables_ - 1,
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
1291 //------------------------------------------------------------------------------ 1306 //------------------------------------------------------------------------------
1292 void RendererBlinkPlatformImpl::RequestPurgeMemory() { 1307 void RendererBlinkPlatformImpl::RequestPurgeMemory() {
1293 // TODO(tasak|bashi): We should use ChildMemoryCoordinator here, but 1308 // TODO(tasak|bashi): We should use ChildMemoryCoordinator here, but
1294 // ChildMemoryCoordinator isn't always available as it's only initialized 1309 // ChildMemoryCoordinator isn't always available as it's only initialized
1295 // when kMemoryCoordinatorV0 is enabled. 1310 // when kMemoryCoordinatorV0 is enabled.
1296 // Use ChildMemoryCoordinator when memory coordinator is always enabled. 1311 // Use ChildMemoryCoordinator when memory coordinator is always enabled.
1297 base::MemoryCoordinatorClientRegistry::GetInstance()->PurgeMemory(); 1312 base::MemoryCoordinatorClientRegistry::GetInstance()->PurgeMemory();
1298 } 1313 }
1299 1314
1300 } // namespace content 1315 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698