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

Side by Side Diff: content/browser/download/download_request_core.cc

Issue 2867803002: Add a metric to record http response code for download requests. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/download/download_stats.h » ('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 "content/browser/download/download_request_core.h" 5 #include "content/browser/download/download_request_core.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 DCHECK_CURRENTLY_ON(BrowserThread::IO); 244 DCHECK_CURRENTLY_ON(BrowserThread::IO);
245 DVLOG(20) << __func__ << "() " << DebugString(); 245 DVLOG(20) << __func__ << "() " << DebugString();
246 download_start_time_ = base::TimeTicks::Now(); 246 download_start_time_ = base::TimeTicks::Now();
247 247
248 DownloadInterruptReason result = 248 DownloadInterruptReason result =
249 request()->response_headers() 249 request()->response_headers()
250 ? HandleSuccessfulServerResponse(*request()->response_headers(), 250 ? HandleSuccessfulServerResponse(*request()->response_headers(),
251 save_info_.get()) 251 save_info_.get())
252 : DOWNLOAD_INTERRUPT_REASON_NONE; 252 : DOWNLOAD_INTERRUPT_REASON_NONE;
253 253
254 if (request()->response_headers()) {
255 RecordDownloadHttpResponseCode(
256 request()->response_headers()->response_code());
257 }
258
254 std::unique_ptr<DownloadCreateInfo> create_info = 259 std::unique_ptr<DownloadCreateInfo> create_info =
255 CreateDownloadCreateInfo(result); 260 CreateDownloadCreateInfo(result);
256 if (result != DOWNLOAD_INTERRUPT_REASON_NONE) { 261 if (result != DOWNLOAD_INTERRUPT_REASON_NONE) {
257 delegate_->OnStart(std::move(create_info), 262 delegate_->OnStart(std::move(create_info),
258 std::unique_ptr<ByteStreamReader>(), 263 std::unique_ptr<ByteStreamReader>(),
259 base::ResetAndReturn(&on_started_callback_)); 264 base::ResetAndReturn(&on_started_callback_));
260 return false; 265 return false;
261 } 266 }
262 267
263 // If it's a download, we don't want to poison the cache with it. 268 // If it's a download, we don't want to poison the cache with it.
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 // old servers that didn't implement "If-Match" and must be ignored when 681 // old servers that didn't implement "If-Match" and must be ignored when
677 // "If-Match" presents. 682 // "If-Match" presents.
678 if (has_last_modified) { 683 if (has_last_modified) {
679 request->SetExtraRequestHeaderByName( 684 request->SetExtraRequestHeaderByName(
680 net::HttpRequestHeaders::kIfUnmodifiedSince, params->last_modified(), 685 net::HttpRequestHeaders::kIfUnmodifiedSince, params->last_modified(),
681 true); 686 true);
682 } 687 }
683 } 688 }
684 689
685 } // namespace content 690 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/download/download_stats.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698