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

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

Issue 1550593002: Switch to standard integer types in chrome/browser/, part 2 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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/nss_context_chromeos.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
11 // before it is really needed, and hence reduce latency in the standard lookup 11 // before it is really needed, and hence reduce latency in the standard lookup
12 // paths. 12 // paths.
13 // Subresource relationships are usually acquired from the referrer field in a 13 // Subresource relationships are usually acquired from the referrer field in a
14 // navigation. A subresource URL may be associated with a referrer URL. Later 14 // navigation. A subresource URL may be associated with a referrer URL. Later
15 // navigations may, if the likelihood of needing the subresource is high enough, 15 // navigations may, if the likelihood of needing the subresource is high enough,
16 // cause this module to speculatively create a TCP/IP connection. If there is 16 // cause this module to speculatively create a TCP/IP connection. If there is
17 // only a low likelihood, then a DNS pre-resolution operation may be performed. 17 // only a low likelihood, then a DNS pre-resolution operation may be performed.
18 18
19 #ifndef CHROME_BROWSER_NET_PREDICTOR_H_ 19 #ifndef CHROME_BROWSER_NET_PREDICTOR_H_
20 #define CHROME_BROWSER_NET_PREDICTOR_H_ 20 #define CHROME_BROWSER_NET_PREDICTOR_H_
21 21
22 #include <map> 22 #include <map>
23 #include <queue> 23 #include <queue>
24 #include <set> 24 #include <set>
25 #include <string> 25 #include <string>
26 #include <vector> 26 #include <vector>
27 27
28 #include <stddef.h>
29
30 #include <stdint.h>
31
28 #include "base/gtest_prod_util.h" 32 #include "base/gtest_prod_util.h"
33 #include "base/macros.h"
29 #include "base/memory/scoped_ptr.h" 34 #include "base/memory/scoped_ptr.h"
30 #include "base/memory/weak_ptr.h" 35 #include "base/memory/weak_ptr.h"
31 #include "chrome/browser/net/prediction_options.h" 36 #include "chrome/browser/net/prediction_options.h"
32 #include "chrome/browser/net/referrer.h" 37 #include "chrome/browser/net/referrer.h"
33 #include "chrome/browser/net/timed_cache.h" 38 #include "chrome/browser/net/timed_cache.h"
34 #include "chrome/browser/net/url_info.h" 39 #include "chrome/browser/net/url_info.h"
35 #include "components/network_hints/common/network_hints_common.h" 40 #include "components/network_hints/common/network_hints_common.h"
36 #include "net/base/host_port_pair.h" 41 #include "net/base/host_port_pair.h"
37 42
38 class IOThread; 43 class IOThread;
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 static const double kDiscardableExpectedValue; 405 static const double kDiscardableExpectedValue;
401 // During trimming operation to discard hosts for which we don't have likely 406 // During trimming operation to discard hosts for which we don't have likely
402 // subresources, we multiply the expected_subresource_use_ value by the 407 // subresources, we multiply the expected_subresource_use_ value by the
403 // following ratio until that value is less than kDiscardableExpectedValue. 408 // following ratio until that value is less than kDiscardableExpectedValue.
404 // This number should always be less than 1, an more than 0. 409 // This number should always be less than 1, an more than 0.
405 static const double kReferrerTrimRatio; 410 static const double kReferrerTrimRatio;
406 411
407 // Interval between periodic trimming of our whole referrer list. 412 // Interval between periodic trimming of our whole referrer list.
408 // We only do a major trimming about once an hour, and then only when the user 413 // We only do a major trimming about once an hour, and then only when the user
409 // is actively browsing. 414 // is actively browsing.
410 static const int64 kDurationBetweenTrimmingsHours; 415 static const int64_t kDurationBetweenTrimmingsHours;
411 // Interval between incremental trimmings (to avoid inducing Jank). 416 // Interval between incremental trimmings (to avoid inducing Jank).
412 static const int64 kDurationBetweenTrimmingIncrementsSeconds; 417 static const int64_t kDurationBetweenTrimmingIncrementsSeconds;
413 // Number of referring URLs processed in an incremental trimming. 418 // Number of referring URLs processed in an incremental trimming.
414 static const size_t kUrlsTrimmedPerIncrement; 419 static const size_t kUrlsTrimmedPerIncrement;
415 420
416 // Only for testing. Returns true if hostname has been successfully resolved 421 // Only for testing. Returns true if hostname has been successfully resolved
417 // (name found). 422 // (name found).
418 bool WasFound(const GURL& url) const { 423 bool WasFound(const GURL& url) const {
419 Results::const_iterator it(results_.find(url)); 424 Results::const_iterator it(results_.find(url));
420 return (it != results_.end()) && 425 return (it != results_.end()) &&
421 it->second.was_found(); 426 it->second.was_found();
422 } 427 }
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 618
614 private: 619 private:
615 // These member functions return True for unittests. 620 // These member functions return True for unittests.
616 bool CanPrefetchAndPrerender() const override; 621 bool CanPrefetchAndPrerender() const override;
617 bool CanPreresolveAndPreconnect() const override; 622 bool CanPreresolveAndPreconnect() const override;
618 }; 623 };
619 624
620 } // namespace chrome_browser_net 625 } // namespace chrome_browser_net
621 626
622 #endif // CHROME_BROWSER_NET_PREDICTOR_H_ 627 #endif // CHROME_BROWSER_NET_PREDICTOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/net/nss_context_chromeos.cc ('k') | chrome/browser/net/predictor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698