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(); |
| 23 | virtual ~Node(); |
| 24 | |
| 25 | // Returns the graph to which this node belongs. |
| 26 | virtual Graph* GetGraph() const = 0; |
| 27 | |
Chris Hamilton | f86f634 | 2021-03-30 16:42:34 | [diff] [blame] | 28 | // Returns the state of this node. |
| 29 | virtual NodeState GetNodeState() const = 0; |
| 30 | |
Chris Hamilton | 77da59d | 2019-06-04 15:59:32 | [diff] [blame] | 31 | // The following functions are implementation detail and should not need to be |
| 32 | // used by external clients. They provide the ability to safely downcast to |
| 33 | // the underlying implementation. |
| 34 | virtual uintptr_t GetImplType() const = 0; |
| 35 | virtual const void* GetImpl() const = 0; |
| 36 | |
Chris Hamilton | 77da59d | 2019-06-04 15:59:32 | [diff] [blame] | 37 | private: |
| 38 | DISALLOW_COPY_AND_ASSIGN(Node); |
| 39 | }; |
| 40 | |
| 41 | } // namespace performance_manager |
| 42 | |
Sigurdur Asgeirsson | 51d9d24 | 2019-10-07 20:38:34 | [diff] [blame] | 43 | #endif // COMPONENTS_PERFORMANCE_MANAGER_PUBLIC_GRAPH_NODE_H_ |