Chris Hamilton | 77da59d | 2019-06-04 15:59:32 | [diff] [blame] | 1 | // Copyright 2019 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 | |
Sigurdur Asgeirsson | 51d9d24 | 2019-10-07 20:38:34 | [diff] [blame] | 5 | #ifndef COMPONENTS_PERFORMANCE_MANAGER_PUBLIC_GRAPH_NODE_H_ |
| 6 | #define COMPONENTS_PERFORMANCE_MANAGER_PUBLIC_GRAPH_NODE_H_ |
Chris Hamilton | 77da59d | 2019-06-04 15:59:32 | [diff] [blame] | 7 | |
| 8 | #include <cstdint> |
| 9 | |
| 10 | #include "base/macros.h" |
Chris Hamilton | f86f634 | 2021-03-30 16:42:34 | [diff] [blame] | 11 | #include "components/performance_manager/public/graph/node_state.h" |
Chris Hamilton | 77da59d | 2019-06-04 15:59:32 | [diff] [blame] | 12 | |
| 13 | namespace performance_manager { |
| 14 | |
| 15 | class Graph; |
| 16 | |
| 17 | // Interface that all nodes must implement. |
| 18 | // TODO(chrisha): Move NodeTypeEnum to the public interface and expose it here, |
| 19 | // then add FromNode casts on the public node interfaces. |
| 20 | class Node { |
| 21 | public: |
| 22 | Node(); |
Peter Boström | 09c0182 | 2021-09-20 22:43:27 | [diff] [blame^] | 23 | |
| 24 | Node(const Node&) = delete; |
| 25 | Node& operator=(const Node&) = delete; |
| 26 | |
Chris Hamilton | 77da59d | 2019-06-04 15:59:32 | [diff] [blame] | 27 | virtual ~Node(); |
| 28 | |
| 29 | // Returns the graph to which this node belongs. |
| 30 | virtual Graph* GetGraph() const = 0; |
| 31 | |
Chris Hamilton | f86f634 | 2021-03-30 16:42:34 | [diff] [blame] | 32 | // Returns the state of this node. |
| 33 | virtual NodeState GetNodeState() const = 0; |
| 34 | |
Chris Hamilton | 77da59d | 2019-06-04 15:59:32 | [diff] [blame] | 35 | // The following functions are implementation detail and should not need to be |
| 36 | // used by external clients. They provide the ability to safely downcast to |
| 37 | // the underlying implementation. |
| 38 | virtual uintptr_t GetImplType() const = 0; |
| 39 | virtual const void* GetImpl() const = 0; |
Chris Hamilton | 77da59d | 2019-06-04 15:59:32 | [diff] [blame] | 40 | }; |
| 41 | |
| 42 | } // namespace performance_manager |
| 43 | |
Sigurdur Asgeirsson | 51d9d24 | 2019-10-07 20:38:34 | [diff] [blame] | 44 | #endif // COMPONENTS_PERFORMANCE_MANAGER_PUBLIC_GRAPH_NODE_H_ |