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

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: Fix an issue for tests, some tests don't have response headers. 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 DCHECK_CURRENTLY_ON(BrowserThread::IO); 246 DCHECK_CURRENTLY_ON(BrowserThread::IO);
247 DVLOG(20) << __func__ << "() " << DebugString(); 247 DVLOG(20) << __func__ << "() " << DebugString();
248 download_start_time_ = base::TimeTicks::Now(); 248 download_start_time_ = base::TimeTicks::Now();
249 249
250 DownloadInterruptReason result = 250 DownloadInterruptReason result =
251 request()->response_headers() 251 request()->response_headers()
252 ? HandleSuccessfulServerResponse(*request()->response_headers(), 252 ? HandleSuccessfulServerResponse(*request()->response_headers(),
253 save_info_.get()) 253 save_info_.get())
254 : DOWNLOAD_INTERRUPT_REASON_NONE; 254 : DOWNLOAD_INTERRUPT_REASON_NONE;
255 255
256 if (request()->response_headers()) {
257 RecordDownloadHttpResponseCode(
258 request()->response_headers()->response_code());
259 }
260
256 std::unique_ptr<DownloadCreateInfo> create_info = 261 std::unique_ptr<DownloadCreateInfo> create_info =
257 CreateDownloadCreateInfo(result); 262 CreateDownloadCreateInfo(result);
258 if (result != DOWNLOAD_INTERRUPT_REASON_NONE) { 263 if (result != DOWNLOAD_INTERRUPT_REASON_NONE) {
259 delegate_->OnStart(std::move(create_info), 264 delegate_->OnStart(std::move(create_info),
260 std::unique_ptr<ByteStreamReader>(), 265 std::unique_ptr<ByteStreamReader>(),
261 base::ResetAndReturn(&on_started_callback_)); 266 base::ResetAndReturn(&on_started_callback_));
262 return false; 267 return false;
263 } 268 }
264 269
265 // If it's a download, we don't want to poison the cache with it. 270 // 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
692 // old servers that didn't implement "If-Match" and must be ignored when 697 // old servers that didn't implement "If-Match" and must be ignored when
693 // "If-Match" presents. 698 // "If-Match" presents.
694 if (has_last_modified) { 699 if (has_last_modified) {
695 request->SetExtraRequestHeaderByName( 700 request->SetExtraRequestHeaderByName(
696 net::HttpRequestHeaders::kIfUnmodifiedSince, params->last_modified(), 701 net::HttpRequestHeaders::kIfUnmodifiedSince, params->last_modified(),
697 true); 702 true);
698 } 703 }
699 } 704 }
700 705
701 } // namespace content 706 } // 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