diff options
author | simonjam@chromium.org <simonjam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-16 01:15:57 +0000 |
---|---|---|
committer | simonjam@chromium.org <simonjam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-16 01:15:57 +0000 |
commit | cb8a8742120db88ae594cc84cb2a046a7fa2cac4 (patch) | |
tree | 0b7e59029a00bea062a19b72c152db3e585a9b54 /net/url_request | |
parent | 4c4fa0299be73c03988278d486dd4d19bd14167e (diff) | |
download | chromium_src-cb8a8742120db88ae594cc84cb2a046a7fa2cac4.zip chromium_src-cb8a8742120db88ae594cc84cb2a046a7fa2cac4.tar.gz chromium_src-cb8a8742120db88ae594cc84cb2a046a7fa2cac4.tar.bz2 |
Use a monotonic clock (TimeTicks) to report network times to WebCore.
Navigation Timing (window.performance.timing) is now spec'd to use monotonically increasing time, so we need to follow suit. Most of this CL is just plumbing TimeTicks through. We already use TimeTicks to implement monotonicallyIncreasingTime() in WebCore.
On Windows, the clock doesn't tick uniformly between processes, so there is a layer in content that corrects for skew.
BUG=None
TEST=Adhoc (ran webtiming-* LayoutTests from Chrome) and content_unittests
Review URL: http://codereview.chromium.org/7602023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114736 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request')
-rw-r--r-- | net/url_request/url_request.cc | 3 | ||||
-rw-r--r-- | net/url_request/url_request.h | 10 |
2 files changed, 8 insertions, 5 deletions
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc index af405d7..0408757 100644 --- a/net/url_request/url_request.cc +++ b/net/url_request/url_request.cc @@ -152,7 +152,8 @@ URLRequest::URLRequest(const GURL& url, Delegate* delegate) ALLOW_THIS_IN_INITIALIZER_LIST(before_request_callback_( base::Bind(&URLRequest::BeforeRequestComplete, base::Unretained(this)))), - has_notified_completion_(false) { + has_notified_completion_(false), + creation_time_(base::TimeTicks::Now()) { SIMPLE_STATS_COUNTER("URLRequestCount"); // Sanity check out environment. diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h index 3deb198..5e3ca80 100644 --- a/net/url_request/url_request.h +++ b/net/url_request/url_request.h @@ -15,6 +15,7 @@ #include "base/memory/linked_ptr.h" #include "base/memory/ref_counted.h" #include "base/string16.h" +#include "base/time.h" #include "base/threading/non_thread_safe.h" #include "googleurl/src/gurl.h" #include "net/base/auth.h" @@ -48,10 +49,6 @@ class AppCacheRequestHandlerTest; class AppCacheURLRequestJobTest; } -namespace base { -class Time; -} // namespace base - // Temporary layering violation to allow existing users of a deprecated // interface. namespace fileapi { @@ -456,6 +453,9 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe) { // the response status line. Restrictions on GetResponseHeaders apply. void GetAllResponseHeaders(std::string* headers); + // The time when |this| was constructed. + base::TimeTicks creation_time() const { return creation_time_; } + // The time at which the returned response was requested. For cached // responses, this is the last time the cache entry was validated. const base::Time& request_time() const { @@ -814,6 +814,8 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe) { AuthCredentials auth_credentials_; scoped_refptr<AuthChallengeInfo> auth_info_; + base::TimeTicks creation_time_; + DISALLOW_COPY_AND_ASSIGN(URLRequest); }; |