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

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

Issue 2094583002: Add MemoryCoordinator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment 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
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 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 media::MediaCodecUtil::IsMediaCodecAvailable()) { 808 media::MediaCodecUtil::IsMediaCodecAvailable()) {
808 media::EnablePlatformDecoderSupport(); 809 media::EnablePlatformDecoderSupport();
809 } 810 }
810 #endif 811 #endif
811 812
812 memory_pressure_listener_.reset(new base::MemoryPressureListener( 813 memory_pressure_listener_.reset(new base::MemoryPressureListener(
813 base::Bind(&RenderThreadImpl::OnMemoryPressure, base::Unretained(this)), 814 base::Bind(&RenderThreadImpl::OnMemoryPressure, base::Unretained(this)),
814 base::Bind(&RenderThreadImpl::OnSyncMemoryPressure, 815 base::Bind(&RenderThreadImpl::OnSyncMemoryPressure,
815 base::Unretained(this)))); 816 base::Unretained(this))));
816 817
818 if (memory_coordinator::IsEnabled()) {
819 memory_coordinator_.reset(
820 new memory_coordinator::ChildMemoryCoordinatorImpl());
821 GetInterfaceRegistry()->AddInterface(
822 base::Bind(&memory_coordinator::ChildMemoryCoordinatorImpl::Bind,
823 base::Unretained(memory_coordinator_.get())));
dcheng 2016/07/08 07:10:35 Does it make sense to just have memory_coordinator
bashi 2016/07/08 07:32:39 I didn't know base::Owned(). Thanks. Probably we c
824 }
825
817 int num_raster_threads = 0; 826 int num_raster_threads = 0;
818 std::string string_value = 827 std::string string_value =
819 command_line.GetSwitchValueASCII(switches::kNumRasterThreads); 828 command_line.GetSwitchValueASCII(switches::kNumRasterThreads);
820 bool parsed_num_raster_threads = 829 bool parsed_num_raster_threads =
821 base::StringToInt(string_value, &num_raster_threads); 830 base::StringToInt(string_value, &num_raster_threads);
822 DCHECK(parsed_num_raster_threads) << string_value; 831 DCHECK(parsed_num_raster_threads) << string_value;
823 DCHECK_GT(num_raster_threads, 0); 832 DCHECK_GT(num_raster_threads, 0);
824 833
825 // TODO(vmpstr): If the flag sticks, we should clean it up and always have 834 // TODO(vmpstr): If the flag sticks, we should clean it up and always have
826 // image decode tasks. 835 // image decode tasks.
(...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after
2223 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical) 2232 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical)
2224 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate; 2233 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate;
2225 2234
2226 blink::mainThreadIsolate()->MemoryPressureNotification( 2235 blink::mainThreadIsolate()->MemoryPressureNotification(
2227 v8_memory_pressure_level); 2236 v8_memory_pressure_level);
2228 blink::MemoryPressureNotificationToWorkerThreadIsolates( 2237 blink::MemoryPressureNotificationToWorkerThreadIsolates(
2229 v8_memory_pressure_level); 2238 v8_memory_pressure_level);
2230 } 2239 }
2231 2240
2232 } // namespace content 2241 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698