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

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

Issue 2862743002: 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
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 RecordDownloadHttpResponseCode(
255 request()->response_headers()->response_code());
256
254 std::unique_ptr<DownloadCreateInfo> create_info = 257 std::unique_ptr<DownloadCreateInfo> create_info =
255 CreateDownloadCreateInfo(result); 258 CreateDownloadCreateInfo(result);
256 if (result != DOWNLOAD_INTERRUPT_REASON_NONE) { 259 if (result != DOWNLOAD_INTERRUPT_REASON_NONE) {
257 delegate_->OnStart(std::move(create_info), 260 delegate_->OnStart(std::move(create_info),
258 std::unique_ptr<ByteStreamReader>(), 261 std::unique_ptr<ByteStreamReader>(),
259 base::ResetAndReturn(&on_started_callback_)); 262 base::ResetAndReturn(&on_started_callback_));
260 return false; 263 return false;
261 } 264 }
262 265
263 // If it's a download, we don't want to poison the cache with it. 266 // If it's a download, we don't want to poison the cache with it.
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 // old servers that didn't implement "If-Match" and must be ignored when 693 // old servers that didn't implement "If-Match" and must be ignored when
691 // "If-Match" presents. 694 // "If-Match" presents.
692 if (has_last_modified) { 695 if (has_last_modified) {
693 request->SetExtraRequestHeaderByName( 696 request->SetExtraRequestHeaderByName(
694 net::HttpRequestHeaders::kIfUnmodifiedSince, params->last_modified(), 697 net::HttpRequestHeaders::kIfUnmodifiedSince, params->last_modified(),
695 true); 698 true);
696 } 699 }
697 } 700 }
698 701
699 } // namespace content 702 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/download/download_stats.h » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698