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

Side by Side Diff: chrome/browser/prerender/prerender_contents.h

Issue 10826110: Modify prerendering to support having multiple session storage namespaces per tab. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_
6 #define CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_
7 7
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // starting a prerender, without actually creating the RenderView. 106 // starting a prerender, without actually creating the RenderView.
107 // |creator_child_id| is the id of the child process that caused the prerender 107 // |creator_child_id| is the id of the child process that caused the prerender
108 // to be created, and is needed so that the prerendered URLs can be sent to it 108 // to be created, and is needed so that the prerendered URLs can be sent to it
109 // so render-initiated navigations will swap in the prerendered page. |size| 109 // so render-initiated navigations will swap in the prerendered page. |size|
110 // indicates the rectangular dimensions that the prerendered page should be. 110 // indicates the rectangular dimensions that the prerendered page should be.
111 // |session_storage_namespace| indicates the namespace that the prerendered 111 // |session_storage_namespace| indicates the namespace that the prerendered
112 // page should be part of. 112 // page should be part of.
113 virtual void StartPrerendering( 113 virtual void StartPrerendering(
114 int creator_child_id, 114 int creator_child_id,
115 const gfx::Size& size, 115 const gfx::Size& size,
116 content::SessionStorageNamespace* session_storage_namespace, 116 const content::SessionStorageNamespaceMap& session_storage_namespace_map,
117 bool is_control_group); 117 bool is_control_group);
118 118
119 // Verifies that the prerendering is not using too many resources, and kills 119 // Verifies that the prerendering is not using too many resources, and kills
120 // it if not. 120 // it if not.
121 void DestroyWhenUsingTooManyResources(); 121 void DestroyWhenUsingTooManyResources();
122 122
123 content::RenderViewHost* GetRenderViewHostMutable(); 123 content::RenderViewHost* GetRenderViewHostMutable();
124 const content::RenderViewHost* GetRenderViewHost() const; 124 const content::RenderViewHost* GetRenderViewHost() const;
125 125
126 string16 title() const { return title_; } 126 string16 title() const { return title_; }
(...skipping 27 matching lines...) Expand all
154 154
155 Origin origin() const { return origin_; } 155 Origin origin() const { return origin_; }
156 uint8 experiment_id() const { return experiment_id_; } 156 uint8 experiment_id() const { return experiment_id_; }
157 157
158 base::TimeTicks load_start_time() const { return load_start_time_; } 158 base::TimeTicks load_start_time() const { return load_start_time_; }
159 159
160 // Indicates whether this prerendered page can be used for the provided 160 // Indicates whether this prerendered page can be used for the provided
161 // |url| and |session_storage_namespace|. 161 // |url| and |session_storage_namespace|.
162 bool Matches( 162 bool Matches(
163 const GURL& url, 163 const GURL& url,
164 const content::SessionStorageNamespace* session_storage_namespace) const; 164 const content::SessionStorageNamespaceMap& session_storage_namespace_map)
165 const;
165 166
166 // content::WebContentsObserver implementation. 167 // content::WebContentsObserver implementation.
167 virtual void DidStopLoading( 168 virtual void DidStopLoading(
168 content::RenderViewHost* render_view_host) OVERRIDE; 169 content::RenderViewHost* render_view_host) OVERRIDE;
169 virtual void DidStartProvisionalLoadForFrame( 170 virtual void DidStartProvisionalLoadForFrame(
170 int64 frame_id, 171 int64 frame_id,
171 bool is_main_frame, 172 bool is_main_frame,
172 const GURL& validated_url, 173 const GURL& validated_url,
173 bool is_error_page, 174 bool is_error_page,
174 content::RenderViewHost* render_view_host) OVERRIDE; 175 content::RenderViewHost* render_view_host) OVERRIDE;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 const content::Referrer& referrer, 241 const content::Referrer& referrer,
241 const gfx::Size& size); 242 const gfx::Size& size);
242 ~PendingPrerenderInfo(); 243 ~PendingPrerenderInfo();
243 244
244 base::WeakPtr<PrerenderHandle> weak_prerender_handle; 245 base::WeakPtr<PrerenderHandle> weak_prerender_handle;
245 GURL url; 246 GURL url;
246 content::Referrer referrer; 247 content::Referrer referrer;
247 gfx::Size size; 248 gfx::Size size;
248 }; 249 };
249 250
251 // TODO(ajwong): These protected virtuals are only around for unittests. Make
252 // them private.
253
250 PrerenderContents(PrerenderManager* prerender_manager, 254 PrerenderContents(PrerenderManager* prerender_manager,
251 PrerenderTracker* prerender_tracker, 255 PrerenderTracker* prerender_tracker,
252 Profile* profile, 256 Profile* profile,
253 const GURL& url, 257 const GURL& url,
254 const content::Referrer& referrer, 258 const content::Referrer& referrer,
255 Origin origin, 259 Origin origin,
256 uint8 experiment_id); 260 uint8 experiment_id);
257 261
258 // Called whenever a RenderViewHost is created for prerendering. Only called 262 // Called whenever a RenderViewHost is created for prerendering. Only called
259 // once the RenderViewHost has a RenderView and RenderWidgetHostView. 263 // once the RenderViewHost has a RenderView and RenderWidgetHostView.
260 virtual void OnRenderViewHostCreated( 264 virtual void OnRenderViewHostCreated(
261 content::RenderViewHost* new_render_view_host); 265 content::RenderViewHost* new_render_view_host);
262 266
263 content::NotificationRegistrar& notification_registrar() { 267 content::NotificationRegistrar& notification_registrar() {
264 return notification_registrar_; 268 return notification_registrar_;
265 } 269 }
266 270
267 const std::vector<PendingPrerenderInfo>& pending_prerenders() const { 271 const std::vector<PendingPrerenderInfo>& pending_prerenders() const {
268 return pending_prerenders_; 272 return pending_prerenders_;
269 } 273 }
270 274
271 bool prerendering_has_been_cancelled() const { 275 bool prerendering_has_been_cancelled() const {
272 return prerendering_has_been_cancelled_; 276 return prerendering_has_been_cancelled_;
273 } 277 }
274 278
275 virtual content::WebContents* CreateWebContents( 279 virtual content::WebContents* CreateWebContents(
276 content::SessionStorageNamespace* session_storage_namespace); 280 const content::SessionStorageNamespaceMap&
281 session_storage_namespace_map);
277 282
278 bool prerendering_has_started_; 283 bool prerendering_has_started_;
279 284
280 // Time at which we started to load the URL. This is used to compute 285 // Time at which we started to load the URL. This is used to compute
281 // the time elapsed from initiating a prerender until the time the 286 // the time elapsed from initiating a prerender until the time the
282 // (potentially only partially) prerendered page is shown to the user. 287 // (potentially only partially) prerendered page is shown to the user.
283 base::TimeTicks load_start_time_; 288 base::TimeTicks load_start_time_;
284 289
285 private: 290 private:
286 class TabContentsDelegateImpl; 291 class TabContentsDelegateImpl;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 int32 page_id_; 328 int32 page_id_;
324 GURL url_; 329 GURL url_;
325 GURL icon_url_; 330 GURL icon_url_;
326 content::NotificationRegistrar notification_registrar_; 331 content::NotificationRegistrar notification_registrar_;
327 332
328 // A vector of URLs that this prerendered page matches against. 333 // A vector of URLs that this prerendered page matches against.
329 // This array can contain more than element as a result of redirects, 334 // This array can contain more than element as a result of redirects,
330 // such as HTTP redirects or javascript redirects. 335 // such as HTTP redirects or javascript redirects.
331 std::vector<GURL> alias_urls_; 336 std::vector<GURL> alias_urls_;
332 337
333 // The session storage namespace id for use in matching. We must save it 338 // The session storage namespace ids for use in matching. We must save it
334 // rather than get it from the RenderViewHost since in the control group 339 // rather than get it from the RenderViewHost since in the control group
335 // we won't have a RenderViewHost. 340 // we won't have a RenderViewHost.
336 int64 session_storage_namespace_id_; 341 std::set<int64> session_storage_namespace_ids_;
337 342
338 bool has_stopped_loading_; 343 bool has_stopped_loading_;
339 344
340 // True when the main frame has finished loading. 345 // True when the main frame has finished loading.
341 bool has_finished_loading_; 346 bool has_finished_loading_;
342 347
343 // This must be the same value as the PrerenderTracker has recorded for 348 // This must be the same value as the PrerenderTracker has recorded for
344 // |this|, when |this| has a RenderView. 349 // |this|, when |this| has a RenderView.
345 FinalStatus final_status_; 350 FinalStatus final_status_;
346 351
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 387
383 // The size of the WebView from the launching page. 388 // The size of the WebView from the launching page.
384 gfx::Size size_; 389 gfx::Size size_;
385 390
386 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); 391 DISALLOW_COPY_AND_ASSIGN(PrerenderContents);
387 }; 392 };
388 393
389 } // namespace prerender 394 } // namespace prerender
390 395
391 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ 396 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_browsertest.cc ('k') | chrome/browser/prerender/prerender_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698