Chromium Code Reviews| Index: content/common/resource_dispatcher.cc |
| diff --git a/content/common/resource_dispatcher.cc b/content/common/resource_dispatcher.cc |
| index b4addcb82f7b1227b05b098bf22118b86e6301aa..e99a1c4ab90fb55d2f8bc11edbd9c0a87751f304 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,12 @@ void ResourceDispatcher::OnReceivedResponse( |
| PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); |
| if (!request_info) |
| return; |
| - request_info->response_start = base::TimeTicks::Now(); |
| + if (io_timestamp_ == base::TimeTicks()) |
| + request_info->response_start = base::TimeTicks::Now(); |
| + else { |
| + request_info->response_start = io_timestamp_; |
| + io_timestamp_ = base::TimeTicks(); |
| + } |
| if (delegate_) { |
| ResourceLoaderBridge::Peer* new_peer = |
| @@ -447,7 +453,12 @@ void ResourceDispatcher::OnReceivedRedirect( |
| PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); |
| if (!request_info) |
| return; |
| - request_info->response_start = base::TimeTicks::Now(); |
| + if (io_timestamp_ == base::TimeTicks()) |
| + request_info->response_start = base::TimeTicks::Now(); |
| + else { |
| + request_info->response_start = io_timestamp_; |
| + io_timestamp_ = base::TimeTicks(); |
| + } |
| int32 routing_id = message.routing_id(); |
| bool has_new_first_party_for_cookies = false; |
| @@ -491,7 +502,12 @@ void ResourceDispatcher::OnRequestComplete( |
| PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); |
| if (!request_info) |
| return; |
| - request_info->completion_time = base::TimeTicks::Now(); |
| + if (io_timestamp_ == base::TimeTicks()) |
| + request_info->completion_time = base::TimeTicks::Now(); |
| + else { |
| + request_info->completion_time = io_timestamp_; |
| + io_timestamp_ = base::TimeTicks(); |
| + } |
|
Charlie Reis
2013/05/23 20:13:11
Please abstract this into a helper method rather t
eustas
2013/05/24 15:22:28
Done.
|
| request_info->buffer.reset(); |
| request_info->buffer_size = 0; |