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

Side by Side Diff: chrome/browser/net/predictor.h

Issue 16514008: Add metrics for calculating precision/recall of link navigation pre-connect triggers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove PRERENDER flag change Created 7 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
« no previous file with comments | « chrome/browser/net/preconnect.cc ('k') | chrome/browser/net/predictor.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 // A Predictor object is instantiated once in the browser process, and manages 5 // A Predictor object is instantiated once in the browser process, and manages
6 // both preresolution of hostnames, as well as TCP/IP preconnection to expected 6 // both preresolution of hostnames, as well as TCP/IP preconnection to expected
7 // subresources. 7 // subresources.
8 // Most hostname lists are provided by the renderer processes, and include URLs 8 // Most hostname lists are provided by the renderer processes, and include URLs
9 // that *might* be used in the near future by the browsing user. One goal of 9 // that *might* be used in the near future by the browsing user. One goal of
10 // this class is to cause the underlying DNS structure to lookup a hostname 10 // this class is to cause the underlying DNS structure to lookup a hostname
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 // May be called from either the IO or UI thread and will PostTask 231 // May be called from either the IO or UI thread and will PostTask
232 // to the IO thread if necessary. 232 // to the IO thread if necessary.
233 void PreconnectUrl(const GURL& url, const GURL& first_party_for_cookies, 233 void PreconnectUrl(const GURL& url, const GURL& first_party_for_cookies,
234 UrlInfo::ResolutionMotivation motivation, int count); 234 UrlInfo::ResolutionMotivation motivation, int count);
235 235
236 void PreconnectUrlOnIOThread(const GURL& url, 236 void PreconnectUrlOnIOThread(const GURL& url,
237 const GURL& first_party_for_cookies, 237 const GURL& first_party_for_cookies,
238 UrlInfo::ResolutionMotivation motivation, 238 UrlInfo::ResolutionMotivation motivation,
239 int count); 239 int count);
240 240
241 void RecordPreconnectNavigationStats(const GURL& url); 241 void RecordPreconnectTrigger(const GURL& url);
242
243 void RecordPreconnectNavigationStat(const std::vector<GURL>& url_chain,
244 bool is_subresource);
245
246 void RecordLinkNavigation(const GURL& url);
242 247
243 // ------------- End IO thread methods. 248 // ------------- End IO thread methods.
244 249
245 // The following methods may be called on either the IO or UI threads. 250 // The following methods may be called on either the IO or UI threads.
246 251
247 // Instigate pre-connection to any URLs, or pre-resolution of related host, 252 // Instigate pre-connection to any URLs, or pre-resolution of related host,
248 // that we predict will be needed after this navigation (typically 253 // that we predict will be needed after this navigation (typically
249 // more-embedded resources on a page). This method will actually post a task 254 // more-embedded resources on a page). This method will actually post a task
250 // to do the actual work, so as not to jump ahead of the frame navigation that 255 // to do the actual work, so as not to jump ahead of the frame navigation that
251 // instigated this activity. 256 // instigated this activity.
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 // The time when the last preresolve was done for last_omnibox_host_. 507 // The time when the last preresolve was done for last_omnibox_host_.
503 base::TimeTicks last_omnibox_preresolve_; 508 base::TimeTicks last_omnibox_preresolve_;
504 509
505 // The number of consecutive requests to AnticipateOmniboxUrl() that suggested 510 // The number of consecutive requests to AnticipateOmniboxUrl() that suggested
506 // preconnecting (because it was to a search service). 511 // preconnecting (because it was to a search service).
507 int consecutive_omnibox_preconnect_count_; 512 int consecutive_omnibox_preconnect_count_;
508 513
509 // The time when the last preconnection was requested to a search service. 514 // The time when the last preconnection was requested to a search service.
510 base::TimeTicks last_omnibox_preconnect_; 515 base::TimeTicks last_omnibox_preconnect_;
511 516
512 TimedCache recent_preconnects_; 517 class PreconnectUsage;
518 scoped_ptr<PreconnectUsage> preconnect_usage_;
513 519
514 // For each URL that we might navigate to (that we've "learned about") 520 // For each URL that we might navigate to (that we've "learned about")
515 // we have a Referrer list. Each Referrer list has all hostnames we might 521 // we have a Referrer list. Each Referrer list has all hostnames we might
516 // need to pre-resolve or pre-connect to when there is a navigation to the 522 // need to pre-resolve or pre-connect to when there is a navigation to the
517 // orginial hostname. 523 // orginial hostname.
518 Referrers referrers_; 524 Referrers referrers_;
519 525
520 // List of URLs in referrers_ currently being trimmed (scaled down to 526 // List of URLs in referrers_ currently being trimmed (scaled down to
521 // eventually be aged out of use). 527 // eventually be aged out of use).
522 std::vector<GURL> urls_being_trimmed_; 528 std::vector<GURL> urls_being_trimmed_;
(...skipping 16 matching lines...) Expand all
539 PrefService* user_prefs, 545 PrefService* user_prefs,
540 PrefService* local_state, 546 PrefService* local_state,
541 IOThread* io_thread, 547 IOThread* io_thread,
542 net::URLRequestContextGetter* getter) OVERRIDE; 548 net::URLRequestContextGetter* getter) OVERRIDE;
543 virtual void ShutdownOnUIThread(PrefService* user_prefs) OVERRIDE; 549 virtual void ShutdownOnUIThread(PrefService* user_prefs) OVERRIDE;
544 }; 550 };
545 551
546 } // namespace chrome_browser_net 552 } // namespace chrome_browser_net
547 553
548 #endif // CHROME_BROWSER_NET_PREDICTOR_H_ 554 #endif // CHROME_BROWSER_NET_PREDICTOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/net/preconnect.cc ('k') | chrome/browser/net/predictor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698