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

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

Issue 1140273002: Replace GetAllErrorCodesForUma calls with UMA_HISTOGRAM_SPARSE_SLOWLY. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fallback-type
Patch Set: asvitkine comment Created 5 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 | « components/error_page/renderer/net_error_helper_core.cc ('k') | net/base/net_errors.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_resource_handler.h" 5 #include "content/browser/download/download_resource_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/message_loop/message_loop_proxy.h" 11 #include "base/message_loop/message_loop_proxy.h"
12 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram_macros.h"
13 #include "base/metrics/sparse_histogram.h"
13 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
14 #include "content/browser/byte_stream.h" 15 #include "content/browser/byte_stream.h"
15 #include "content/browser/download/download_create_info.h" 16 #include "content/browser/download/download_create_info.h"
16 #include "content/browser/download/download_interrupt_reasons_impl.h" 17 #include "content/browser/download/download_interrupt_reasons_impl.h"
17 #include "content/browser/download/download_manager_impl.h" 18 #include "content/browser/download/download_manager_impl.h"
18 #include "content/browser/download/download_request_handle.h" 19 #include "content/browser/download/download_request_handle.h"
19 #include "content/browser/download/download_stats.h" 20 #include "content/browser/download/download_stats.h"
20 #include "content/browser/loader/resource_dispatcher_host_impl.h" 21 #include "content/browser/loader/resource_dispatcher_host_impl.h"
21 #include "content/browser/loader/resource_request_info_impl.h" 22 #include "content/browser/loader/resource_request_info_impl.h"
22 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 CallStartedCB(NULL, reason); 447 CallStartedCB(NULL, reason);
447 448
448 // Send the info down the stream. Conditional is in case we get 449 // Send the info down the stream. Conditional is in case we get
449 // OnResponseCompleted without OnResponseStarted. 450 // OnResponseCompleted without OnResponseStarted.
450 if (stream_writer_) 451 if (stream_writer_)
451 stream_writer_->Close(reason); 452 stream_writer_->Close(reason);
452 453
453 // If the error mapped to something unknown, record it so that 454 // If the error mapped to something unknown, record it so that
454 // we can drill down. 455 // we can drill down.
455 if (reason == DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED) { 456 if (reason == DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED) {
456 UMA_HISTOGRAM_CUSTOM_ENUMERATION("Download.MapErrorNetworkFailed", 457 UMA_HISTOGRAM_SPARSE_SLOWLY("Download.MapErrorNetworkFailed",
457 std::abs(status.error()), 458 std::abs(status.error()));
458 net::GetAllErrorCodesForUma());
459 } 459 }
460 460
461 stream_writer_.reset(); // We no longer need the stream. 461 stream_writer_.reset(); // We no longer need the stream.
462 read_buffer_ = NULL; 462 read_buffer_ = NULL;
463 } 463 }
464 464
465 void DownloadResourceHandler::OnDataDownloaded(int bytes_downloaded) { 465 void DownloadResourceHandler::OnDataDownloaded(int bytes_downloaded) {
466 NOTREACHED(); 466 NOTREACHED();
467 } 467 }
468 468
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 BrowserThread::PostTask( 538 BrowserThread::PostTask(
539 BrowserThread::UI, FROM_HERE, 539 BrowserThread::UI, FROM_HERE,
540 base::Bind(&DeleteOnUIThread, base::Passed(&tab_info_))); 540 base::Bind(&DeleteOnUIThread, base::Passed(&tab_info_)));
541 } 541 }
542 542
543 UMA_HISTOGRAM_TIMES("SB2.DownloadDuration", 543 UMA_HISTOGRAM_TIMES("SB2.DownloadDuration",
544 base::TimeTicks::Now() - download_start_time_); 544 base::TimeTicks::Now() - download_start_time_);
545 } 545 }
546 546
547 } // namespace content 547 } // namespace content
OLDNEW
« no previous file with comments | « components/error_page/renderer/net_error_helper_core.cc ('k') | net/base/net_errors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698