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 /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 'net')
50 files changed, 152 insertions, 73 deletions
diff --git a/net/base/client_socket_pool.cc b/net/base/client_socket_pool.cc index 2fb6703..46afef6 100644 --- a/net/base/client_socket_pool.cc +++ b/net/base/client_socket_pool.cc @@ -9,6 +9,8 @@ #include "net/base/client_socket_handle.h" #include "net/base/net_errors.h" +using base::TimeDelta; + namespace { // The timeout value, in seconds, used to clean up disconnected idle sockets. diff --git a/net/base/cookie_monster.cc b/net/base/cookie_monster.cc index 20a4a00a..136f38e 100644 --- a/net/base/cookie_monster.cc +++ b/net/base/cookie_monster.cc @@ -63,6 +63,9 @@ #define COOKIE_DLOG(severity) DLOG_IF(INFO, 0) #endif +using base::Time; +using base::TimeDelta; + namespace net { // static diff --git a/net/base/cookie_monster.h b/net/base/cookie_monster.h index 83f5a2b..11491ff 100644 --- a/net/base/cookie_monster.h +++ b/net/base/cookie_monster.h @@ -71,7 +71,7 @@ class CookieMonster { ~CookieMonster(); // Parse the string with the cookie time (very forgivingly). - static Time ParseCookieTime(const std::string& time_string); + static base::Time ParseCookieTime(const std::string& time_string); // Set a single cookie. Expects a cookie line, like "a=1; domain=b.com". bool SetCookie(const GURL& url, const std::string& cookie_line); @@ -80,7 +80,7 @@ class CookieMonster { // internally). bool SetCookieWithCreationTime(const GURL& url, const std::string& cookie_line, - const Time& creation_time); + const base::Time& creation_time); // Set a vector of response cookie values for the same URL. void SetCookies(const GURL& url, const std::vector<std::string>& cookies); @@ -97,12 +97,12 @@ class CookieMonster { int DeleteAll(bool sync_to_store); // Delete all of the cookies that have a creation_date greater than or equal // to |delete_begin| and less than |delete_end| - int DeleteAllCreatedBetween(const Time& delete_begin, - const Time& delete_end, + int DeleteAllCreatedBetween(const base::Time& delete_begin, + const base::Time& delete_end, bool sync_to_store); // Delete all of the cookies that have a creation_date more recent than the // one passed into the function via |delete_after|. - int DeleteAllCreatedAfter(const Time& delete_begin, bool sync_to_store); + int DeleteAllCreatedAfter(const base::Time& delete_begin, bool sync_to_store); // Delete one specific cookie. bool DeleteCookie(const std::string& domain, @@ -139,7 +139,7 @@ class CookieMonster { void FindCookiesForKey(const std::string& key, const GURL& url, CookieOptions options, - const Time& current, + const base::Time& current, std::vector<CanonicalCookie*>* cookies); int DeleteEquivalentCookies(const std::string& key, @@ -152,8 +152,8 @@ class CookieMonster { void InternalDeleteCookie(CookieMap::iterator it, bool sync_to_store); // Enforce cookie maximum limits, purging expired and old cookies if needed - int GarbageCollect(const Time& current, const std::string& key); - int GarbageCollectRange(const Time& current, + int GarbageCollect(const base::Time& current, const std::string& key); + int GarbageCollectRange(const base::Time& current, const CookieMapItPair& itpair, size_t num_max, size_t num_purge); @@ -168,8 +168,8 @@ class CookieMonster { // The resolution of our time isn't enough, so we do something // ugly and increment when we've seen the same time twice. - Time CurrentTime(); - Time last_time_seen_; + base::Time CurrentTime(); + base::Time last_time_seen_; // Lock for thread-safety Lock lock_; @@ -237,8 +237,8 @@ class CookieMonster::CanonicalCookie { public: CanonicalCookie(const std::string& name, const std::string& value, const std::string& path, bool secure, - bool httponly, const Time& creation, - bool has_expires, const Time& expires) + bool httponly, const base::Time& creation, + bool has_expires, const base::Time& expires) : name_(name), value_(value), path_(path), @@ -263,14 +263,14 @@ class CookieMonster::CanonicalCookie { const std::string& Name() const { return name_; } const std::string& Value() const { return value_; } const std::string& Path() const { return path_; } - const Time& CreationDate() const { return creation_date_; } + const base::Time& CreationDate() const { return creation_date_; } bool DoesExpire() const { return has_expires_; } bool IsPersistent() const { return DoesExpire(); } - const Time& ExpiryDate() const { return expiry_date_; } + const base::Time& ExpiryDate() const { return expiry_date_; } bool IsSecure() const { return secure_; } bool IsHttpOnly() const { return httponly_; } - bool IsExpired(const Time& current) { + bool IsExpired(const base::Time& current) { return has_expires_ && current >= expiry_date_; } @@ -289,8 +289,8 @@ class CookieMonster::CanonicalCookie { std::string name_; std::string value_; std::string path_; - Time creation_date_; - Time expiry_date_; + base::Time creation_date_; + base::Time expiry_date_; bool has_expires_; bool secure_; bool httponly_; diff --git a/net/base/cookie_monster_unittest.cc b/net/base/cookie_monster_unittest.cc index dde2cb1..f8765dc 100644 --- a/net/base/cookie_monster_unittest.cc +++ b/net/base/cookie_monster_unittest.cc @@ -13,6 +13,9 @@ #include "net/base/cookie_monster.h" #include "testing/gtest/include/gtest/gtest.h" +using base::Time; +using base::TimeDelta; + namespace { class ParsedCookieTest : public testing::Test { }; class CookieMonsterTest : public testing::Test { }; diff --git a/net/base/net_util.cc b/net/base/net_util.cc index 305cbcc..507b7b4 100644 --- a/net/base/net_util.cc +++ b/net/base/net_util.cc @@ -37,6 +37,8 @@ #include "net/base/base64.h" #include "unicode/datefmt.h" +using base::Time; + namespace { // what we prepend to get a file URL diff --git a/net/base/sdch_manager.cc b/net/base/sdch_manager.cc index 365c8de..08c9d1c2 100644 --- a/net/base/sdch_manager.cc +++ b/net/base/sdch_manager.cc @@ -12,6 +12,8 @@ #include "net/base/sdch_manager.h" #include "net/url_request/url_request_http_job.h" +using base::Time; +using base::TimeDelta; //------------------------------------------------------------------------------ // static diff --git a/net/base/sdch_manager.h b/net/base/sdch_manager.h index 3aa6884..69055f1 100644 --- a/net/base/sdch_manager.h +++ b/net/base/sdch_manager.h @@ -110,7 +110,7 @@ class SdchManager { Dictionary(const std::string& dictionary_text, size_t offset, const std::string& client_hash, const GURL& url, const std::string& domain, const std::string& path, - const Time& expiration, const std::set<int> ports); + const base::Time& expiration, const std::set<int> ports); const GURL& url() const { return url_; } const std::string& client_hash() const { return client_hash_; } @@ -152,7 +152,7 @@ class SdchManager { // of the dictionary. The following are the known headers. const std::string domain_; const std::string path_; - const Time expiration_; // Implied by max-age. + const base::Time expiration_; // Implied by max-age. const std::set<int> ports_; DISALLOW_COPY_AND_ASSIGN(Dictionary); diff --git a/net/base/ssl_config_service.cc b/net/base/ssl_config_service.cc index b7be1f0..7e94955 100644 --- a/net/base/ssl_config_service.cc +++ b/net/base/ssl_config_service.cc @@ -6,6 +6,9 @@ #include "base/registry.h" +using base::TimeDelta; +using base::TimeTicks; + namespace net { static const int kConfigUpdateInterval = 10; // seconds diff --git a/net/base/ssl_config_service.h b/net/base/ssl_config_service.h index d2010e04..b4e0622 100644 --- a/net/base/ssl_config_service.h +++ b/net/base/ssl_config_service.h @@ -34,7 +34,7 @@ struct SSLConfig { class SSLConfigService { public: SSLConfigService(); - explicit SSLConfigService(TimeTicks now); // Used for testing. + explicit SSLConfigService(base::TimeTicks now); // Used for testing. ~SSLConfigService() { } // Get the current SSL configuration settings. Can be called on any @@ -50,18 +50,18 @@ class SSLConfigService { // we don't need the absolutely current configuration settings. This // method is not thread-safe, so it must be called on the same thread. void GetSSLConfig(SSLConfig* config) { - GetSSLConfigAt(config, TimeTicks::Now()); + GetSSLConfigAt(config, base::TimeTicks::Now()); } // Used for testing. - void GetSSLConfigAt(SSLConfig* config, TimeTicks now); + void GetSSLConfigAt(SSLConfig* config, base::TimeTicks now); private: - void UpdateConfig(TimeTicks now); + void UpdateConfig(base::TimeTicks now); // We store the IE SSL config and the time that we fetched it. SSLConfig config_info_; - TimeTicks config_time_; + base::TimeTicks config_time_; DISALLOW_EVIL_CONSTRUCTORS(SSLConfigService); }; diff --git a/net/base/ssl_config_service_unittest.cc b/net/base/ssl_config_service_unittest.cc index ae1b378..7aeef52 100644 --- a/net/base/ssl_config_service_unittest.cc +++ b/net/base/ssl_config_service_unittest.cc @@ -5,6 +5,9 @@ #include "net/base/ssl_config_service.h" #include "testing/gtest/include/gtest/gtest.h" +using base::TimeDelta; +using base::TimeTicks; + namespace { class SSLConfigServiceTest : public testing::Test { diff --git a/net/base/x509_certificate.h b/net/base/x509_certificate.h index e383532..ff6ba31 100644 --- a/net/base/x509_certificate.h +++ b/net/base/x509_certificate.h @@ -126,7 +126,7 @@ class X509Certificate : public base::RefCountedThreadSafe<X509Certificate> { // Creates a X509Certificate from the ground up. Used by tests that simulate // SSL connections. X509Certificate(std::string subject, std::string issuer, - Time start_date, Time expiration_date); + base::Time start_date, base::Time expiration_date); // Appends a representation of this object to the given pickle. void Persist(Pickle* pickle); @@ -144,8 +144,8 @@ class X509Certificate : public base::RefCountedThreadSafe<X509Certificate> { // the |valid_expiry| date. // If we were unable to parse either date from the certificate (or if the cert // lacks either date), the date will be null (i.e., is_null() will be true). - const Time& valid_start() const { return valid_start_; } - const Time& valid_expiry() const { return valid_expiry_; } + const base::Time& valid_start() const { return valid_start_; } + const base::Time& valid_expiry() const { return valid_expiry_; } // The fingerprint of this certificate. const Fingerprint& fingerprint() const { return fingerprint_; } @@ -210,10 +210,10 @@ class X509Certificate : public base::RefCountedThreadSafe<X509Certificate> { Principal issuer_; // This certificate is not valid before |valid_start_| - Time valid_start_; + base::Time valid_start_; // This certificate is not valid after |valid_expiry_| - Time valid_expiry_; + base::Time valid_expiry_; // The fingerprint of this certificate. Fingerprint fingerprint_; diff --git a/net/base/x509_certificate_mac.cc b/net/base/x509_certificate_mac.cc index e60e19a..11191bd 100644 --- a/net/base/x509_certificate_mac.cc +++ b/net/base/x509_certificate_mac.cc @@ -13,6 +13,8 @@ #include "net/base/cert_status_flags.h" #include "net/base/ev_root_ca_metadata.h" +using base::Time; + namespace net { namespace { diff --git a/net/base/x509_certificate_unittest.cc b/net/base/x509_certificate_unittest.cc index 73a8337..499b914 100644 --- a/net/base/x509_certificate_unittest.cc +++ b/net/base/x509_certificate_unittest.cc @@ -14,6 +14,8 @@ // testing. #define ALLOW_EXTERNAL_ACCESS 0 +using base::Time; + namespace { class X509CertificateTest : public testing::Test { diff --git a/net/base/x509_certificate_win.cc b/net/base/x509_certificate_win.cc index 138f20d..4e7c4ba 100644 --- a/net/base/x509_certificate_win.cc +++ b/net/base/x509_certificate_win.cc @@ -15,6 +15,8 @@ #pragma comment(lib, "crypt32.lib") +using base::Time; + namespace net { namespace { diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc index c0fa867..da11f98 100644 --- a/net/disk_cache/backend_impl.cc +++ b/net/disk_cache/backend_impl.cc @@ -17,6 +17,9 @@ #include "net/disk_cache/hash.h" #include "net/disk_cache/file.h" +using base::Time; +using base::TimeDelta; + namespace { const wchar_t* kIndexName = L"index"; diff --git a/net/disk_cache/backend_impl.h b/net/disk_cache/backend_impl.h index 6818d84..40b6f51 100644 --- a/net/disk_cache/backend_impl.h +++ b/net/disk_cache/backend_impl.h @@ -41,9 +41,9 @@ class BackendImpl : public Backend { virtual bool CreateEntry(const std::string& key, Entry** entry); virtual bool DoomEntry(const std::string& key); virtual bool DoomAllEntries(); - virtual bool DoomEntriesBetween(const Time initial_time, - const Time end_time); - virtual bool DoomEntriesSince(const Time initial_time); + virtual bool DoomEntriesBetween(const base::Time initial_time, + const base::Time end_time); + virtual bool DoomEntriesSince(const base::Time initial_time); virtual bool OpenNextEntry(void** iter, Entry** next_entry); virtual void EndEnumeration(void** iter); virtual void GetStats(StatsItems* stats); diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc index 0cfcaf5..701de4b 100644 --- a/net/disk_cache/backend_unittest.cc +++ b/net/disk_cache/backend_unittest.cc @@ -13,6 +13,8 @@ #include "net/disk_cache/mapped_file.h" #include "testing/gtest/include/gtest/gtest.h" +using base::Time; + namespace { // Copies a set of cache files from the data folder to the test folder. diff --git a/net/disk_cache/block_files.cc b/net/disk_cache/block_files.cc index e14f33d..87f2dc2 100644 --- a/net/disk_cache/block_files.cc +++ b/net/disk_cache/block_files.cc @@ -10,6 +10,8 @@ #include "base/time.h" #include "net/disk_cache/file_lock.h" +using base::Time; + namespace { const wchar_t* kBlockName = L"data_"; diff --git a/net/disk_cache/block_files_unittest.cc b/net/disk_cache/block_files_unittest.cc index 211ba96..8e72820 100644 --- a/net/disk_cache/block_files_unittest.cc +++ b/net/disk_cache/block_files_unittest.cc @@ -9,6 +9,8 @@ #include "net/disk_cache/disk_cache_test_util.h" #include "testing/gtest/include/gtest/gtest.h" +using base::Time; + TEST_F(DiskCacheTest, BlockFiles_Grow) { std::wstring path = GetCachePath(); ASSERT_TRUE(DeleteCache(path.c_str())); diff --git a/net/disk_cache/disk_cache.h b/net/disk_cache/disk_cache.h index 361ecc2..ab01086 100644 --- a/net/disk_cache/disk_cache.h +++ b/net/disk_cache/disk_cache.h @@ -67,11 +67,11 @@ class Backend { // Marks a range of entries for deletion. This supports unbounded deletes in // either direction by using null Time values for either argument. - virtual bool DoomEntriesBetween(const Time initial_time, - const Time end_time) = 0; + virtual bool DoomEntriesBetween(const base::Time initial_time, + const base::Time end_time) = 0; // Marks all entries accessed since initial_time for deletion. - virtual bool DoomEntriesSince(const Time initial_time) = 0; + virtual bool DoomEntriesSince(const base::Time initial_time) = 0; // Enumerate the cache. Initialize iter to NULL before calling this method // the first time. That will cause the enumeration to start at the head of @@ -110,10 +110,10 @@ class Entry { virtual std::string GetKey() const = 0; // Returns the time when this cache entry was last used. - virtual Time GetLastUsed() const = 0; + virtual base::Time GetLastUsed() const = 0; // Returns the time when this cache entry was last modified. - virtual Time GetLastModified() const = 0; + virtual base::Time GetLastModified() const = 0; // Returns the size of the cache data with the given index. virtual int32 GetDataSize(int index) const = 0; diff --git a/net/disk_cache/disk_cache_perftest.cc b/net/disk_cache/disk_cache_perftest.cc index 03998df..c160677 100644 --- a/net/disk_cache/disk_cache_perftest.cc +++ b/net/disk_cache/disk_cache_perftest.cc @@ -22,6 +22,8 @@ #include "net/disk_cache/hash.h" #include "testing/gtest/include/gtest/gtest.h" +using base::Time; + extern int g_cache_tests_max_id; extern volatile int g_cache_tests_received; extern volatile bool g_cache_tests_error; diff --git a/net/disk_cache/disk_cache_test_util.cc b/net/disk_cache/disk_cache_test_util.cc index d82cbb4..3db5c6f 100644 --- a/net/disk_cache/disk_cache_test_util.cc +++ b/net/disk_cache/disk_cache_test_util.cc @@ -10,6 +10,9 @@ #include "net/disk_cache/cache_util.h" #include "net/disk_cache/file.h" +using base::Time; +using base::TimeDelta; + std::string GenerateKey(bool same_length) { char key[200]; CacheTestFillBuffer(key, sizeof(key), same_length); diff --git a/net/disk_cache/entry_impl.cc b/net/disk_cache/entry_impl.cc index 935c9ff..844ff40 100644 --- a/net/disk_cache/entry_impl.cc +++ b/net/disk_cache/entry_impl.cc @@ -11,6 +11,9 @@ #include "net/disk_cache/backend_impl.h" #include "net/disk_cache/cache_util.h" +using base::Time; +using base::TimeDelta; + namespace { // This is a simple Task to execute the callback (from the message loop instead diff --git a/net/disk_cache/entry_impl.h b/net/disk_cache/entry_impl.h index 56ebfc4..64fa75b 100644 --- a/net/disk_cache/entry_impl.h +++ b/net/disk_cache/entry_impl.h @@ -24,8 +24,8 @@ class EntryImpl : public Entry, public base::RefCounted<EntryImpl> { virtual void Doom(); virtual void Close(); virtual std::string GetKey() const; - virtual Time GetLastUsed() const; - virtual Time GetLastModified() const; + virtual base::Time GetLastUsed() const; + virtual base::Time GetLastModified() const; virtual int32 GetDataSize(int index) const; virtual int ReadData(int index, int offset, char* buf, int buf_len, net::CompletionCallback* completion_callback); diff --git a/net/disk_cache/entry_unittest.cc b/net/disk_cache/entry_unittest.cc index 7e0ba8a..9793649 100644 --- a/net/disk_cache/entry_unittest.cc +++ b/net/disk_cache/entry_unittest.cc @@ -11,6 +11,8 @@ #include "net/disk_cache/entry_impl.h" #include "testing/gtest/include/gtest/gtest.h" +using base::Time; + extern int g_cache_tests_max_id; extern volatile int g_cache_tests_received; extern volatile bool g_cache_tests_error; diff --git a/net/disk_cache/mem_backend_impl.cc b/net/disk_cache/mem_backend_impl.cc index 4180a9d..a0cf3cc 100644 --- a/net/disk_cache/mem_backend_impl.cc +++ b/net/disk_cache/mem_backend_impl.cc @@ -8,6 +8,8 @@ #include "net/disk_cache/cache_util.h" #include "net/disk_cache/mem_entry_impl.h" +using base::Time; + namespace { const int kDefaultCacheSize = 10 * 1024 * 1024; diff --git a/net/disk_cache/mem_backend_impl.h b/net/disk_cache/mem_backend_impl.h index 7573c90..2c23a67 100644 --- a/net/disk_cache/mem_backend_impl.h +++ b/net/disk_cache/mem_backend_impl.h @@ -32,8 +32,9 @@ class MemBackendImpl : public Backend { virtual bool CreateEntry(const std::string& key, Entry** entry); virtual bool DoomEntry(const std::string& key); virtual bool DoomAllEntries(); - virtual bool DoomEntriesBetween(const Time initial_time, const Time end_time); - virtual bool DoomEntriesSince(const Time initial_time); + virtual bool DoomEntriesBetween(const base::Time initial_time, + const base::Time end_time); + virtual bool DoomEntriesSince(const base::Time initial_time); virtual bool OpenNextEntry(void** iter, Entry** next_entry); virtual void EndEnumeration(void** iter); virtual void GetStats( diff --git a/net/disk_cache/mem_entry_impl.cc b/net/disk_cache/mem_entry_impl.cc index 66e4bcb..2bbf4a5 100644 --- a/net/disk_cache/mem_entry_impl.cc +++ b/net/disk_cache/mem_entry_impl.cc @@ -7,6 +7,8 @@ #include "net/base/net_errors.h" #include "net/disk_cache/mem_backend_impl.h" +using base::Time; + namespace disk_cache { MemEntryImpl::MemEntryImpl(MemBackendImpl* backend) { diff --git a/net/disk_cache/mem_entry_impl.h b/net/disk_cache/mem_entry_impl.h index 17227bf..98c3e4a 100644 --- a/net/disk_cache/mem_entry_impl.h +++ b/net/disk_cache/mem_entry_impl.h @@ -21,8 +21,8 @@ class MemEntryImpl : public Entry { virtual void Doom(); virtual void Close(); virtual std::string GetKey() const; - virtual Time GetLastUsed() const; - virtual Time GetLastModified() const; + virtual base::Time GetLastUsed() const; + virtual base::Time GetLastModified() const; virtual int32 GetDataSize(int index) const; virtual int ReadData(int index, int offset, char* buf, int buf_len, net::CompletionCallback* completion_callback); @@ -72,8 +72,8 @@ class MemEntryImpl : public Entry { MemEntryImpl* next_; // Pointers for the LRU list. MemEntryImpl* prev_; - Time last_modified_; // LRU information. - Time last_used_; + base::Time last_modified_; // LRU information. + base::Time last_used_; MemBackendImpl* backend_; // Back pointer to the cache. bool doomed_; // True if this entry was removed from the cache. diff --git a/net/disk_cache/rankings.cc b/net/disk_cache/rankings.cc index ad5eef9..82e5c7b 100644 --- a/net/disk_cache/rankings.cc +++ b/net/disk_cache/rankings.cc @@ -9,6 +9,8 @@ #include "net/disk_cache/entry_impl.h" #include "net/disk_cache/errors.h" +using base::Time; + // This is used by crash_cache.exe to generate unit test files. disk_cache::RankCrashes g_rankings_crash = disk_cache::NO_CRASH; @@ -676,4 +678,3 @@ void Rankings::UpdateIterators(CacheRankingsBlock* node) { } } // namespace disk_cache - diff --git a/net/disk_cache/stress_cache.cc b/net/disk_cache/stress_cache.cc index 864309a..dde20ff 100644 --- a/net/disk_cache/stress_cache.cc +++ b/net/disk_cache/stress_cache.cc @@ -22,6 +22,8 @@ #include "net/disk_cache/disk_cache.h" #include "net/disk_cache/disk_cache_test_util.h" +using base::Time; + const int kError = -1; const int kExpectedCrash = 1000000; diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc index 10fa6b0..4c00738 100644 --- a/net/http/http_cache.cc +++ b/net/http/http_cache.cc @@ -21,6 +21,8 @@ #include "net/http/http_transaction.h" #include "net/http/http_util.h" +using base::Time; + namespace net { // disk cache entry data indices. diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc index b715aa6..92ac6ca 100644 --- a/net/http/http_cache_unittest.cc +++ b/net/http/http_cache_unittest.cc @@ -16,6 +16,8 @@ #include "net/http/http_transaction_unittest.h" #include "testing/gtest/include/gtest/gtest.h" +using base::Time; + namespace { //----------------------------------------------------------------------------- diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc index 5ef592a..cad17af 100644 --- a/net/http/http_network_transaction.cc +++ b/net/http/http_network_transaction.cc @@ -28,6 +28,8 @@ // + pre-emptive authorization // + use the username/password encoded in the URL. +using base::Time; + namespace net { //----------------------------------------------------------------------------- diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc index 1a7ea57..8c80c49 100644 --- a/net/http/http_response_headers.cc +++ b/net/http/http_response_headers.cc @@ -18,6 +18,9 @@ #include "net/base/escape.h" #include "net/http/http_util.h" +using base::Time; +using base::TimeDelta; + namespace net { //----------------------------------------------------------------------------- diff --git a/net/http/http_response_headers.h b/net/http/http_response_headers.h index feba262..3edb070 100644 --- a/net/http/http_response_headers.h +++ b/net/http/http_response_headers.h @@ -14,8 +14,11 @@ #include "net/http/http_version.h" class Pickle; + +namespace base { class Time; class TimeDelta; +} namespace net { @@ -150,33 +153,33 @@ class HttpResponseHeaders : // support unit testing. The request_time parameter indicates the time at // which the request was made that resulted in this response, which was // received at response_time. - bool RequiresValidation(const Time& request_time, - const Time& response_time, - const Time& current_time) const; + bool RequiresValidation(const base::Time& request_time, + const base::Time& response_time, + const base::Time& current_time) const; // Returns the amount of time the server claims the response is fresh from // the time the response was generated. See section 13.2.4 of RFC 2616. See // RequiresValidation for a description of the response_time parameter. - TimeDelta GetFreshnessLifetime(const Time& response_time) const; + base::TimeDelta GetFreshnessLifetime(const base::Time& response_time) const; // Returns the age of the response. See section 13.2.3 of RFC 2616. // See RequiresValidation for a description of this method's parameters. - TimeDelta GetCurrentAge(const Time& request_time, - const Time& response_time, - const Time& current_time) const; + base::TimeDelta GetCurrentAge(const base::Time& request_time, + const base::Time& response_time, + const base::Time& current_time) const; // The following methods extract values from the response headers. If a // value is not present, then false is returned. Otherwise, true is returned // and the out param is assigned to the corresponding value. - bool GetMaxAgeValue(TimeDelta* value) const; - bool GetAgeValue(TimeDelta* value) const; - bool GetDateValue(Time* value) const; - bool GetLastModifiedValue(Time* value) const; - bool GetExpiresValue(Time* value) const; + bool GetMaxAgeValue(base::TimeDelta* value) const; + bool GetAgeValue(base::TimeDelta* value) const; + bool GetDateValue(base::Time* value) const; + bool GetLastModifiedValue(base::Time* value) const; + bool GetExpiresValue(base::Time* value) const; // Extracts the time value of a particular header. This method looks for the // first matching header value and parses its value as a HTTP-date. - bool GetTimeValuedHeader(const std::string& name, Time* result) const; + bool GetTimeValuedHeader(const std::string& name, base::Time* result) const; // Determines if this response indicates a keep-alive connection. bool IsKeepAlive() const; @@ -284,4 +287,3 @@ class HttpResponseHeaders : } // namespace net #endif // NET_HTTP_RESPONSE_HEADERS_H_ - diff --git a/net/http/http_response_headers_unittest.cc b/net/http/http_response_headers_unittest.cc index df3add4..fa5cbaa 100644 --- a/net/http/http_response_headers_unittest.cc +++ b/net/http/http_response_headers_unittest.cc @@ -11,6 +11,7 @@ #include "testing/gtest/include/gtest/gtest.h" using namespace std; +using base::Time; using net::HttpResponseHeaders; using net::HttpVersion; diff --git a/net/http/http_response_info.h b/net/http/http_response_info.h index ee0767f..80defef 100644 --- a/net/http/http_response_info.h +++ b/net/http/http_response_info.h @@ -17,11 +17,11 @@ class HttpResponseInfo { public: // The time at which the request was made that resulted in this response. // For cached responses, this time could be "far" in the past. - Time request_time; + base::Time request_time; // The time at which the response headers were received. For cached // responses, this time could be "far" in the past. - Time response_time; + base::Time response_time; // If the response headers indicate a 401 or 407 failure, then this structure // will contain additional information about the authentication challenge. diff --git a/net/http/http_transaction_unittest.h b/net/http/http_transaction_unittest.h index 0b8a1c9..93f76c7 100644 --- a/net/http/http_transaction_unittest.h +++ b/net/http/http_transaction_unittest.h @@ -211,8 +211,8 @@ class MockNetworkTransaction : public net::HttpTransaction { StringPrintf("%s\n%s\n", resp_status.c_str(), resp_headers.c_str()); std::replace(header_data.begin(), header_data.end(), '\n', '\0'); - response_.request_time = Time::Now(); - response_.response_time = Time::Now(); + response_.request_time = base::Time::Now(); + response_.response_time = base::Time::Now(); response_.headers = new net::HttpResponseHeaders(header_data); response_.ssl_info.cert_status = t->cert_status; data_ = resp_data; diff --git a/net/http/http_transaction_winhttp.cc b/net/http/http_transaction_winhttp.cc index 550f32a..0dfb9db 100644 --- a/net/http/http_transaction_winhttp.cc +++ b/net/http/http_transaction_winhttp.cc @@ -29,6 +29,8 @@ #pragma comment(lib, "winhttp.lib") #pragma warning(disable: 4355) +using base::Time; + namespace net { static int TranslateOSError(DWORD error) { diff --git a/net/proxy/proxy_resolver_winhttp.cc b/net/proxy/proxy_resolver_winhttp.cc index 2a12e06..5a16df5 100644 --- a/net/proxy/proxy_resolver_winhttp.cc +++ b/net/proxy/proxy_resolver_winhttp.cc @@ -12,6 +12,9 @@ #pragma comment(lib, "winhttp.lib") +using base::TimeDelta; +using base::TimeTicks; + namespace net { // A small wrapper for histogramming purposes ;-) diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc index be11692..52d8491 100644 --- a/net/proxy/proxy_service.cc +++ b/net/proxy/proxy_service.cc @@ -18,6 +18,9 @@ #include "googleurl/src/gurl.h" #include "net/base/net_errors.h" +using base::TimeDelta; +using base::TimeTicks; + namespace net { // ProxyConfig ---------------------------------------------------------------- diff --git a/net/proxy/proxy_service.h b/net/proxy/proxy_service.h index 5ca41e8..c596aab 100644 --- a/net/proxy/proxy_service.h +++ b/net/proxy/proxy_service.h @@ -65,11 +65,11 @@ class ProxyConfig { // Contains the information about when to retry a proxy server. struct ProxyRetryInfo { // We should not retry until this time. - TimeTicks bad_until; + base::TimeTicks bad_until; // This is the current delay. If the proxy is still bad, we need to increase // this delay. - TimeDelta current_delay; + base::TimeDelta current_delay; }; // Map of proxy servers with the associated RetryInfo structures. @@ -161,7 +161,7 @@ class ProxyService { bool config_is_bad_; // The time when the proxy configuration was last read from the system. - TimeTicks config_last_update_time_; + base::TimeTicks config_last_update_time_; // Map of the known bad proxies and the information about the retry time. ProxyRetryInfoMap proxy_retry_info_; diff --git a/net/tools/crash_cache/crash_cache.cc b/net/tools/crash_cache/crash_cache.cc index e6a5522..243ed45 100644 --- a/net/tools/crash_cache/crash_cache.cc +++ b/net/tools/crash_cache/crash_cache.cc @@ -22,6 +22,8 @@ #include "net/disk_cache/disk_cache_test_util.h" #include "net/disk_cache/rankings.h" +using base::Time; + enum Errors { GENERIC = -1, ALL_GOOD = 0, diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc index 8c6d5f3..22372db 100644 --- a/net/url_request/url_request.cc +++ b/net/url_request/url_request.cc @@ -20,6 +20,7 @@ URLRequestMetrics url_request_metrics; #endif +using base::Time; using net::UploadData; using std::string; using std::wstring; @@ -335,4 +336,3 @@ int64 URLRequest::GetExpectedContentSize() const { return expected_content_size; } - diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h index 549665f..1f5a06e 100644 --- a/net/url_request/url_request.h +++ b/net/url_request/url_request.h @@ -286,13 +286,13 @@ class URLRequest { // The time at which the returned response was requested. For cached // responses, this may be a time well in the past. - const Time& request_time() const { + const base::Time& request_time() const { return response_info_.request_time; } // The time at which the returned response was generated. For cached // responses, this may be a time well in the past. - const Time& response_time() const { + const base::Time& response_time() const { return response_info_.response_time; } diff --git a/net/url_request/url_request_job.cc b/net/url_request/url_request_job.cc index 10323f6..dc372ba 100644 --- a/net/url_request/url_request_job.cc +++ b/net/url_request/url_request_job.cc @@ -13,6 +13,9 @@ #include "net/url_request/url_request_job_metrics.h" #include "net/url_request/url_request_job_tracker.h" +using base::Time; +using base::TimeTicks; + // Buffer size allocated when de-compressing data. static const int kFilterBufSize = 32 * 1024; @@ -498,4 +501,3 @@ void URLRequestJob::SetStatus(const URLRequestStatus &status) { if (request_) request_->set_status(status); } - diff --git a/net/url_request/url_request_job_metrics.cc b/net/url_request/url_request_job_metrics.cc index ecb717f..8db26fb 100644 --- a/net/url_request/url_request_job_metrics.cc +++ b/net/url_request/url_request_job_metrics.cc @@ -7,6 +7,8 @@ #include "base/basictypes.h" #include "base/string_util.h" +using base::TimeDelta; + void URLRequestJobMetrics::AppendText(std::wstring* text) { if (!text) return; diff --git a/net/url_request/url_request_job_metrics.h b/net/url_request/url_request_job_metrics.h index 950d0ae..5e6de7f 100644 --- a/net/url_request/url_request_job_metrics.h +++ b/net/url_request/url_request_job_metrics.h @@ -28,10 +28,10 @@ class URLRequestJobMetrics { scoped_ptr<GURL> url_; // Time when the job starts. - TimeTicks start_time_; + base::TimeTicks start_time_; // Time when the job is done. - TimeTicks end_time_; + base::TimeTicks end_time_; // Total number of bytes the job reads from underline IO. int total_bytes_read_; diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index 9bf467f..cd21a2d 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc @@ -26,6 +26,8 @@ #include "net/url_request/url_request.h" #include "testing/gtest/include/gtest/gtest.h" +using base::Time; + namespace { class URLRequestTest : public testing::Test { |