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

Side by Side Diff: net/url_request/url_request_redirect_job.cc

Issue 16901013: Expose receive header end time for URLRequestRedirectJob (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Patch for landing Created 7 years, 6 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 unified diff | Download patch
« no previous file with comments | « net/url_request/url_request_redirect_job.h ('k') | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/url_request/url_request_redirect_job.h" 5 #include "net/url_request/url_request_redirect_job.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "net/base/load_timing_info.h"
10 11
11 namespace net { 12 namespace net {
12 13
13 URLRequestRedirectJob::URLRequestRedirectJob(URLRequest* request, 14 URLRequestRedirectJob::URLRequestRedirectJob(URLRequest* request,
14 NetworkDelegate* network_delegate, 15 NetworkDelegate* network_delegate,
15 const GURL& redirect_destination, 16 const GURL& redirect_destination,
16 StatusCode http_status_code) 17 StatusCode http_status_code)
17 : URLRequestJob(request, network_delegate), 18 : URLRequestJob(request, network_delegate),
18 redirect_destination_(redirect_destination), 19 redirect_destination_(redirect_destination),
19 http_status_code_(http_status_code), 20 http_status_code_(http_status_code),
20 weak_factory_(this) {} 21 weak_factory_(this) {}
21 22
22 void URLRequestRedirectJob::Start() { 23 void URLRequestRedirectJob::Start() {
23 base::MessageLoop::current()->PostTask( 24 base::MessageLoop::current()->PostTask(
24 FROM_HERE, 25 FROM_HERE,
25 base::Bind(&URLRequestRedirectJob::StartAsync, 26 base::Bind(&URLRequestRedirectJob::StartAsync,
26 weak_factory_.GetWeakPtr())); 27 weak_factory_.GetWeakPtr()));
27 } 28 }
28 29
29 bool URLRequestRedirectJob::IsRedirectResponse(GURL* location, 30 bool URLRequestRedirectJob::IsRedirectResponse(GURL* location,
30 int* http_status_code) { 31 int* http_status_code) {
31 *location = redirect_destination_; 32 *location = redirect_destination_;
32 *http_status_code = http_status_code_; 33 *http_status_code = http_status_code_;
33 return true; 34 return true;
34 } 35 }
35 36
36 URLRequestRedirectJob::~URLRequestRedirectJob() {} 37 URLRequestRedirectJob::~URLRequestRedirectJob() {}
37 38
38 void URLRequestRedirectJob::StartAsync() { 39 void URLRequestRedirectJob::StartAsync() {
40 receive_headers_end_ = base::TimeTicks::Now();
39 NotifyHeadersComplete(); 41 NotifyHeadersComplete();
40 } 42 }
41 43
44 void URLRequestRedirectJob::GetLoadTimingInfo(
45 LoadTimingInfo* load_timing_info) const {
46 // Set send_start and send_end to receive_headers_end_ to keep consistent
47 // with network cache behavior.
48 load_timing_info->send_start = receive_headers_end_;
49 load_timing_info->send_end = receive_headers_end_;
50 load_timing_info->receive_headers_end = receive_headers_end_;
51 }
52
42 } // namespace net 53 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_redirect_job.h ('k') | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698