diff options
author | dsh@google.com <dsh@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-27 20:43:33 +0000 |
---|---|---|
committer | dsh@google.com <dsh@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-27 20:43:33 +0000 |
commit | e1acf6f902e50222baf99bfb492ecc38a1604975 (patch) | |
tree | 503d45705b14be7e2f1ed86c71d6064abbf90fbe /chrome/browser/net | |
parent | a2f5993e1ce940e8a8eec900abaeed02e2eee09b (diff) | |
download | chromium_src-e1acf6f902e50222baf99bfb492ecc38a1604975.zip chromium_src-e1acf6f902e50222baf99bfb492ecc38a1604975.tar.gz chromium_src-e1acf6f902e50222baf99bfb492ecc38a1604975.tar.bz2 |
Move Time, TimeDelta and TimeTicks into namespace base.
Review URL: http://codereview.chromium.org/7995
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4022 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net')
-rw-r--r-- | chrome/browser/net/dns_global.cc | 2 | ||||
-rw-r--r-- | chrome/browser/net/dns_host_info.cc | 4 | ||||
-rw-r--r-- | chrome/browser/net/dns_host_info.h | 33 | ||||
-rw-r--r-- | chrome/browser/net/dns_host_info_unittest.cc | 2 | ||||
-rw-r--r-- | chrome/browser/net/dns_master.cc | 2 | ||||
-rw-r--r-- | chrome/browser/net/dns_master.h | 8 | ||||
-rw-r--r-- | chrome/browser/net/dns_master_unittest.cc | 3 |
7 files changed, 35 insertions, 19 deletions
diff --git a/chrome/browser/net/dns_global.cc b/chrome/browser/net/dns_global.cc index a38819e..52bddb2a 100644 --- a/chrome/browser/net/dns_global.cc +++ b/chrome/browser/net/dns_global.cc @@ -21,6 +21,8 @@ #include "googleurl/src/gurl.h" #include "net/base/dns_resolution_observer.h" +using base::TimeDelta; + namespace chrome_browser_net { static void DiscardAllPrefetchState(); diff --git a/chrome/browser/net/dns_host_info.cc b/chrome/browser/net/dns_host_info.cc index 39dce74..777f72d 100644 --- a/chrome/browser/net/dns_host_info.cc +++ b/chrome/browser/net/dns_host_info.cc @@ -15,6 +15,10 @@ #include "base/logging.h" #include "base/string_util.h" +using base::Time; +using base::TimeDelta; +using base::TimeTicks; + namespace chrome_browser_net { static bool detailed_logging_enabled = false; diff --git a/chrome/browser/net/dns_host_info.h b/chrome/browser/net/dns_host_info.h index ee446e1..2f2a51c 100644 --- a/chrome/browser/net/dns_host_info.h +++ b/chrome/browser/net/dns_host_info.h @@ -44,14 +44,14 @@ class DnsHostInfo { STARTED, // Resolution has begun. FINISHED, // Resolution has completed. FINISHED_UNRESOLVED}; // No resolution found. - static const TimeDelta kMaxNonNetworkDnsLookupDuration; + static const base::TimeDelta kMaxNonNetworkDnsLookupDuration; // The number of OS cache entries we can guarantee(?) before cache eviction // might likely take place. static const int kMaxGuaranteedCacheSize = 50; typedef std::vector<DnsHostInfo> DnsInfoTable; - static const TimeDelta kNullDuration; + static const base::TimeDelta kNullDuration; // DnsHostInfo are usually made by the default constructor during // initializing of the DnsMaster's map (of info for Hostnames). @@ -71,7 +71,7 @@ class DnsHostInfo { // on how recently we've done DNS prefetching for hostname. bool NeedsDnsUpdate(const std::string& hostname); - static void set_cache_expiration(TimeDelta time); + static void set_cache_expiration(base::TimeDelta time); // The prefetching lifecycle. void SetQueuedState(); @@ -102,9 +102,9 @@ class DnsHostInfo { return (hostname == hostname_); } - TimeDelta resolve_duration() const { return resolve_duration_;} - TimeDelta queue_duration() const { return queue_duration_;} - TimeDelta benefits_remaining() const { return benefits_remaining_; } + base::TimeDelta resolve_duration() const { return resolve_duration_;} + base::TimeDelta queue_duration() const { return queue_duration_;} + base::TimeDelta benefits_remaining() const { return benefits_remaining_; } DnsBenefit AcruePrefetchBenefits(DnsHostInfo* later_host_info); @@ -117,22 +117,26 @@ class DnsHostInfo { private: // The next declaration is non-const to facilitate testing. - static TimeDelta kCacheExpirationDuration; + static base::TimeDelta kCacheExpirationDuration; DnsProcessingState state_; std::string hostname_; // Hostname for this info. - TimeTicks time_; // When was last state changed (usually lookup completed). - TimeDelta resolve_duration_; // Time needed for DNS to resolve. - TimeDelta queue_duration_; // Time spent in queue. - TimeDelta benefits_remaining_; // Unused potential benefits of a prefetch. + // When was last state changed (usually lookup completed). + base::TimeTicks time_; + // Time needed for DNS to resolve. + base::TimeDelta resolve_duration_; + // Time spent in queue. + base::TimeDelta queue_duration_; + // Unused potential benefits of a prefetch. + base::TimeDelta benefits_remaining_; int sequence_number_; // Used to calculate potential of cache eviction. static int sequence_counter; // Used to allocate sequence_number_'s. - TimeDelta GetDuration() { - TimeTicks old_time = time_; - time_ = TimeTicks::Now(); + base::TimeDelta GetDuration() { + base::TimeTicks old_time = time_; + time_ = base::TimeTicks::Now(); return time_ - old_time; } @@ -147,4 +151,3 @@ class DnsHostInfo { } // namespace chrome_browser_net #endif // CHROME_BROWSER_NET_DNS_HOST_INFO_H_ - diff --git a/chrome/browser/net/dns_host_info_unittest.cc b/chrome/browser/net/dns_host_info_unittest.cc index 3ab5db7..bc04336 100644 --- a/chrome/browser/net/dns_host_info_unittest.cc +++ b/chrome/browser/net/dns_host_info_unittest.cc @@ -11,6 +11,8 @@ #include "chrome/browser/net/dns_host_info.h" #include "testing/gtest/include/gtest/gtest.h" +using base::TimeDelta; + namespace { class DnsHostInfoTest : public testing::Test { diff --git a/chrome/browser/net/dns_master.cc b/chrome/browser/net/dns_master.cc index 2030cd4..0ea83ec 100644 --- a/chrome/browser/net/dns_master.cc +++ b/chrome/browser/net/dns_master.cc @@ -14,6 +14,8 @@ #include "base/win_util.h" #include "chrome/browser/net/dns_slave.h" +using base::TimeDelta; + namespace chrome_browser_net { //------------------------------------------------------------------------------ diff --git a/chrome/browser/net/dns_master.h b/chrome/browser/net/dns_master.h index d74773585..1da6b4f 100644 --- a/chrome/browser/net/dns_master.h +++ b/chrome/browser/net/dns_master.h @@ -39,7 +39,7 @@ class DnsMaster { // The number of slave processes that will do DNS prefetching static const int kSlaveCountMax = 8; - explicit DnsMaster(TimeDelta shutdown_wait_time); + explicit DnsMaster(base::TimeDelta shutdown_wait_time); ~DnsMaster() { if (!shutdown_) @@ -82,14 +82,14 @@ class DnsMaster { // Accessor methods, used mostly for testing. // Both functions return DnsHostInfo::kNullDuration if name was not yet // processed enough. - TimeDelta GetResolutionDuration(const std::string hostname) { + base::TimeDelta GetResolutionDuration(const std::string hostname) { AutoLock auto_lock(lock_); if (results_.find(hostname) == results_.end()) return DnsHostInfo::kNullDuration; return results_[hostname].resolve_duration(); } - TimeDelta GetQueueDuration(const std::string hostname) { + base::TimeDelta GetQueueDuration(const std::string hostname) { AutoLock auto_lock(lock_); if (results_.find(hostname) == results_.end()) return DnsHostInfo::kNullDuration; @@ -157,7 +157,7 @@ class DnsMaster { // The following is the maximum time the ShutdownSlaves method // will wait for all the slave processes to terminate. - const TimeDelta kShutdownWaitTime_; + const base::TimeDelta kShutdownWaitTime_; // A list of successful events resulting from pre-fetching. DnsHostInfo::DnsInfoTable cache_hits_; diff --git a/chrome/browser/net/dns_master_unittest.cc b/chrome/browser/net/dns_master_unittest.cc index 1f95742..c843b36 100644 --- a/chrome/browser/net/dns_master_unittest.cc +++ b/chrome/browser/net/dns_master_unittest.cc @@ -21,6 +21,9 @@ #include "testing/gtest/include/gtest/gtest.h" +using base::Time; +using base::TimeDelta; + namespace { class DnsMasterTest : public testing::Test { |