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

Unified Diff: services/resource_coordinator/memory/coordinator/coordinator_impl.cc

Issue 2690143004: NOCOMMIT: Rebased https://codereview.chromium.org/2696503004 on service rename
Patch Set: Rebase Created 3 years, 10 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
Index: services/resource_coordinator/memory/coordinator/coordinator_impl.cc
diff --git a/services/resource_coordinator/memory/coordinator/coordinator_impl.cc b/services/resource_coordinator/memory/coordinator/coordinator_impl.cc
index 5c133f803c472c845b70ba40936c9706365beaa7..9c032d07bed232a2054eb736a2fe09b1559ece7a 100644
--- a/services/resource_coordinator/memory/coordinator/coordinator_impl.cc
+++ b/services/resource_coordinator/memory/coordinator/coordinator_impl.cc
@@ -12,6 +12,7 @@
#include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/memory_dump_manager.h"
#include "base/trace_event/memory_dump_request_args.h"
+#include "services/resource_coordinator/public/cpp/memory/memory_dump_manager_delegate_impl.h"
#include "services/resource_coordinator/public/interfaces/memory/memory_instrumentation.mojom.h"
namespace memory_instrumentation {
@@ -28,16 +29,23 @@ CoordinatorImpl* CoordinatorImpl::GetInstance() {
return g_coordinator.Pointer();
}
-// TODO(chiniforooshan): Initialize the global MemoryDumpManager instance here.
-// This is how the global MemoryDumpManager gets a reference to the delegate on
-// the service (read the browser) process for service process memory dumps. This
-// can be done when the delegate implementation is landed.
-CoordinatorImpl::CoordinatorImpl() : failed_memory_dump_count_(0) {}
+CoordinatorImpl::CoordinatorImpl() : CoordinatorImpl(true) {}
+
+CoordinatorImpl::CoordinatorImpl(bool register_as_process_local_dump_manager)
+ : failed_memory_dump_count_(0) {
+ if (register_as_process_local_dump_manager) {
+ std::unique_ptr<MemoryDumpManagerDelegateImpl> delegate(
+ new MemoryDumpManagerDelegateImpl(this));
+ base::trace_event::MemoryDumpManager::GetInstance()->Initialize(
+ std::move(delegate));
+ }
+}
CoordinatorImpl::~CoordinatorImpl() {}
void CoordinatorImpl::BindCoordinatorRequest(
mojom::CoordinatorRequest request) {
+ DCHECK(thread_checker_.CalledOnValidThread());
bindings_.AddBinding(this, std::move(request));
}

Powered by Google App Engine
This is Rietveld 408576698