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

Unified Diff: components/memory_coordinator/child/child_memory_coordinator_impl.h

Issue 2144163002: Extract client handing from ChildMemoryCoordinatorImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mc-2-notify
Patch Set: rebase 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 side-by-side diff with in-line comments
Download patch
Index: components/memory_coordinator/child/child_memory_coordinator_impl.h
diff --git a/components/memory_coordinator/child/child_memory_coordinator_impl.h b/components/memory_coordinator/child/child_memory_coordinator_impl.h
index d565d120622e0ee772854b285a4d6cfd4dc10d3b..5daa4053ef027ca94a3143afc72808d2662c7134 100644
--- a/components/memory_coordinator/child/child_memory_coordinator_impl.h
+++ b/components/memory_coordinator/child/child_memory_coordinator_impl.h
@@ -6,7 +6,7 @@
#define COMPONENTS_MEMORY_COORDINATOR_CHILD_CHILD_MEMORY_COORDINATOR_IMPL_H_
#include "base/compiler_specific.h"
-#include "base/observer_list_threadsafe.h"
+#include "components/memory_coordinator/common/client_registry.h"
#include "components/memory_coordinator/common/memory_coordinator_client.h"
#include "components/memory_coordinator/common/memory_coordinator_features.h"
#include "components/memory_coordinator/public/interfaces/child_memory_coordinator.mojom.h"
@@ -19,15 +19,12 @@ namespace memory_coordinator {
// It lives in child processes and is responsible for dispatching memory events
// to its clients.
class ChildMemoryCoordinatorImpl
- : NON_EXPORTED_BASE(public mojom::ChildMemoryCoordinator) {
+ : public ClientRegistry,
+ NON_EXPORTED_BASE(public mojom::ChildMemoryCoordinator) {
public:
explicit ChildMemoryCoordinatorImpl(mojom::MemoryCoordinatorHandlePtr parent);
~ChildMemoryCoordinatorImpl() override;
- // Registers/unregisters a client. Does not take ownership of client.
- void RegisterClient(MemoryCoordinatorClient* client);
- void UnregisterClient(MemoryCoordinatorClient* client);
-
// mojom::ChildMemoryCoordinator implementations:
void OnStateChange(mojom::MemoryState state) override;
@@ -35,8 +32,6 @@ class ChildMemoryCoordinatorImpl
friend class ChildMemoryCoordinatorImplTest;
mojo::Binding<mojom::ChildMemoryCoordinator> binding_;
- using ClientList = base::ObserverListThreadSafe<MemoryCoordinatorClient>;
- scoped_refptr<ClientList> clients_;
mojom::MemoryCoordinatorHandlePtr parent_;
DISALLOW_COPY_AND_ASSIGN(ChildMemoryCoordinatorImpl);

Powered by Google App Engine
This is Rietveld 408576698