OLD | NEW |
---|---|
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 Loading... | |
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 // May be called from either the IO or UI thread and will PostTask |
242 // to the IO thread if necessary. | |
243 void RecordPreconnectTrigger(const GURL& url); | |
244 | |
245 void RecordPreconnectTriggerOnIOThread(const GURL& url); | |
cbentzel
2013/06/24 01:46:46
This should be in private - not a part of the inte
kouhei (in TOK)
2013/06/24 05:51:09
Done.
| |
246 | |
247 void RecordPreconnectNavigationStat(const GURL& url, | |
248 const GURL& original_url); | |
242 | 249 |
243 // ------------- End IO thread methods. | 250 // ------------- End IO thread methods. |
244 | 251 |
245 // The following methods may be called on either the IO or UI threads. | 252 // The following methods may be called on either the IO or UI threads. |
246 | 253 |
247 // Instigate pre-connection to any URLs, or pre-resolution of related host, | 254 // Instigate pre-connection to any URLs, or pre-resolution of related host, |
248 // that we predict will be needed after this navigation (typically | 255 // that we predict will be needed after this navigation (typically |
249 // more-embedded resources on a page). This method will actually post a task | 256 // 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 | 257 // to do the actual work, so as not to jump ahead of the frame navigation that |
251 // instigated this activity. | 258 // instigated this activity. |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
502 // The time when the last preresolve was done for last_omnibox_host_. | 509 // The time when the last preresolve was done for last_omnibox_host_. |
503 base::TimeTicks last_omnibox_preresolve_; | 510 base::TimeTicks last_omnibox_preresolve_; |
504 | 511 |
505 // The number of consecutive requests to AnticipateOmniboxUrl() that suggested | 512 // The number of consecutive requests to AnticipateOmniboxUrl() that suggested |
506 // preconnecting (because it was to a search service). | 513 // preconnecting (because it was to a search service). |
507 int consecutive_omnibox_preconnect_count_; | 514 int consecutive_omnibox_preconnect_count_; |
508 | 515 |
509 // The time when the last preconnection was requested to a search service. | 516 // The time when the last preconnection was requested to a search service. |
510 base::TimeTicks last_omnibox_preconnect_; | 517 base::TimeTicks last_omnibox_preconnect_; |
511 | 518 |
512 TimedCache recent_preconnects_; | 519 class PreconnectUsage; |
520 scoped_ptr<PreconnectUsage> preconnect_usage_; | |
513 | 521 |
514 // For each URL that we might navigate to (that we've "learned about") | 522 // 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 | 523 // 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 | 524 // need to pre-resolve or pre-connect to when there is a navigation to the |
517 // orginial hostname. | 525 // orginial hostname. |
518 Referrers referrers_; | 526 Referrers referrers_; |
519 | 527 |
520 // List of URLs in referrers_ currently being trimmed (scaled down to | 528 // List of URLs in referrers_ currently being trimmed (scaled down to |
521 // eventually be aged out of use). | 529 // eventually be aged out of use). |
522 std::vector<GURL> urls_being_trimmed_; | 530 std::vector<GURL> urls_being_trimmed_; |
(...skipping 16 matching lines...) Expand all Loading... | |
539 PrefService* user_prefs, | 547 PrefService* user_prefs, |
540 PrefService* local_state, | 548 PrefService* local_state, |
541 IOThread* io_thread, | 549 IOThread* io_thread, |
542 net::URLRequestContextGetter* getter) OVERRIDE; | 550 net::URLRequestContextGetter* getter) OVERRIDE; |
543 virtual void ShutdownOnUIThread(PrefService* user_prefs) OVERRIDE; | 551 virtual void ShutdownOnUIThread(PrefService* user_prefs) OVERRIDE; |
544 }; | 552 }; |
545 | 553 |
546 } // namespace chrome_browser_net | 554 } // namespace chrome_browser_net |
547 | 555 |
548 #endif // CHROME_BROWSER_NET_PREDICTOR_H_ | 556 #endif // CHROME_BROWSER_NET_PREDICTOR_H_ |
OLD | NEW |