Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Unified Diff: content/browser/frame_host/frame_tree.h

Issue 1545973002: Remove the is_loading_ field from WebContentsImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase on top of 1605763002 Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/frame_tree.h
diff --git a/content/browser/frame_host/frame_tree.h b/content/browser/frame_host/frame_tree.h
index b2c2681b466d789693193c3d9f45f626f2a6878b..78f9822d9d2bb0b7724176d12294fcd34f8257c9 100644
--- a/content/browser/frame_host/frame_tree.h
+++ b/content/browser/frame_host/frame_tree.h
@@ -41,6 +41,7 @@ class RenderWidgetHostDelegate;
class CONTENT_EXPORT FrameTree {
public:
class NodeRange;
+ class ConstNodeRange;
class CONTENT_EXPORT NodeIterator {
public:
@@ -77,6 +78,41 @@ class CONTENT_EXPORT FrameTree {
FrameTreeNode* const node_to_skip_;
};
+ class CONTENT_EXPORT ConstNodeIterator {
clamy 2016/01/20 13:23:45 FrameTree::IsLoading needs to iterate over the tre
carlosk 2016/01/20 14:05:14 Might be better to land this separately but I don'
carlosk 2016/01/20 14:05:14 I hate the duplication C++ requires for this kind
+ public:
+ ~ConstNodeIterator();
+
+ ConstNodeIterator& operator++();
+
+ bool operator==(const ConstNodeIterator& rhs) const;
+ bool operator!=(const ConstNodeIterator& rhs) const {
+ return !(*this == rhs);
+ }
+
+ const FrameTreeNode* operator*() { return current_node_; }
+
+ private:
+ friend class ConstNodeRange;
+
+ ConstNodeIterator(const FrameTreeNode* starting_node);
+
+ const FrameTreeNode* current_node_;
+ std::queue<const FrameTreeNode*> queue_;
+ };
+
+ class CONTENT_EXPORT ConstNodeRange {
+ public:
+ ConstNodeIterator begin();
+ ConstNodeIterator end();
+
+ private:
+ friend class FrameTree;
+
+ ConstNodeRange(const FrameTree* tree);
+
+ const FrameTree* const tree_;
+ };
+
// Each FrameTreeNode will default to using the given |navigator| for
// navigation tasks in the frame.
// A set of delegates are remembered here so that we can create
@@ -109,6 +145,10 @@ class CONTENT_EXPORT FrameTree {
// breadth-first traversal order.
NodeRange Nodes();
+ // Returns a range to iterate over all FrameTreeNodes in the frame tree in
+ // breadth-first traversal order. All FrameTreeNodes returned will be const.
+ ConstNodeRange ConstNodes() const;
+
// Adds a new child frame to the frame tree. |process_id| is required to
// disambiguate |new_routing_id|, and it must match the process of the
// |parent| node. Otherwise no child is added and this method returns false.
@@ -187,7 +227,7 @@ class CONTENT_EXPORT FrameTree {
void ResetLoadProgress();
// Returns true if at least one of the nodes in this FrameTree is loading.
- bool IsLoading();
+ bool IsLoading() const;
// Set page-level focus in all SiteInstances involved in rendering
// this FrameTree, not including the current main frame's

Powered by Google App Engine
This is Rietveld 408576698