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

Unified Diff: content/renderer/render_thread_impl.cc

Issue 2775583002: Initialize ChildMemoryCoordinator before blink (Closed)
Patch Set: rebase Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698