[PM] Remove Graph::VisitAll*Nodes()

All the calls are converted to use GetAll*Nodes(), which no longer
incurs a full container copy.

Change-Id: I84680b72243fe092b0607974accab65a3af99a44
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5600070
Commit-Queue: Patrick Monette <[email protected]>
Reviewed-by: Joe Mason <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1311736}
diff --git a/components/performance_manager/public/graph/graph.h b/components/performance_manager/public/graph/graph.h
index 6b83c5b..ed5ca19 100644
--- a/components/performance_manager/public/graph/graph.h
+++ b/components/performance_manager/public/graph/graph.h
@@ -10,7 +10,6 @@
 #include <unordered_set>
 
 #include "base/dcheck_is_on.h"
-#include "base/functional/function_ref.h"
 #include "base/memory/ptr_util.h"
 #include "base/observer_list_types.h"
 #include "components/performance_manager/public/graph/node_set_view.h"
@@ -47,10 +46,6 @@
   using NodeSet = std::unordered_set<const Node*>;
   template <class NodeViewPtr>
   using NodeSetView = NodeSetView<NodeSet, NodeViewPtr>;
-  using FrameNodeVisitor = base::FunctionRef<bool(const FrameNode*)>;
-  using PageNodeVisitor = base::FunctionRef<bool(const PageNode*)>;
-  using ProcessNodeVisitor = base::FunctionRef<bool(const ProcessNode*)>;
-  using WorkerNodeVisitor = base::FunctionRef<bool(const WorkerNode*)>;
 
   Graph();
 
@@ -122,29 +117,12 @@
   // Returns the single system node.
   virtual const SystemNode* GetSystemNode() const = 0;
 
-  // Returns the count of all known nodes of the given type.
-  virtual size_t GetProcessNodeCount() const = 0;
-  virtual size_t GetFrameNodeCount() const = 0;
-  virtual size_t GetPageNodeCount() const = 0;
-  virtual size_t GetWorkerNodeCount() const = 0;
-
-  // Returns a collection of all known nodes of the given type. Note that this
-  // incurs a full container copy of all returned nodes. Please use
-  // VisitAll*Nodes() when that makes sense.
+  // Returns a collection of all known nodes of the given type.
   virtual NodeSetView<const ProcessNode*> GetAllProcessNodes() const = 0;
   virtual NodeSetView<const FrameNode*> GetAllFrameNodes() const = 0;
   virtual NodeSetView<const PageNode*> GetAllPageNodes() const = 0;
   virtual NodeSetView<const WorkerNode*> GetAllWorkerNodes() const = 0;
 
-  // Visits all nodes in the graph of the given type, invoking the provided
-  // `visitor` for each. If the visitor returns false then then the iteration is
-  // halted. The visitor must not modify the graph. Returns true if all calls to
-  // the visitor returned true, false otherwise.
-  virtual bool VisitAllProcessNodes(ProcessNodeVisitor visitor) const = 0;
-  virtual bool VisitAllFrameNodes(FrameNodeVisitor visitor) const = 0;
-  virtual bool VisitAllPageNodes(PageNodeVisitor visitor) const = 0;
-  virtual bool VisitAllWorkerNodes(WorkerNodeVisitor visitor) const = 0;
-
   // Returns true if the graph only contains the default nodes.
   virtual bool HasOnlySystemNode() const = 0;