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

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

Issue 1944013003: Move ownership of source SiteInstance to the FrameNavigationEntry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another round of review comments addressed. 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
« no previous file with comments | « no previous file | content/browser/frame_host/frame_navigation_entry.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_FRAME_NAVIGATION_ENTRY_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_FRAME_NAVIGATION_ENTRY_H_
6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_NAVIGATION_ENTRY_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_NAVIGATION_ENTRY_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 16 matching lines...) Expand all
27 // TODO(creis): Share these FrameNavigationEntries across NavigationEntries if 27 // TODO(creis): Share these FrameNavigationEntries across NavigationEntries if
28 // the frame hasn't changed. 28 // the frame hasn't changed.
29 class CONTENT_EXPORT FrameNavigationEntry 29 class CONTENT_EXPORT FrameNavigationEntry
30 : public base::RefCounted<FrameNavigationEntry> { 30 : public base::RefCounted<FrameNavigationEntry> {
31 public: 31 public:
32 FrameNavigationEntry(); 32 FrameNavigationEntry();
33 FrameNavigationEntry(const std::string& frame_unique_name, 33 FrameNavigationEntry(const std::string& frame_unique_name,
34 int64_t item_sequence_number, 34 int64_t item_sequence_number,
35 int64_t document_sequence_number, 35 int64_t document_sequence_number,
36 scoped_refptr<SiteInstanceImpl> site_instance, 36 scoped_refptr<SiteInstanceImpl> site_instance,
37 scoped_refptr<SiteInstanceImpl> source_site_instance,
37 const GURL& url, 38 const GURL& url,
38 const Referrer& referrer, 39 const Referrer& referrer,
39 const std::string& method, 40 const std::string& method,
40 int64_t post_id); 41 int64_t post_id);
41 42
42 // Creates a copy of this FrameNavigationEntry that can be modified 43 // Creates a copy of this FrameNavigationEntry that can be modified
43 // independently from the original. 44 // independently from the original.
44 FrameNavigationEntry* Clone() const; 45 FrameNavigationEntry* Clone() const;
45 46
46 // Updates all the members of this entry. 47 // Updates all the members of this entry.
47 void UpdateEntry(const std::string& frame_unique_name, 48 void UpdateEntry(const std::string& frame_unique_name,
48 int64_t item_sequence_number, 49 int64_t item_sequence_number,
49 int64_t document_sequence_number, 50 int64_t document_sequence_number,
50 SiteInstanceImpl* site_instance, 51 SiteInstanceImpl* site_instance,
52 scoped_refptr<SiteInstanceImpl> source_site_instance,
51 const GURL& url, 53 const GURL& url,
52 const Referrer& referrer, 54 const Referrer& referrer,
53 const PageState& page_state, 55 const PageState& page_state,
54 const std::string& method, 56 const std::string& method,
55 int64_t post_id); 57 int64_t post_id);
56 58
57 // The unique name of the frame this entry is for. This is a stable name for 59 // The unique name of the frame this entry is for. This is a stable name for
58 // the frame based on its position in the tree and relation to other named 60 // the frame based on its position in the tree and relation to other named
59 // frames, which does not change after cross-process navigations or restores. 61 // frames, which does not change after cross-process navigations or restores.
60 // Only the main frame can have an empty name. 62 // Only the main frame can have an empty name.
(...skipping 18 matching lines...) Expand all
79 81
80 // The SiteInstance responsible for rendering this frame. All frames sharing 82 // The SiteInstance responsible for rendering this frame. All frames sharing
81 // a SiteInstance must live in the same process. This is a refcounted pointer 83 // a SiteInstance must live in the same process. This is a refcounted pointer
82 // that keeps the SiteInstance (not necessarily the process) alive as long as 84 // that keeps the SiteInstance (not necessarily the process) alive as long as
83 // this object remains in the session history. 85 // this object remains in the session history.
84 void set_site_instance(scoped_refptr<SiteInstanceImpl> site_instance) { 86 void set_site_instance(scoped_refptr<SiteInstanceImpl> site_instance) {
85 site_instance_ = std::move(site_instance); 87 site_instance_ = std::move(site_instance);
86 } 88 }
87 SiteInstanceImpl* site_instance() const { return site_instance_.get(); } 89 SiteInstanceImpl* site_instance() const { return site_instance_.get(); }
88 90
91 // The |source_site_instance| is used to identify the SiteInstance of the
92 // frame that initiated the navigation. It is present only for
93 // renderer-initiated navigations and is cleared once the navigation has
94 // committed.
95 void set_source_site_instance(
96 scoped_refptr<SiteInstanceImpl> source_site_instance) {
97 source_site_instance_ = std::move(source_site_instance);
98 }
99 SiteInstanceImpl* source_site_instance() const {
100 return source_site_instance_.get();
101 }
102
89 // The actual URL loaded in the frame. This is in contrast to the virtual 103 // The actual URL loaded in the frame. This is in contrast to the virtual
90 // URL, which is shown to the user. 104 // URL, which is shown to the user.
91 void set_url(const GURL& url) { url_ = url; } 105 void set_url(const GURL& url) { url_ = url; }
92 const GURL& url() const { return url_; } 106 const GURL& url() const { return url_; }
93 107
94 // The referring URL. Can be empty. 108 // The referring URL. Can be empty.
95 void set_referrer(const Referrer& referrer) { referrer_ = referrer; } 109 void set_referrer(const Referrer& referrer) { referrer_ = referrer; }
96 const Referrer& referrer() const { return referrer_; } 110 const Referrer& referrer() const { return referrer_; }
97 111
98 void set_page_state(const PageState& page_state) { page_state_ = page_state; } 112 void set_page_state(const PageState& page_state) { page_state_ = page_state; }
(...skipping 16 matching lines...) Expand all
115 // Add all new fields to |UpdateEntry|. 129 // Add all new fields to |UpdateEntry|.
116 // TODO(creis): These fields have implications for session restore. This is 130 // TODO(creis): These fields have implications for session restore. This is
117 // currently managed by NavigationEntry, but the logic will move here. 131 // currently managed by NavigationEntry, but the logic will move here.
118 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING 132 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
119 133
120 // See the accessors above for descriptions. 134 // See the accessors above for descriptions.
121 std::string frame_unique_name_; 135 std::string frame_unique_name_;
122 int64_t item_sequence_number_; 136 int64_t item_sequence_number_;
123 int64_t document_sequence_number_; 137 int64_t document_sequence_number_;
124 scoped_refptr<SiteInstanceImpl> site_instance_; 138 scoped_refptr<SiteInstanceImpl> site_instance_;
139 // This member is cleared at commit time and is not persisted.
140 scoped_refptr<SiteInstanceImpl> source_site_instance_;
125 GURL url_; 141 GURL url_;
126 Referrer referrer_; 142 Referrer referrer_;
127 // TODO(creis): Change this to FrameState. 143 // TODO(creis): Change this to FrameState.
128 PageState page_state_; 144 PageState page_state_;
129 std::string method_; 145 std::string method_;
130 int64_t post_id_; 146 int64_t post_id_;
131 147
132 DISALLOW_COPY_AND_ASSIGN(FrameNavigationEntry); 148 DISALLOW_COPY_AND_ASSIGN(FrameNavigationEntry);
133 }; 149 };
134 150
135 } // namespace content 151 } // namespace content
136 152
137 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_NAVIGATION_ENTRY_H_ 153 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_NAVIGATION_ENTRY_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/frame_navigation_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698