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

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

Issue 2149413002: Re-reland: Add MemoryCoordinator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Always pass MemoryCoordinatorHandlePtr Created 4 years, 5 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
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | content/test/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 28 matching lines...) Expand all
39 #include "build/build_config.h" 39 #include "build/build_config.h"
40 #include "cc/base/histograms.h" 40 #include "cc/base/histograms.h"
41 #include "cc/base/switches.h" 41 #include "cc/base/switches.h"
42 #include "cc/blink/web_external_bitmap_impl.h" 42 #include "cc/blink/web_external_bitmap_impl.h"
43 #include "cc/blink/web_layer_impl.h" 43 #include "cc/blink/web_layer_impl.h"
44 #include "cc/output/output_surface.h" 44 #include "cc/output/output_surface.h"
45 #include "cc/output/vulkan_in_process_context_provider.h" 45 #include "cc/output/vulkan_in_process_context_provider.h"
46 #include "cc/raster/task_graph_runner.h" 46 #include "cc/raster/task_graph_runner.h"
47 #include "cc/trees/layer_tree_host_common.h" 47 #include "cc/trees/layer_tree_host_common.h"
48 #include "cc/trees/layer_tree_settings.h" 48 #include "cc/trees/layer_tree_settings.h"
49 #include "components/memory_coordinator/child/child_memory_coordinator_impl.h"
49 #include "components/scheduler/child/compositor_worker_scheduler.h" 50 #include "components/scheduler/child/compositor_worker_scheduler.h"
50 #include "components/scheduler/child/webthread_base.h" 51 #include "components/scheduler/child/webthread_base.h"
51 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h" 52 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h"
52 #include "components/scheduler/renderer/renderer_scheduler.h" 53 #include "components/scheduler/renderer/renderer_scheduler.h"
53 #include "content/child/appcache/appcache_dispatcher.h" 54 #include "content/child/appcache/appcache_dispatcher.h"
54 #include "content/child/appcache/appcache_frontend_impl.h" 55 #include "content/child/appcache/appcache_frontend_impl.h"
55 #include "content/child/blob_storage/blob_message_filter.h" 56 #include "content/child/blob_storage/blob_message_filter.h"
56 #include "content/child/child_discardable_shared_memory_manager.h" 57 #include "content/child/child_discardable_shared_memory_manager.h"
57 #include "content/child/child_gpu_memory_buffer_manager.h" 58 #include "content/child/child_gpu_memory_buffer_manager.h"
58 #include "content/child/child_histogram_message_filter.h" 59 #include "content/child/child_histogram_message_filter.h"
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 media::MediaCodecUtil::IsMediaCodecAvailable()) { 830 media::MediaCodecUtil::IsMediaCodecAvailable()) {
830 media::EnablePlatformDecoderSupport(); 831 media::EnablePlatformDecoderSupport();
831 } 832 }
832 #endif 833 #endif
833 834
834 memory_pressure_listener_.reset(new base::MemoryPressureListener( 835 memory_pressure_listener_.reset(new base::MemoryPressureListener(
835 base::Bind(&RenderThreadImpl::OnMemoryPressure, base::Unretained(this)), 836 base::Bind(&RenderThreadImpl::OnMemoryPressure, base::Unretained(this)),
836 base::Bind(&RenderThreadImpl::OnSyncMemoryPressure, 837 base::Bind(&RenderThreadImpl::OnSyncMemoryPressure,
837 base::Unretained(this)))); 838 base::Unretained(this))));
838 839
840 if (memory_coordinator::IsEnabled()) {
841 // TODO(bashi): Revisit how to manage the lifetime of
842 // ChildMemoryCoordinatorImpl.
843 // https://codereview.chromium.org/2094583002/#msg52
844 memory_coordinator::mojom::MemoryCoordinatorHandlePtr parent_coordinator;
845 GetRemoteInterfaces()->GetInterface(mojo::GetProxy(&parent_coordinator));
846 memory_coordinator_.reset(
847 new memory_coordinator::ChildMemoryCoordinatorImpl(
848 std::move(parent_coordinator)));
849 }
850
839 int num_raster_threads = 0; 851 int num_raster_threads = 0;
840 std::string string_value = 852 std::string string_value =
841 command_line.GetSwitchValueASCII(switches::kNumRasterThreads); 853 command_line.GetSwitchValueASCII(switches::kNumRasterThreads);
842 bool parsed_num_raster_threads = 854 bool parsed_num_raster_threads =
843 base::StringToInt(string_value, &num_raster_threads); 855 base::StringToInt(string_value, &num_raster_threads);
844 DCHECK(parsed_num_raster_threads) << string_value; 856 DCHECK(parsed_num_raster_threads) << string_value;
845 DCHECK_GT(num_raster_threads, 0); 857 DCHECK_GT(num_raster_threads, 0);
846 858
847 // TODO(vmpstr): If the flag sticks, we should clean it up and always have 859 // TODO(vmpstr): If the flag sticks, we should clean it up and always have
848 // image decode tasks. 860 // image decode tasks.
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after
2228 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical) 2240 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical)
2229 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate; 2241 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate;
2230 2242
2231 blink::mainThreadIsolate()->MemoryPressureNotification( 2243 blink::mainThreadIsolate()->MemoryPressureNotification(
2232 v8_memory_pressure_level); 2244 v8_memory_pressure_level);
2233 blink::MemoryPressureNotificationToWorkerThreadIsolates( 2245 blink::MemoryPressureNotificationToWorkerThreadIsolates(
2234 v8_memory_pressure_level); 2246 v8_memory_pressure_level);
2235 } 2247 }
2236 2248
2237 } // namespace content 2249 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | content/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698