Chromium Code Reviews| Index: content/renderer/render_thread_impl.cc |
| diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc |
| index fc83bd7fb946a937142e210324832a6e540a82d2..3fca390590adb1c4c1f0f2b68484410c5912d5eb 100644 |
| --- a/content/renderer/render_thread_impl.cc |
| +++ b/content/renderer/render_thread_impl.cc |
| @@ -639,6 +639,22 @@ void RenderThreadImpl::Init( |
| shared_bitmap_manager_.reset( |
| new ChildSharedBitmapManager(thread_safe_render_message_filter_)); |
| + memory_pressure_listener_.reset(new base::MemoryPressureListener( |
| + base::Bind(&RenderThreadImpl::OnMemoryPressure, base::Unretained(this)), |
| + base::Bind(&RenderThreadImpl::OnSyncMemoryPressure, |
| + base::Unretained(this)))); |
| + |
| + if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) { |
| + // Disable MemoryPressureListener when memory coordinator is enabled. |
| + base::MemoryPressureListener::SetNotificationsSuppressed(true); |
| + |
| + mojom::MemoryCoordinatorHandlePtr parent_coordinator; |
| + GetConnector()->BindInterface(mojom::kBrowserServiceName, |
| + mojo::MakeRequest(&parent_coordinator)); |
| + memory_coordinator_ = |
| + CreateChildMemoryCoordinator(std::move(parent_coordinator), this); |
| + } |
| + |
| InitializeWebKit(resource_task_queue); |
| // In single process the single process is all there is. |
| @@ -824,25 +840,6 @@ void RenderThreadImpl::Init( |
| media::EnableNewVp9CodecStringSupport(); |
| } |
| - memory_pressure_listener_.reset(new base::MemoryPressureListener( |
| - base::Bind(&RenderThreadImpl::OnMemoryPressure, base::Unretained(this)), |
| - base::Bind(&RenderThreadImpl::OnSyncMemoryPressure, |
| - base::Unretained(this)))); |
| - |
| - if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) { |
| - // Disable MemoryPressureListener when memory coordinator is enabled. |
| - base::MemoryPressureListener::SetNotificationsSuppressed(true); |
| - |
| - // TODO(bashi): Revisit how to manage the lifetime of |
|
bashi
2017/03/23 07:47:52
Removed this TODO as this looks a common pattern t
|
| - // ChildMemoryCoordinatorImpl. |
| - // https://codereview.chromium.org/2094583002/#msg52 |
| - mojom::MemoryCoordinatorHandlePtr parent_coordinator; |
| - GetConnector()->BindInterface(mojom::kBrowserServiceName, |
| - mojo::MakeRequest(&parent_coordinator)); |
| - memory_coordinator_ = CreateChildMemoryCoordinator( |
| - std::move(parent_coordinator), this); |
| - } |
| - |
| int num_raster_threads = 0; |
| std::string string_value = |
| command_line.GetSwitchValueASCII(switches::kNumRasterThreads); |