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

Unified Diff: content/common/resource_dispatcher.cc

Issue 14646006: Inject timestamps to resource messages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed nits Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/resource_dispatcher.h ('k') | content/content_common.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/resource_dispatcher.cc
diff --git a/content/common/resource_dispatcher.cc b/content/common/resource_dispatcher.cc
index b4addcb82f7b1227b05b098bf22118b86e6301aa..a35737245a244271c49c528b52593944f738509f 100644
--- a/content/common/resource_dispatcher.cc
+++ b/content/common/resource_dispatcher.cc
@@ -257,7 +257,8 @@ void IPCResourceLoaderBridge::SyncLoad(SyncLoadResponse* response) {
ResourceDispatcher::ResourceDispatcher(IPC::Sender* sender)
: message_sender_(sender),
weak_factory_(this),
- delegate_(NULL) {
+ delegate_(NULL),
+ io_timestamp_(base::TimeTicks()) {
}
ResourceDispatcher::~ResourceDispatcher() {
@@ -334,7 +335,7 @@ void ResourceDispatcher::OnReceivedResponse(
PendingRequestInfo* request_info = GetPendingRequestInfo(request_id);
if (!request_info)
return;
- request_info->response_start = base::TimeTicks::Now();
+ request_info->response_start = ConsumeIOTimestamp();
if (delegate_) {
ResourceLoaderBridge::Peer* new_peer =
@@ -447,7 +448,7 @@ void ResourceDispatcher::OnReceivedRedirect(
PendingRequestInfo* request_info = GetPendingRequestInfo(request_id);
if (!request_info)
return;
- request_info->response_start = base::TimeTicks::Now();
+ request_info->response_start = ConsumeIOTimestamp();
int32 routing_id = message.routing_id();
bool has_new_first_party_for_cookies = false;
@@ -491,7 +492,7 @@ void ResourceDispatcher::OnRequestComplete(
PendingRequestInfo* request_info = GetPendingRequestInfo(request_id);
if (!request_info)
return;
- request_info->completion_time = base::TimeTicks::Now();
+ request_info->completion_time = ConsumeIOTimestamp();
request_info->buffer.reset();
request_info->buffer_size = 0;
@@ -702,6 +703,14 @@ base::TimeTicks ResourceDispatcher::ToRendererCompletionTime(
return base::TimeTicks::FromInternalValue(result);
}
+base::TimeTicks ResourceDispatcher::ConsumeIOTimestamp() {
+ if (io_timestamp_ == base::TimeTicks())
+ return base::TimeTicks::Now();
+ base::TimeTicks result = io_timestamp_;
+ io_timestamp_ = base::TimeTicks();
+ return result;
+}
+
// static
bool ResourceDispatcher::IsResourceDispatcherMessage(
const IPC::Message& message) {
« no previous file with comments | « content/common/resource_dispatcher.h ('k') | content/content_common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698