| 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 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 media::MediaCodecUtil::IsMediaCodecAvailable()) { | 804 media::MediaCodecUtil::IsMediaCodecAvailable()) { |
| 804 media::EnablePlatformDecoderSupport(); | 805 media::EnablePlatformDecoderSupport(); |
| 805 } | 806 } |
| 806 #endif | 807 #endif |
| 807 | 808 |
| 808 memory_pressure_listener_.reset(new base::MemoryPressureListener( | 809 memory_pressure_listener_.reset(new base::MemoryPressureListener( |
| 809 base::Bind(&RenderThreadImpl::OnMemoryPressure, base::Unretained(this)), | 810 base::Bind(&RenderThreadImpl::OnMemoryPressure, base::Unretained(this)), |
| 810 base::Bind(&RenderThreadImpl::OnSyncMemoryPressure, | 811 base::Bind(&RenderThreadImpl::OnSyncMemoryPressure, |
| 811 base::Unretained(this)))); | 812 base::Unretained(this)))); |
| 812 | 813 |
| 813 if (memory_coordinator::IsEnabled()) { | 814 if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) { |
| 814 // TODO(bashi): Revisit how to manage the lifetime of | 815 // TODO(bashi): Revisit how to manage the lifetime of |
| 815 // ChildMemoryCoordinatorImpl. | 816 // ChildMemoryCoordinatorImpl. |
| 816 // https://codereview.chromium.org/2094583002/#msg52 | 817 // https://codereview.chromium.org/2094583002/#msg52 |
| 817 memory_coordinator::mojom::MemoryCoordinatorHandlePtr parent_coordinator; | 818 mojom::MemoryCoordinatorHandlePtr parent_coordinator; |
| 818 GetRemoteInterfaces()->GetInterface(mojo::GetProxy(&parent_coordinator)); | 819 GetRemoteInterfaces()->GetInterface(mojo::GetProxy(&parent_coordinator)); |
| 819 memory_coordinator_ = memory_coordinator::CreateChildMemoryCoordinator( | 820 memory_coordinator_ = CreateChildMemoryCoordinator( |
| 820 std::move(parent_coordinator), this); | 821 std::move(parent_coordinator), this); |
| 821 } | 822 } |
| 822 | 823 |
| 823 int num_raster_threads = 0; | 824 int num_raster_threads = 0; |
| 824 std::string string_value = | 825 std::string string_value = |
| 825 command_line.GetSwitchValueASCII(switches::kNumRasterThreads); | 826 command_line.GetSwitchValueASCII(switches::kNumRasterThreads); |
| 826 bool parsed_num_raster_threads = | 827 bool parsed_num_raster_threads = |
| 827 base::StringToInt(string_value, &num_raster_threads); | 828 base::StringToInt(string_value, &num_raster_threads); |
| 828 DCHECK(parsed_num_raster_threads) << string_value; | 829 DCHECK(parsed_num_raster_threads) << string_value; |
| 829 DCHECK_GT(num_raster_threads, 0); | 830 DCHECK_GT(num_raster_threads, 0); |
| (...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2244 if (blink::mainThreadIsolate()) { | 2245 if (blink::mainThreadIsolate()) { |
| 2245 blink::mainThreadIsolate()->MemoryPressureNotification( | 2246 blink::mainThreadIsolate()->MemoryPressureNotification( |
| 2246 v8::MemoryPressureLevel::kCritical); | 2247 v8::MemoryPressureLevel::kCritical); |
| 2247 blink::MemoryPressureNotificationToWorkerThreadIsolates( | 2248 blink::MemoryPressureNotificationToWorkerThreadIsolates( |
| 2248 v8::MemoryPressureLevel::kCritical); | 2249 v8::MemoryPressureLevel::kCritical); |
| 2249 } | 2250 } |
| 2250 } | 2251 } |
| 2251 | 2252 |
| 2252 | 2253 |
| 2253 } // namespace content | 2254 } // namespace content |
| OLD | NEW |