blob: 8341d4ac77207f6330719b8c2111e3c9b1b221a7 [file] [log] [blame]
Chris Hamilton77da59d2019-06-04 15:59:321// 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 Asgeirsson51d9d242019-10-07 20:38:345#ifndef COMPONENTS_PERFORMANCE_MANAGER_PUBLIC_GRAPH_NODE_H_
6#define COMPONENTS_PERFORMANCE_MANAGER_PUBLIC_GRAPH_NODE_H_
Chris Hamilton77da59d2019-06-04 15:59:327
8#include <cstdint>
9
10#include "base/macros.h"
Chris Hamiltonf86f6342021-03-30 16:42:3411#include "components/performance_manager/public/graph/node_state.h"
Chris Hamilton77da59d2019-06-04 15:59:3212
13namespace performance_manager {
14
15class 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.
20class Node {
21 public:
22 Node();
Peter Boström09c01822021-09-20 22:43:2723
24 Node(const Node&) = delete;
25 Node& operator=(const Node&) = delete;
26
Chris Hamilton77da59d2019-06-04 15:59:3227 virtual ~Node();
28
29 // Returns the graph to which this node belongs.
30 virtual Graph* GetGraph() const = 0;
31
Chris Hamiltonf86f6342021-03-30 16:42:3432 // Returns the state of this node.
33 virtual NodeState GetNodeState() const = 0;
34
Chris Hamilton77da59d2019-06-04 15:59:3235 // 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 Hamilton77da59d2019-06-04 15:59:3240};
41
42} // namespace performance_manager
43
Sigurdur Asgeirsson51d9d242019-10-07 20:38:3444#endif // COMPONENTS_PERFORMANCE_MANAGER_PUBLIC_GRAPH_NODE_H_