| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "services/resource_coordinator/coordination_unit/coordination_unit_grap
h_observer.h" | 5 #include "services/resource_coordinator/coordination_unit/coordination_unit_grap
h_observer.h" |
| 6 | 6 |
| 7 #include "services/resource_coordinator/public/cpp/coordination_unit_types.h" | 7 #include "services/resource_coordinator/public/cpp/coordination_unit_types.h" |
| 8 | 8 |
| 9 namespace resource_coordinator { | 9 namespace resource_coordinator { |
| 10 | 10 |
| 11 // Setting filter_ to CoordinationUnitType::kInvalidType bypasses the | 11 CoordinationUnitGraphObserver::CoordinationUnitGraphObserver() = default; |
| 12 // filtering used to determine whether or not | |
| 13 // CoordinationUnitGraphObserver::CoordinationUnitCreated should be invoked | |
| 14 // when a new CoordinationUnitImpl is created in the CoordinationUnitManager. | |
| 15 CoordinationUnitGraphObserver::CoordinationUnitGraphObserver() | |
| 16 : filter_(CoordinationUnitType::kInvalidType) {} | |
| 17 | |
| 18 CoordinationUnitGraphObserver::CoordinationUnitGraphObserver( | |
| 19 CoordinationUnitType filter) | |
| 20 : filter_(filter) {} | |
| 21 | 12 |
| 22 CoordinationUnitGraphObserver::~CoordinationUnitGraphObserver() = default; | 13 CoordinationUnitGraphObserver::~CoordinationUnitGraphObserver() = default; |
| 23 | 14 |
| 24 bool CoordinationUnitGraphObserver::ShouldObserve( | |
| 25 CoordinationUnitImpl* coordination_unit) { | |
| 26 // CoordinationUnitType::kInvalidType overrides filtering. | |
| 27 return filter_ == CoordinationUnitType::kInvalidType || | |
| 28 filter_ == coordination_unit->id().type; | |
| 29 } | |
| 30 | |
| 31 } // namespace resource_coordinator | 15 } // namespace resource_coordinator |
| OLD | NEW |