blob: ae76e3638950e6b0c6db8da2bac12b179174300c [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"
11
12namespace performance_manager {
13
14class Graph;
15
16// Interface that all nodes must implement.
17// TODO(chrisha): Move NodeTypeEnum to the public interface and expose it here,
18// then add FromNode casts on the public node interfaces.
19class Node {
20 public:
21 Node();
22 virtual ~Node();
23
24 // Returns the graph to which this node belongs.
25 virtual Graph* GetGraph() const = 0;
26
27 // The following functions are implementation detail and should not need to be
28 // used by external clients. They provide the ability to safely downcast to
29 // the underlying implementation.
30 virtual uintptr_t GetImplType() const = 0;
31 virtual const void* GetImpl() const = 0;
32
Chris Hamiltonc2f1bdb2019-08-15 15:10:0133 // Returns the serialization ID of the given |node|. This is a stable and
34 // opaque value that will always refer only to this node, and never be reused
35 // over the lifetime of the browser.
36 // TODO(chrisha): Deprecate this, and move the logic inside of the only
37 // client using it.
38 static int64_t GetSerializationId(const Node* node);
39
Chris Hamilton77da59d2019-06-04 15:59:3240 private:
41 DISALLOW_COPY_AND_ASSIGN(Node);
42};
43
44} // namespace performance_manager
45
Sigurdur Asgeirsson51d9d242019-10-07 20:38:3446#endif // COMPONENTS_PERFORMANCE_MANAGER_PUBLIC_GRAPH_NODE_H_