| Index: services/resource_coordinator/coordination_unit/coordination_unit_impl.cc
|
| diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_impl.cc b/services/resource_coordinator/coordination_unit/coordination_unit_impl.cc
|
| index 034b9e42aebe4a11c7be689d2194e9590f3955d4..7f37d358d2800c5aca1d9f8033630fc5d3df0c59 100644
|
| --- a/services/resource_coordinator/coordination_unit/coordination_unit_impl.cc
|
| +++ b/services/resource_coordinator/coordination_unit/coordination_unit_impl.cc
|
| @@ -216,4 +216,30 @@ double CoordinationUnitImpl::GetCPUUsageForTesting() {
|
| return kCPUUsageUnmeasuredForTesting;
|
| }
|
|
|
| +base::Value CoordinationUnitImpl::GetProperty(mojom::PropertyType property) {
|
| + auto value_it = property_store_.find(property);
|
| +
|
| + return value_it != property_store_.end() ? value_it->second : base::Value();
|
| +}
|
| +
|
| +void CoordinationUnitImpl::ClearProperty(mojom::PropertyType property) {
|
| + property_store_.erase(property);
|
| +}
|
| +
|
| +void CoordinationUnitImpl::SetProperty(mojom::PropertyPtr property) {
|
| + SetProperty(property->property, *property->value);
|
| +}
|
| +
|
| +void CoordinationUnitImpl::SetProperty(mojom::PropertyType property,
|
| + base::Value value) {
|
| + // setting a property with an empty value is effectively clearing the
|
| + // value from storage
|
| + if (value.IsType(base::Value::Type::NONE)) {
|
| + ClearProperty(property);
|
| + return;
|
| + }
|
| +
|
| + property_store_[property] = value;
|
| +}
|
| +
|
| } // namespace resource_coordinator
|
|
|