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

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

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 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 bdb6376a6942687f54cc3b72f7118ccf9a971cb3..a568a4d7aa086a5cc288737af84a1de267f72041 100644
--- a/components/memory_coordinator/child/child_memory_coordinator_impl.h
+++ b/components/memory_coordinator/child/child_memory_coordinator_impl.h
@@ -8,8 +8,9 @@
#include "base/compiler_specific.h"
#include "base/observer_list_threadsafe.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"
-#include "mojo/public/cpp/bindings/strong_binding.h"
+#include "mojo/public/cpp/bindings/binding.h"
namespace memory_coordinator {
@@ -19,18 +20,27 @@ namespace memory_coordinator {
class ChildMemoryCoordinatorImpl
: NON_EXPORTED_BASE(public mojom::ChildMemoryCoordinator) {
public:
- using ClientList = base::ObserverListThreadSafe<MemoryCoordinatorClient>;
- ChildMemoryCoordinatorImpl(
- mojo::InterfaceRequest<mojom::ChildMemoryCoordinator> request,
- scoped_refptr<ClientList> clients);
+ ChildMemoryCoordinatorImpl();
~ChildMemoryCoordinatorImpl() override;
+ void Bind(mojom::ChildMemoryCoordinatorRequest request);
+
+ // 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;
+ void GetCurrentStateForTesting(
+ const GetCurrentStateForTestingCallback& callback) override;
private:
- mojo::StrongBinding<mojom::ChildMemoryCoordinator> binding_;
+ friend class ChildMemoryCoordinatorImplTest;
+
+ mojo::Binding<mojom::ChildMemoryCoordinator> binding_;
+ using ClientList = base::ObserverListThreadSafe<MemoryCoordinatorClient>;
scoped_refptr<ClientList> clients_;
+ mojom::MemoryState state_ = mojom::MemoryState::UNKNOWN;
DISALLOW_COPY_AND_ASSIGN(ChildMemoryCoordinatorImpl);
};

Powered by Google App Engine
This is Rietveld 408576698