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

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

Issue 1889583003: Revert of OOPIF: Fix subframe back/forward after recreating FTNs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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|, based on 40 // Returns whether this TreeNode corresponds to |frame_tree_node|.
41 // the FrameTreeNode ID or unique name. If the unique name matches and 41 bool MatchesFrame(FrameTreeNode* frame_tree_node) const;
42 // FrameTreeNode ID does not, then this will update the entry's
43 // FrameTreeNode ID (which may be stale if the node was recreated).
44 bool MatchesFrame(FrameTreeNode* frame_tree_node);
45 42
46 // Recursively makes a deep copy of TreeNode with copies of each of the 43 // Recursively makes a deep copy of TreeNode with copies of each of the
47 // FrameNavigationEntries in the subtree. Replaces the TreeNode 44 // FrameNavigationEntries in the subtree. Replaces the TreeNode
48 // corresponding to |frame_tree_node| (and all of its children) with a new 45 // corresponding to |frame_tree_node| (and all of its children) with a new
49 // TreeNode for |frame_navigation_entry|. Pass nullptr for both parameters 46 // TreeNode for |frame_navigation_entry|. Pass nullptr for both parameters
50 // to make a complete clone. 47 // to make a complete clone.
51 // TODO(creis): For --site-per-process, share FrameNavigationEntries between 48 // TODO(creis): For --site-per-process, share FrameNavigationEntries between
52 // NavigationEntries of the same tab. 49 // NavigationEntries of the same tab.
53 std::unique_ptr<TreeNode> CloneAndReplace( 50 std::unique_ptr<TreeNode> CloneAndReplace(
54 FrameTreeNode* frame_tree_node, 51 FrameTreeNode* frame_tree_node,
55 FrameNavigationEntry* frame_navigation_entry); 52 FrameNavigationEntry* frame_navigation_entry) const;
56 53
57 // Ref counted pointer that keeps the FrameNavigationEntry alive as long as 54 // Ref counted pointer that keeps the FrameNavigationEntry alive as long as
58 // it is needed by this node's NavigationEntry. 55 // it is needed by this node's NavigationEntry.
59 scoped_refptr<FrameNavigationEntry> frame_entry; 56 scoped_refptr<FrameNavigationEntry> frame_entry;
60 57
61 // List of child TreeNodes, which will be deleted when this node is. 58 // List of child TreeNodes, which will be deleted when this node is.
62 ScopedVector<TreeNode> children; 59 ScopedVector<TreeNode> children;
63 }; 60 };
64 61
65 static NavigationEntryImpl* FromNavigationEntry(NavigationEntry* entry); 62 static NavigationEntryImpl* FromNavigationEntry(NavigationEntry* entry);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 return frame_tree_.get(); 181 return frame_tree_.get();
185 } 182 }
186 183
187 // Finds the TreeNode associated with |frame_tree_node_id| to add or update 184 // Finds the TreeNode associated with |frame_tree_node_id| to add or update
188 // its FrameNavigationEntry. A new FrameNavigationEntry is added if none 185 // its FrameNavigationEntry. A new FrameNavigationEntry is added if none
189 // exists, or else the existing one (which might be shared with other 186 // exists, or else the existing one (which might be shared with other
190 // NavigationEntries) is updated with the given parameters. 187 // NavigationEntries) is updated with the given parameters.
191 // Does nothing if there is no entry already and |url| is about:blank, since 188 // Does nothing if there is no entry already and |url| is about:blank, since
192 // that does not count as a real commit. 189 // that does not count as a real commit.
193 void AddOrUpdateFrameEntry(FrameTreeNode* frame_tree_node, 190 void AddOrUpdateFrameEntry(FrameTreeNode* frame_tree_node,
191 const std::string& frame_unique_name,
194 int64_t item_sequence_number, 192 int64_t item_sequence_number,
195 int64_t document_sequence_number, 193 int64_t document_sequence_number,
196 SiteInstanceImpl* site_instance, 194 SiteInstanceImpl* site_instance,
197 const GURL& url, 195 const GURL& url,
198 const Referrer& referrer, 196 const Referrer& referrer,
199 const PageState& page_state); 197 const PageState& page_state);
200 198
201 // Returns the FrameNavigationEntry corresponding to |frame_tree_node|, if 199 // Returns the FrameNavigationEntry corresponding to |frame_tree_node|, if
202 // there is one in this NavigationEntry. This compares against the 200 // there is one in this NavigationEntry.
203 // FrameTreeNode ID first, and if that doesn't match, then the unique_name. 201 FrameNavigationEntry* GetFrameEntry(FrameTreeNode* frame_tree_node) const;
204 // It will update the FrameNavigationEntry's FrameTreeNode ID if it is stale. 202
205 FrameNavigationEntry* GetFrameEntry(FrameTreeNode* frame_tree_node); 203 // Returns the FrameNavigationEntry corresponding to the frame with the given
204 // |unique_name|, if any. This is useful when the FrameTreeNode cannot be used
205 // to find the entry, such as for a newly created subframe in a history
206 // navigation. Callers should update the FrameTreeNode ID of the entry so that
207 // it can be found with |GetFrameEntry| above.
208 // TODO(creis): Generate or verify the unique_name in the browser process.
209 FrameNavigationEntry* GetFrameEntryByUniqueName(
210 const std::string& unique_name) const;
206 211
207 void set_unique_id(int unique_id) { 212 void set_unique_id(int unique_id) {
208 unique_id_ = unique_id; 213 unique_id_ = unique_id;
209 } 214 }
210 215
211 // The SiteInstance represents which pages must share processes. This is a 216 // The SiteInstance represents which pages must share processes. This is a
212 // reference counted pointer to a shared SiteInstance. 217 // reference counted pointer to a shared SiteInstance.
213 // 218 //
214 // Note that the SiteInstance should usually not be changed after it is set, 219 // Note that the SiteInstance should usually not be changed after it is set,
215 // but this may happen if the NavigationEntry was cloned and needs to use a 220 // but this may happen if the NavigationEntry was cloned and needs to use a
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 return has_user_gesture_; 357 return has_user_gesture_;
353 } 358 }
354 359
355 void set_has_user_gesture (bool has_user_gesture) { 360 void set_has_user_gesture (bool has_user_gesture) {
356 has_user_gesture_ = has_user_gesture; 361 has_user_gesture_ = has_user_gesture;
357 } 362 }
358 #endif 363 #endif
359 364
360 private: 365 private:
361 // Finds the TreeNode associated with |frame_tree_node|, if any. 366 // Finds the TreeNode associated with |frame_tree_node|, if any.
362 NavigationEntryImpl::TreeNode* FindFrameEntry(FrameTreeNode* frame_tree_node); 367 NavigationEntryImpl::TreeNode* FindFrameEntry(
368 FrameTreeNode* frame_tree_node) const;
363 369
364 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING 370 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
365 // Session/Tab restore save portions of this class so that it can be recreated 371 // Session/Tab restore save portions of this class so that it can be recreated
366 // later. If you add a new field that needs to be persisted you'll have to 372 // later. If you add a new field that needs to be persisted you'll have to
367 // update SessionService/TabRestoreService and Android WebView 373 // update SessionService/TabRestoreService and Android WebView
368 // state_serializer.cc appropriately. 374 // state_serializer.cc appropriately.
369 // For all new fields, update |Clone| and possibly |ResetForCommit|. 375 // For all new fields, update |Clone| and possibly |ResetForCommit|.
370 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING 376 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
371 377
372 // Tree of FrameNavigationEntries, one for each frame on the page. 378 // Tree of FrameNavigationEntries, one for each frame on the page.
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 // persisted, unless specific data is taken out/put back in at save/restore 502 // persisted, unless specific data is taken out/put back in at save/restore
497 // time (see TabNavigation for an example of this). 503 // time (see TabNavigation for an example of this).
498 std::map<std::string, base::string16> extra_data_; 504 std::map<std::string, base::string16> extra_data_;
499 505
500 DISALLOW_COPY_AND_ASSIGN(NavigationEntryImpl); 506 DISALLOW_COPY_AND_ASSIGN(NavigationEntryImpl);
501 }; 507 };
502 508
503 } // namespace content 509 } // namespace content
504 510
505 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_H_ 511 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698