graph_impl_util.h 829 B

12345678910111213141516171819202122
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_PERFORMANCE_MANAGER_GRAPH_GRAPH_IMPL_UTIL_H_
  5. #define COMPONENTS_PERFORMANCE_MANAGER_GRAPH_GRAPH_IMPL_UTIL_H_
  6. #include "base/containers/flat_set.h"
  7. namespace performance_manager {
  8. template <typename PublicNodeClass, typename NodeImplClass>
  9. base::flat_set<const PublicNodeClass*> UpcastNodeSet(
  10. const base::flat_set<NodeImplClass*>& node_set) {
  11. // As node_set is a flat_set, its contents are sorted and unique already.
  12. return base::flat_set<const PublicNodeClass*>(
  13. base::sorted_unique, node_set.begin(), node_set.end());
  14. }
  15. } // namespace performance_manager
  16. #endif // COMPONENTS_PERFORMANCE_MANAGER_GRAPH_GRAPH_IMPL_UTIL_H_