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

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

Issue 2554573012: Fix early prerender cancellation not working with PlzNavigate. (Closed)
Patch Set: Created 4 years 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 | chrome/browser/prerender/prerender_handle.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 (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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 228
229 // Called when a PrerenderResourceThrottle defers a request. If the prerender 229 // Called when a PrerenderResourceThrottle defers a request. If the prerender
230 // is used it'll be resumed on the IO thread, otherwise they will get 230 // is used it'll be resumed on the IO thread, otherwise they will get
231 // cancelled automatically if prerendering is cancelled. 231 // cancelled automatically if prerendering is cancelled.
232 void AddResourceThrottle( 232 void AddResourceThrottle(
233 const base::WeakPtr<PrerenderResourceThrottle>& throttle); 233 const base::WeakPtr<PrerenderResourceThrottle>& throttle);
234 234
235 // Increments the number of bytes fetched over the network for this prerender. 235 // Increments the number of bytes fetched over the network for this prerender.
236 void AddNetworkBytes(int64_t bytes); 236 void AddNetworkBytes(int64_t bytes);
237 237
238 bool prerendering_has_been_cancelled() const {
239 return prerendering_has_been_cancelled_;
240 }
241
238 protected: 242 protected:
239 PrerenderContents(PrerenderManager* prerender_manager, 243 PrerenderContents(PrerenderManager* prerender_manager,
240 Profile* profile, 244 Profile* profile,
241 const GURL& url, 245 const GURL& url,
242 const content::Referrer& referrer, 246 const content::Referrer& referrer,
243 Origin origin); 247 Origin origin);
244 248
245 // Set the final status for how the PrerenderContents was used. This 249 // Set the final status for how the PrerenderContents was used. This
246 // should only be called once, and should be called before the prerender 250 // should only be called once, and should be called before the prerender
247 // contents are destroyed. 251 // contents are destroyed.
248 void SetFinalStatus(FinalStatus final_status); 252 void SetFinalStatus(FinalStatus final_status);
249 253
250 // These call out to methods on our Observers, using our observer_list_. Note 254 // These call out to methods on our Observers, using our observer_list_. Note
251 // that NotifyPrerenderStop() also clears the observer list. 255 // that NotifyPrerenderStop() also clears the observer list.
252 void NotifyPrerenderStart(); 256 void NotifyPrerenderStart();
253 void NotifyPrerenderStopLoading(); 257 void NotifyPrerenderStopLoading();
254 void NotifyPrerenderDomContentLoaded(); 258 void NotifyPrerenderDomContentLoaded();
255 void NotifyPrerenderStop(); 259 void NotifyPrerenderStop();
256 260
257 // Called whenever a RenderViewHost is created for prerendering. Only called 261 // Called whenever a RenderViewHost is created for prerendering. Only called
258 // once the RenderViewHost has a RenderView and RenderWidgetHostView. 262 // once the RenderViewHost has a RenderView and RenderWidgetHostView.
259 virtual void OnRenderViewHostCreated( 263 virtual void OnRenderViewHostCreated(
260 content::RenderViewHost* new_render_view_host); 264 content::RenderViewHost* new_render_view_host);
261 265
262 content::NotificationRegistrar& notification_registrar() { 266 content::NotificationRegistrar& notification_registrar() {
263 return notification_registrar_; 267 return notification_registrar_;
264 } 268 }
265 269
266 bool prerendering_has_been_cancelled() const {
267 return prerendering_has_been_cancelled_;
268 }
269
270 content::WebContents* CreateWebContents( 270 content::WebContents* CreateWebContents(
271 content::SessionStorageNamespace* session_storage_namespace); 271 content::SessionStorageNamespace* session_storage_namespace);
272 272
273 PrerenderMode prerender_mode_; 273 PrerenderMode prerender_mode_;
274 bool prerendering_has_started_; 274 bool prerendering_has_started_;
275 275
276 // Time at which we started to load the URL. This is used to compute 276 // Time at which we started to load the URL. This is used to compute
277 // the time elapsed from initiating a prerender until the time the 277 // the time elapsed from initiating a prerender until the time the
278 // (potentially only partially) prerendered page is shown to the user. 278 // (potentially only partially) prerendered page is shown to the user.
279 base::TimeTicks load_start_time_; 279 base::TimeTicks load_start_time_;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 // A running tally of the number of bytes this prerender has caused to be 365 // A running tally of the number of bytes this prerender has caused to be
366 // transferred over the network for resources. Updated with AddNetworkBytes. 366 // transferred over the network for resources. Updated with AddNetworkBytes.
367 int64_t network_bytes_; 367 int64_t network_bytes_;
368 368
369 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); 369 DISALLOW_COPY_AND_ASSIGN(PrerenderContents);
370 }; 370 };
371 371
372 } // namespace prerender 372 } // namespace prerender
373 373
374 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ 374 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_handle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698