[PM] Always create the SystemNode singleton.
The SystemNode singleton is currently created on demand by the first
call to "Graph::FindOrCreateSystemNode". This is problematic because
some policies might register themselves as SystemNodeObserver without
this node ever being created. This CL causes the SystemNode to be
created by default when setting up the graph.
Change-Id: Ibdd9af2821df87e1c18197ad9f424ec69b5d5a8e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2951241
Reviewed-by: Chris Hamilton <[email protected]>
Commit-Queue: Sébastien Marchand <[email protected]>
Cr-Commit-Position: refs/heads/master@{#892575}
diff --git a/components/performance_manager/public/graph/graph.h b/components/performance_manager/public/graph/graph.h
index b48e1a47..86b6a092 100644
--- a/components/performance_manager/public/graph/graph.h
+++ b/components/performance_manager/public/graph/graph.h
@@ -110,14 +110,14 @@
}
// Returns a collection of all known nodes of the given type.
- virtual const SystemNode* FindOrCreateSystemNode() = 0;
+ virtual const SystemNode* GetSystemNode() const = 0;
virtual std::vector<const ProcessNode*> GetAllProcessNodes() const = 0;
virtual std::vector<const FrameNode*> GetAllFrameNodes() const = 0;
virtual std::vector<const PageNode*> GetAllPageNodes() const = 0;
virtual std::vector<const WorkerNode*> GetAllWorkerNodes() const = 0;
- // Returns true if the graph is currently empty.
- virtual bool IsEmpty() const = 0;
+ // Returns true if the graph only contains the default nodes.
+ virtual bool HasOnlySystemNode() const = 0;
// Returns the associated UKM recorder if it is defined.
virtual ukm::UkmRecorder* GetUkmRecorder() const = 0;