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

Unified Diff: services/resource_coordinator/coordination_unit/coordination_unit_impl.h

Issue 2917793002: [GRC] Coordination Unit Key-Value Storage (Closed)
Patch Set: Fix comments 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
« no previous file with comments | « no previous file | services/resource_coordinator/coordination_unit/coordination_unit_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/resource_coordinator/coordination_unit/coordination_unit_impl.h
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_impl.h b/services/resource_coordinator/coordination_unit/coordination_unit_impl.h
index 6604ec2675924f73f30e8faa26221eb3e1cf968b..46c78b4b68933754f6b927b9f2be4be9664f0489 100644
--- a/services/resource_coordinator/coordination_unit/coordination_unit_impl.h
+++ b/services/resource_coordinator/coordination_unit/coordination_unit_impl.h
@@ -8,9 +8,11 @@
#include <list>
#include <memory>
#include <set>
+#include <unordered_map>
#include <utility>
#include "base/optional.h"
+#include "base/values.h"
#include "mojo/public/cpp/bindings/binding_set.h"
#include "mojo/public/cpp/bindings/interface_request.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
@@ -35,15 +37,27 @@ class CoordinationUnitImpl : public mojom::CoordinationUnit {
void AddChild(const CoordinationUnitID& child_id) override;
void SetCoordinationPolicyCallback(
mojom::CoordinationPolicyCallbackPtr callback) override;
+ void SetProperty(mojom::PropertyPtr property) override;
const CoordinationUnitID& id() const { return id_; }
const std::set<CoordinationUnitImpl*>& children() const { return children_; }
const std::set<CoordinationUnitImpl*>& parents() const { return parents_; }
+ const std::unordered_map<mojom::PropertyType, base::Value>&
+ property_store_for_testing() const {
+ return property_store_;
+ }
static const double kCPUUsageMinimumForTesting;
static const double kCPUUsageUnmeasuredForTesting;
virtual double GetCPUUsageForTesting();
+ // Clear property from internal key-value store
+ void ClearProperty(mojom::PropertyType property);
+ // Retrieve property from internal key-value store
+ base::Value GetProperty(mojom::PropertyType property);
+ // Set property from internal key-value store
+ void SetProperty(mojom::PropertyType property, base::Value value);
+
protected:
const CoordinationUnitID id_;
std::set<CoordinationUnitImpl*> children_;
@@ -60,6 +74,8 @@ class CoordinationUnitImpl : public mojom::CoordinationUnit {
void RecalcCoordinationPolicy();
void UnregisterCoordinationPolicyCallback();
+ std::unordered_map<mojom::PropertyType, base::Value> property_store_;
+
enum StateFlags : uint8_t {
kTestState,
kTabVisible,
« no previous file with comments | « no previous file | services/resource_coordinator/coordination_unit/coordination_unit_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698