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

Side by Side Diff: content/browser/frame_host/navigation_entry_impl.h

Issue 1906213003: OOPIF: Fix subframe back/forward after recreating FTNs (try #2). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_H_
6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 19 matching lines...) Expand all
30 class CONTENT_EXPORT NavigationEntryImpl 30 class CONTENT_EXPORT NavigationEntryImpl
31 : public NON_EXPORTED_BASE(NavigationEntry) { 31 : public NON_EXPORTED_BASE(NavigationEntry) {
32 public: 32 public:
33 // Represents a tree of FrameNavigationEntries that make up this joint session 33 // Represents a tree of FrameNavigationEntries that make up this joint session
34 // history item. The tree currently only tracks the main frame by default, 34 // history item. The tree currently only tracks the main frame by default,
35 // and is populated with subframe nodes in --site-per-process mode. 35 // and is populated with subframe nodes in --site-per-process mode.
36 struct TreeNode { 36 struct TreeNode {
37 TreeNode(FrameNavigationEntry* frame_entry); 37 TreeNode(FrameNavigationEntry* frame_entry);
38 ~TreeNode(); 38 ~TreeNode();
39 39
40 // Returns whether this TreeNode corresponds to |frame_tree_node|. 40 // Returns whether this TreeNode corresponds to |frame_tree_node|. If this
41 bool MatchesFrame(FrameTreeNode* frame_tree_node) const; 41 // is called on the root TreeNode, then |is_root_tree_node| should be true
42 // and we only check if |frame_tree_node| is the main frame. Otherwise, we
43 // check if the unique name matches.
44 bool MatchesFrame(FrameTreeNode* frame_tree_node,
45 bool is_root_tree_node) const;
42 46
43 // Recursively makes a deep copy of TreeNode with copies of each of the 47 // Recursively makes a deep copy of TreeNode with copies of each of the
44 // FrameNavigationEntries in the subtree. Replaces the TreeNode 48 // FrameNavigationEntries in the subtree. Replaces the TreeNode
45 // corresponding to |frame_tree_node| (and all of its children) with a new 49 // corresponding to |frame_tree_node| (and all of its children) with a new
46 // TreeNode for |frame_navigation_entry|. Pass nullptr for both parameters 50 // TreeNode for |frame_navigation_entry|. Pass nullptr for both parameters
47 // to make a complete clone. 51 // to make a complete clone.
52 // |is_root_tree_node| indicates whether this is being called on the root
53 // NavigationEntryImpl::TreeNode.
48 // TODO(creis): For --site-per-process, share FrameNavigationEntries between 54 // TODO(creis): For --site-per-process, share FrameNavigationEntries between
49 // NavigationEntries of the same tab. 55 // NavigationEntries of the same tab.
50 std::unique_ptr<TreeNode> CloneAndReplace( 56 std::unique_ptr<TreeNode> CloneAndReplace(
51 FrameTreeNode* frame_tree_node, 57 FrameTreeNode* frame_tree_node,
52 FrameNavigationEntry* frame_navigation_entry) const; 58 FrameNavigationEntry* frame_navigation_entry,
59 bool is_root_tree_node) const;
53 60
54 // Ref counted pointer that keeps the FrameNavigationEntry alive as long as 61 // Ref counted pointer that keeps the FrameNavigationEntry alive as long as
55 // it is needed by this node's NavigationEntry. 62 // it is needed by this node's NavigationEntry.
56 scoped_refptr<FrameNavigationEntry> frame_entry; 63 scoped_refptr<FrameNavigationEntry> frame_entry;
57 64
58 // List of child TreeNodes, which will be deleted when this node is. 65 // List of child TreeNodes, which will be deleted when this node is.
59 ScopedVector<TreeNode> children; 66 ScopedVector<TreeNode> children;
60 }; 67 };
61 68
62 static NavigationEntryImpl* FromNavigationEntry(NavigationEntry* entry); 69 static NavigationEntryImpl* FromNavigationEntry(NavigationEntry* entry);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 return frame_tree_.get(); 188 return frame_tree_.get();
182 } 189 }
183 190
184 // Finds the TreeNode associated with |frame_tree_node_id| to add or update 191 // Finds the TreeNode associated with |frame_tree_node_id| to add or update
185 // its FrameNavigationEntry. A new FrameNavigationEntry is added if none 192 // its FrameNavigationEntry. A new FrameNavigationEntry is added if none
186 // exists, or else the existing one (which might be shared with other 193 // exists, or else the existing one (which might be shared with other
187 // NavigationEntries) is updated with the given parameters. 194 // NavigationEntries) is updated with the given parameters.
188 // Does nothing if there is no entry already and |url| is about:blank, since 195 // Does nothing if there is no entry already and |url| is about:blank, since
189 // that does not count as a real commit. 196 // that does not count as a real commit.
190 void AddOrUpdateFrameEntry(FrameTreeNode* frame_tree_node, 197 void AddOrUpdateFrameEntry(FrameTreeNode* frame_tree_node,
191 const std::string& frame_unique_name,
192 int64_t item_sequence_number, 198 int64_t item_sequence_number,
193 int64_t document_sequence_number, 199 int64_t document_sequence_number,
194 SiteInstanceImpl* site_instance, 200 SiteInstanceImpl* site_instance,
195 const GURL& url, 201 const GURL& url,
196 const Referrer& referrer, 202 const Referrer& referrer,
197 const PageState& page_state, 203 const PageState& page_state,
198 const std::string& method, 204 const std::string& method,
199 int64_t post_id); 205 int64_t post_id);
200 206
201 // Returns the FrameNavigationEntry corresponding to |frame_tree_node|, if 207 // Returns the FrameNavigationEntry corresponding to |frame_tree_node|, if
202 // there is one in this NavigationEntry. 208 // there is one in this NavigationEntry.
203 FrameNavigationEntry* GetFrameEntry(FrameTreeNode* frame_tree_node) const; 209 FrameNavigationEntry* GetFrameEntry(FrameTreeNode* frame_tree_node) const;
204 210
205 // Returns the FrameNavigationEntry corresponding to the frame with the given
206 // |unique_name|, if any. This is useful when the FrameTreeNode cannot be used
207 // to find the entry, such as for a newly created subframe in a history
208 // navigation. Callers should update the FrameTreeNode ID of the entry so that
209 // it can be found with |GetFrameEntry| above.
210 // TODO(creis): Generate or verify the unique_name in the browser process.
211 FrameNavigationEntry* GetFrameEntryByUniqueName(
212 const std::string& unique_name) const;
213
214 void set_unique_id(int unique_id) { 211 void set_unique_id(int unique_id) {
215 unique_id_ = unique_id; 212 unique_id_ = unique_id;
216 } 213 }
217 214
218 // The SiteInstance represents which pages must share processes. This is a 215 // The SiteInstance represents which pages must share processes. This is a
219 // reference counted pointer to a shared SiteInstance. 216 // reference counted pointer to a shared SiteInstance.
220 // 217 //
221 // Note that the SiteInstance should usually not be changed after it is set, 218 // Note that the SiteInstance should usually not be changed after it is set,
222 // but this may happen if the NavigationEntry was cloned and needs to use a 219 // but this may happen if the NavigationEntry was cloned and needs to use a
223 // different SiteInstance. 220 // different SiteInstance.
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 // persisted, unless specific data is taken out/put back in at save/restore 499 // persisted, unless specific data is taken out/put back in at save/restore
503 // time (see TabNavigation for an example of this). 500 // time (see TabNavigation for an example of this).
504 std::map<std::string, base::string16> extra_data_; 501 std::map<std::string, base::string16> extra_data_;
505 502
506 DISALLOW_COPY_AND_ASSIGN(NavigationEntryImpl); 503 DISALLOW_COPY_AND_ASSIGN(NavigationEntryImpl);
507 }; 504 };
508 505
509 } // namespace content 506 } // namespace content
510 507
511 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_H_ 508 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_controller_impl_unittest.cc ('k') | content/browser/frame_host/navigation_entry_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698