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

Unified Diff: services/resource_coordinator/public/cpp/resource_coordinator_interface.cc

Issue 2929883002: [GRC] ResourceCoordinatorInterface support to remove children (Closed)
Patch Set: Address reviewer feedback Created 3 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: services/resource_coordinator/public/cpp/resource_coordinator_interface.cc
diff --git a/services/resource_coordinator/public/cpp/resource_coordinator_interface.cc b/services/resource_coordinator/public/cpp/resource_coordinator_interface.cc
index 0ba8e0be9413e1b872a7f7967405d367e86ce0c0..7c76ac3c28d8070394b838df619a98c867895e30 100644
--- a/services/resource_coordinator/public/cpp/resource_coordinator_interface.cc
+++ b/services/resource_coordinator/public/cpp/resource_coordinator_interface.cc
@@ -4,6 +4,8 @@
#include "services/resource_coordinator/public/cpp/resource_coordinator_interface.h"
+#include <utility>
+
#include "mojo/public/cpp/bindings/binding.h"
#include "services/resource_coordinator/public/interfaces/coordination_unit_provider.mojom.h"
#include "services/resource_coordinator/public/interfaces/service_constants.mojom.h"
@@ -82,4 +84,21 @@ void ResourceCoordinatorInterface::AddChildByID(
service_->AddChild(child_id);
}
+void ResourceCoordinatorInterface::RemoveChild(
+ const ResourceCoordinatorInterface& child) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK(service_);
+ // We could keep the ID around ourselves, but this hop ensures that the child
+ // has been created on the service-side.
+ child.service()->GetID(
+ base::Bind(&ResourceCoordinatorInterface::RemoveChildByID,
+ weak_ptr_factory_.GetWeakPtr()));
+}
+
+void ResourceCoordinatorInterface::RemoveChildByID(
+ const CoordinationUnitID& child_id) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ service_->RemoveChild(child_id);
+}
+
} // namespace resource_coordinator

Powered by Google App Engine
This is Rietveld 408576698