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/render_thread_impl.h" | 5 #include "content/renderer/render_thread_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <map> | 9 #include <map> |
10 #include <utility> | 10 #include <utility> |
(...skipping 27 matching lines...) Expand all Loading... |
38 #include "cc/base/histograms.h" | 38 #include "cc/base/histograms.h" |
39 #include "cc/base/switches.h" | 39 #include "cc/base/switches.h" |
40 #include "cc/blink/web_layer_impl.h" | 40 #include "cc/blink/web_layer_impl.h" |
41 #include "cc/output/buffer_to_texture_target_map.h" | 41 #include "cc/output/buffer_to_texture_target_map.h" |
42 #include "cc/output/copy_output_request.h" | 42 #include "cc/output/copy_output_request.h" |
43 #include "cc/output/output_surface.h" | 43 #include "cc/output/output_surface.h" |
44 #include "cc/output/vulkan_in_process_context_provider.h" | 44 #include "cc/output/vulkan_in_process_context_provider.h" |
45 #include "cc/raster/task_graph_runner.h" | 45 #include "cc/raster/task_graph_runner.h" |
46 #include "cc/trees/layer_tree_host_common.h" | 46 #include "cc/trees/layer_tree_host_common.h" |
47 #include "cc/trees/layer_tree_settings.h" | 47 #include "cc/trees/layer_tree_settings.h" |
48 #include "components/memory_coordinator/child/child_memory_coordinator_impl.h" | |
49 #include "content/child/appcache/appcache_dispatcher.h" | 48 #include "content/child/appcache/appcache_dispatcher.h" |
50 #include "content/child/appcache/appcache_frontend_impl.h" | 49 #include "content/child/appcache/appcache_frontend_impl.h" |
51 #include "content/child/blob_storage/blob_message_filter.h" | 50 #include "content/child/blob_storage/blob_message_filter.h" |
52 #include "content/child/child_discardable_shared_memory_manager.h" | 51 #include "content/child/child_discardable_shared_memory_manager.h" |
53 #include "content/child/child_gpu_memory_buffer_manager.h" | 52 #include "content/child/child_gpu_memory_buffer_manager.h" |
54 #include "content/child/child_histogram_message_filter.h" | 53 #include "content/child/child_histogram_message_filter.h" |
55 #include "content/child/child_resource_message_filter.h" | 54 #include "content/child/child_resource_message_filter.h" |
56 #include "content/child/child_shared_bitmap_manager.h" | 55 #include "content/child/child_shared_bitmap_manager.h" |
57 #include "content/child/content_child_helpers.h" | 56 #include "content/child/content_child_helpers.h" |
58 #include "content/child/db_message_filter.h" | 57 #include "content/child/db_message_filter.h" |
59 #include "content/child/indexed_db/indexed_db_dispatcher.h" | 58 #include "content/child/indexed_db/indexed_db_dispatcher.h" |
60 #include "content/child/indexed_db/indexed_db_message_filter.h" | 59 #include "content/child/indexed_db/indexed_db_message_filter.h" |
| 60 #include "content/child/memory/child_memory_coordinator_impl.h" |
61 #include "content/child/resource_dispatcher.h" | 61 #include "content/child/resource_dispatcher.h" |
62 #include "content/child/resource_scheduling_filter.h" | 62 #include "content/child/resource_scheduling_filter.h" |
63 #include "content/child/runtime_features.h" | 63 #include "content/child/runtime_features.h" |
64 #include "content/child/thread_safe_sender.h" | 64 #include "content/child/thread_safe_sender.h" |
65 #include "content/child/web_database_observer_impl.h" | 65 #include "content/child/web_database_observer_impl.h" |
66 #include "content/child/worker_thread_registry.h" | 66 #include "content/child/worker_thread_registry.h" |
67 #include "content/common/child_process_messages.h" | 67 #include "content/common/child_process_messages.h" |
68 #include "content/common/content_constants_internal.h" | 68 #include "content/common/content_constants_internal.h" |
69 #include "content/common/dom_storage/dom_storage_messages.h" | 69 #include "content/common/dom_storage/dom_storage_messages.h" |
70 #include "content/common/frame_messages.h" | 70 #include "content/common/frame_messages.h" |
71 #include "content/common/frame_owner_properties.h" | 71 #include "content/common/frame_owner_properties.h" |
72 #include "content/common/gpu/client/context_provider_command_buffer.h" | 72 #include "content/common/gpu/client/context_provider_command_buffer.h" |
73 #include "content/common/render_process_messages.h" | 73 #include "content/common/render_process_messages.h" |
74 #include "content/common/resource_messages.h" | 74 #include "content/common/resource_messages.h" |
75 #include "content/common/service_worker/embedded_worker_setup.mojom.h" | 75 #include "content/common/service_worker/embedded_worker_setup.mojom.h" |
76 #include "content/common/site_isolation_policy.h" | 76 #include "content/common/site_isolation_policy.h" |
77 #include "content/common/view_messages.h" | 77 #include "content/common/view_messages.h" |
78 #include "content/common/worker_messages.h" | 78 #include "content/common/worker_messages.h" |
79 #include "content/public/common/content_constants.h" | 79 #include "content/public/common/content_constants.h" |
| 80 #include "content/public/common/content_features.h" |
80 #include "content/public/common/content_paths.h" | 81 #include "content/public/common/content_paths.h" |
81 #include "content/public/common/content_switches.h" | 82 #include "content/public/common/content_switches.h" |
82 #include "content/public/common/renderer_preferences.h" | 83 #include "content/public/common/renderer_preferences.h" |
83 #include "content/public/common/url_constants.h" | 84 #include "content/public/common/url_constants.h" |
84 #include "content/public/renderer/content_renderer_client.h" | 85 #include "content/public/renderer/content_renderer_client.h" |
85 #include "content/public/renderer/render_thread_observer.h" | 86 #include "content/public/renderer/render_thread_observer.h" |
86 #include "content/public/renderer/render_view_visitor.h" | 87 #include "content/public/renderer/render_view_visitor.h" |
87 #include "content/renderer/browser_plugin/browser_plugin_manager.h" | 88 #include "content/renderer/browser_plugin/browser_plugin_manager.h" |
88 #include "content/renderer/cache_storage/cache_storage_dispatcher.h" | 89 #include "content/renderer/cache_storage/cache_storage_dispatcher.h" |
89 #include "content/renderer/cache_storage/cache_storage_message_filter.h" | 90 #include "content/renderer/cache_storage/cache_storage_message_filter.h" |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 media::MediaCodecUtil::IsMediaCodecAvailable()) { | 810 media::MediaCodecUtil::IsMediaCodecAvailable()) { |
810 media::EnablePlatformDecoderSupport(); | 811 media::EnablePlatformDecoderSupport(); |
811 } | 812 } |
812 #endif | 813 #endif |
813 | 814 |
814 memory_pressure_listener_.reset(new base::MemoryPressureListener( | 815 memory_pressure_listener_.reset(new base::MemoryPressureListener( |
815 base::Bind(&RenderThreadImpl::OnMemoryPressure, base::Unretained(this)), | 816 base::Bind(&RenderThreadImpl::OnMemoryPressure, base::Unretained(this)), |
816 base::Bind(&RenderThreadImpl::OnSyncMemoryPressure, | 817 base::Bind(&RenderThreadImpl::OnSyncMemoryPressure, |
817 base::Unretained(this)))); | 818 base::Unretained(this)))); |
818 | 819 |
819 if (memory_coordinator::IsEnabled()) { | 820 if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) { |
820 // TODO(bashi): Revisit how to manage the lifetime of | 821 // TODO(bashi): Revisit how to manage the lifetime of |
821 // ChildMemoryCoordinatorImpl. | 822 // ChildMemoryCoordinatorImpl. |
822 // https://codereview.chromium.org/2094583002/#msg52 | 823 // https://codereview.chromium.org/2094583002/#msg52 |
823 memory_coordinator::mojom::MemoryCoordinatorHandlePtr parent_coordinator; | 824 mojom::MemoryCoordinatorHandlePtr parent_coordinator; |
824 GetRemoteInterfaces()->GetInterface(mojo::GetProxy(&parent_coordinator)); | 825 GetRemoteInterfaces()->GetInterface(mojo::GetProxy(&parent_coordinator)); |
825 memory_coordinator_ = memory_coordinator::CreateChildMemoryCoordinator( | 826 memory_coordinator_ = CreateChildMemoryCoordinator( |
826 std::move(parent_coordinator), this); | 827 std::move(parent_coordinator), this); |
827 } | 828 } |
828 | 829 |
829 int num_raster_threads = 0; | 830 int num_raster_threads = 0; |
830 std::string string_value = | 831 std::string string_value = |
831 command_line.GetSwitchValueASCII(switches::kNumRasterThreads); | 832 command_line.GetSwitchValueASCII(switches::kNumRasterThreads); |
832 bool parsed_num_raster_threads = | 833 bool parsed_num_raster_threads = |
833 base::StringToInt(string_value, &num_raster_threads); | 834 base::StringToInt(string_value, &num_raster_threads); |
834 DCHECK(parsed_num_raster_threads) << string_value; | 835 DCHECK(parsed_num_raster_threads) << string_value; |
835 DCHECK_GT(num_raster_threads, 0); | 836 DCHECK_GT(num_raster_threads, 0); |
(...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2245 if (blink::mainThreadIsolate()) { | 2246 if (blink::mainThreadIsolate()) { |
2246 blink::mainThreadIsolate()->MemoryPressureNotification( | 2247 blink::mainThreadIsolate()->MemoryPressureNotification( |
2247 v8::MemoryPressureLevel::kCritical); | 2248 v8::MemoryPressureLevel::kCritical); |
2248 blink::MemoryPressureNotificationToWorkerThreadIsolates( | 2249 blink::MemoryPressureNotificationToWorkerThreadIsolates( |
2249 v8::MemoryPressureLevel::kCritical); | 2250 v8::MemoryPressureLevel::kCritical); |
2250 } | 2251 } |
2251 } | 2252 } |
2252 | 2253 |
2253 | 2254 |
2254 } // namespace content | 2255 } // namespace content |
OLD | NEW |