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

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

Issue 2094583002: Add MemoryCoordinator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use feature_list Created 4 years, 6 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.cc
diff --git a/components/memory_coordinator/child/child_memory_coordinator_impl.cc b/components/memory_coordinator/child/child_memory_coordinator_impl.cc
index 75889ed43f66e6463c0e9b3dc0ed578ca745b85b..4f55191cd0f3f767ea20ed3b71b6afb4e12451f4 100644
--- a/components/memory_coordinator/child/child_memory_coordinator_impl.cc
+++ b/components/memory_coordinator/child/child_memory_coordinator_impl.cc
@@ -6,17 +6,31 @@
namespace memory_coordinator {
+// static
+void ChildMemoryCoordinatorImpl::Create(
+ mojo::InterfaceRequest<mojom::ChildMemoryCoordinator> request) {
+ new ChildMemoryCoordinatorImpl(std::move(request), new ClientList);
+}
+
ChildMemoryCoordinatorImpl::ChildMemoryCoordinatorImpl(
mojo::InterfaceRequest<mojom::ChildMemoryCoordinator> request,
scoped_refptr<ClientList> clients)
: binding_(this, std::move(request)),
- clients_(clients) {}
+ clients_(clients) {
+ // TODO(bashi): Add clients (e.g. skia).
chrisha 2016/06/27 20:35:30 Wouldn't it make more sense for clients to add the
bashi 2016/06/27 22:40:23 It was my first attempt. MemoryPressureListener us
+}
ChildMemoryCoordinatorImpl::~ChildMemoryCoordinatorImpl() {}
void ChildMemoryCoordinatorImpl::OnStateChange(mojom::MemoryState state) {
+ state_ = state;
clients_->Notify(FROM_HERE, &MemoryCoordinatorClient::OnMemoryStateChange,
state);
}
+void ChildMemoryCoordinatorImpl::GetCurrentState(
chrisha 2016/06/27 20:35:30 Do we need this call? The state is centrally impos
bashi 2016/06/27 22:40:23 This is for testing. Without it it's hard to make
+ const GetCurrentStateCallback& callback) {
+ callback.Run(state_);
+}
+
} // namespace memory_coordinator

Powered by Google App Engine
This is Rietveld 408576698