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

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

Issue 2321083002: [NoStatePrefetch] Add performance histograms. (Closed)
Patch Set: Review comments Created 4 years, 3 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 (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_MANAGER_H_ 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_
6 #define CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 bool is_main_resource, 208 bool is_main_resource,
209 bool is_redirect, 209 bool is_redirect,
210 bool is_no_store); 210 bool is_no_store);
211 211
212 // Called when a NoStatePrefetch resource has been loaded. This is called only 212 // Called when a NoStatePrefetch resource has been loaded. This is called only
213 // once per resource, when all redirects have been resolved. 213 // once per resource, when all redirects have been resolved.
214 void RecordPrefetchRedirectCount(Origin origin, 214 void RecordPrefetchRedirectCount(Origin origin,
215 bool is_main_resource, 215 bool is_main_resource,
216 int redirect_count); 216 int redirect_count);
217 217
218 // Records the time to first contentful paint.
219 // Must not be called for prefetch loads (which are never rendered anyway).
220 // |is_no_store| must be true if the main resource has a "no-store" cache
221 // control HTTP header.
222 void RecordFirstContentfulPaint(const GURL& url,
223 bool is_no_store,
224 base::TimeDelta time);
225
218 static PrerenderManagerMode GetMode(); 226 static PrerenderManagerMode GetMode();
219 static void SetMode(PrerenderManagerMode mode); 227 static void SetMode(PrerenderManagerMode mode);
220 static bool IsPrerenderingPossible(); 228 static bool IsPrerenderingPossible();
221 static bool ActuallyPrerendering(); 229 static bool ActuallyPrerendering();
222 static bool IsControlGroup(); 230 static bool IsControlGroup();
223 static bool IsNoUseGroup(); 231 static bool IsNoUseGroup();
224 static bool IsNoStatePrefetch(); 232 static bool IsNoStatePrefetch();
225 233
226 // Query the list of current prerender pages to see if the given web contents 234 // Query the list of current prerender pages to see if the given web contents
227 // is prerendering a page. The optional parameter |origin| is an output 235 // is prerendering a page. The optional parameter |origin| is an output
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 PrerenderContents* prerender_contents); 501 PrerenderContents* prerender_contents);
494 502
495 bool DoesRateLimitAllowPrerender(Origin origin) const; 503 bool DoesRateLimitAllowPrerender(Origin origin) const;
496 504
497 // Deletes old WebContents that have been replaced by prerendered ones. This 505 // Deletes old WebContents that have been replaced by prerendered ones. This
498 // is needed because they're replaced in a callback from the old WebContents, 506 // is needed because they're replaced in a callback from the old WebContents,
499 // so cannot immediately be deleted. 507 // so cannot immediately be deleted.
500 void DeleteOldWebContents(); 508 void DeleteOldWebContents();
501 509
502 // Cleans up old NavigationRecord's. 510 // Cleans up old NavigationRecord's.
503 void CleanUpOldNavigations(); 511 void CleanUpOldNavigations(std::vector<NavigationRecord>* navigations,
512 base::TimeDelta max_age);
504 513
505 // Arrange for the given WebContents to be deleted asap. Delete |deleter| as 514 // Arrange for the given WebContents to be deleted asap. Delete |deleter| as
506 // well. 515 // well.
507 void ScheduleDeleteOldWebContents(std::unique_ptr<content::WebContents> tab, 516 void ScheduleDeleteOldWebContents(std::unique_ptr<content::WebContents> tab,
508 OnCloseWebContentsDeleter* deleter); 517 OnCloseWebContentsDeleter* deleter);
509 518
510 // Adds to the history list. 519 // Adds to the history list.
511 void AddToHistory(PrerenderContents* contents); 520 void AddToHistory(PrerenderContents* contents);
512 521
513 // Returns a new Value representing the pages currently being prerendered. 522 // Returns a new Value representing the pages currently being prerendered.
(...skipping 29 matching lines...) Expand all
543 // All running prerenders. Sorted by expiry time, in ascending order. 552 // All running prerenders. Sorted by expiry time, in ascending order.
544 PrerenderDataVector active_prerenders_; 553 PrerenderDataVector active_prerenders_;
545 554
546 // Prerenders awaiting deletion. 555 // Prerenders awaiting deletion.
547 PrerenderDataVector to_delete_prerenders_; 556 PrerenderDataVector to_delete_prerenders_;
548 557
549 // List of recent navigations in this profile, sorted by ascending 558 // List of recent navigations in this profile, sorted by ascending
550 // |navigate_time_|. 559 // |navigate_time_|.
551 std::vector<NavigationRecord> navigations_; 560 std::vector<NavigationRecord> navigations_;
552 561
562 // List of recent prefetches, sorted by ascending navigate time.
563 std::vector<NavigationRecord> prefetches_;
564
553 std::unique_ptr<PrerenderContents::Factory> prerender_contents_factory_; 565 std::unique_ptr<PrerenderContents::Factory> prerender_contents_factory_;
554 566
555 static PrerenderManagerMode mode_; 567 static PrerenderManagerMode mode_;
556 568
557 // A count of how many prerenders we do per session. Initialized to 0 then 569 // A count of how many prerenders we do per session. Initialized to 0 then
558 // incremented and emitted to a histogram on each successful prerender. 570 // incremented and emitted to a histogram on each successful prerender.
559 static int prerenders_per_session_count_; 571 static int prerenders_per_session_count_;
560 572
561 // RepeatingTimer to perform periodic cleanups of pending prerendered 573 // RepeatingTimer to perform periodic cleanups of pending prerendered
562 // pages. 574 // pages.
(...skipping 25 matching lines...) Expand all
588 PrerenderProcessSet prerender_process_hosts_; 600 PrerenderProcessSet prerender_process_hosts_;
589 601
590 base::WeakPtrFactory<PrerenderManager> weak_factory_; 602 base::WeakPtrFactory<PrerenderManager> weak_factory_;
591 603
592 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); 604 DISALLOW_COPY_AND_ASSIGN(PrerenderManager);
593 }; 605 };
594 606
595 } // namespace prerender 607 } // namespace prerender
596 608
597 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ 609 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_link_manager_factory.cc ('k') | chrome/browser/prerender/prerender_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698