| Index: services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.cc
|
| diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.cc b/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c4214ebfa61ed72df2806fadc29e666093856537
|
| --- /dev/null
|
| +++ b/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.cc
|
| @@ -0,0 +1,31 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h"
|
| +
|
| +#include "services/resource_coordinator/public/cpp/coordination_unit_types.h"
|
| +
|
| +namespace resource_coordinator {
|
| +
|
| +// Setting filter_ to CoordinationUnitType::kInvalidType bypasses the
|
| +// filtering used to determine whether or not
|
| +// CoordinationUnitGraphObserver::CoordinationUnitCreated should be invoked
|
| +// when a new CoordinationUnitImpl is created in the CoordinationUnitManager.
|
| +CoordinationUnitGraphObserver::CoordinationUnitGraphObserver()
|
| + : filter_(CoordinationUnitType::kInvalidType) {}
|
| +
|
| +CoordinationUnitGraphObserver::CoordinationUnitGraphObserver(
|
| + CoordinationUnitType filter)
|
| + : filter_(filter) {}
|
| +
|
| +CoordinationUnitGraphObserver::~CoordinationUnitGraphObserver() = default;
|
| +
|
| +bool CoordinationUnitGraphObserver::ShouldObserve(
|
| + CoordinationUnitImpl* coordination_unit) {
|
| + // CoordinationUnitType::kInvalidType overrides filtering.
|
| + return filter_ == CoordinationUnitType::kInvalidType ||
|
| + filter_ == coordination_unit->id().type;
|
| +}
|
| +
|
| +} // namespace resource_coordinator
|
|
|