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

Side by Side Diff: components/search_provider_logos/logo_tracker.cc

Issue 2886933003: Use stricter type checking in UMA_HISTOGRAM_ENUMERATION (Closed)
Patch Set: simplify type checking Created 3 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/search_provider_logos/logo_tracker.h" 5 #include "components/search_provider_logos/logo_tracker.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // and run it on the old value. 128 // and run it on the old value.
129 logo_cache_.reset(cache.release()); 129 logo_cache_.reset(cache.release());
130 } 130 }
131 131
132 void LogoTracker::SetClockForTests(std::unique_ptr<base::Clock> clock) { 132 void LogoTracker::SetClockForTests(std::unique_ptr<base::Clock> clock) {
133 clock_ = std::move(clock); 133 clock_ = std::move(clock);
134 } 134 }
135 135
136 void LogoTracker::ReturnToIdle(int outcome) { 136 void LogoTracker::ReturnToIdle(int outcome) {
137 if (outcome != kDownloadOutcomeNotTracked) { 137 if (outcome != kDownloadOutcomeNotTracked) {
138 UMA_HISTOGRAM_ENUMERATION("NewTabPage.LogoDownloadOutcome", outcome, 138 UMA_HISTOGRAM_ENUMERATION("NewTabPage.LogoDownloadOutcome",
139 static_cast<LogoDownloadOutcome>(outcome),
139 DOWNLOAD_OUTCOME_COUNT); 140 DOWNLOAD_OUTCOME_COUNT);
140 } 141 }
141 // Cancel the current asynchronous operation, if any. 142 // Cancel the current asynchronous operation, if any.
142 fetcher_.reset(); 143 fetcher_.reset();
143 weak_ptr_factory_.InvalidateWeakPtrs(); 144 weak_ptr_factory_.InvalidateWeakPtrs();
144 145
145 // Reset state. 146 // Reset state.
146 is_idle_ = true; 147 is_idle_ = true;
147 cached_logo_.reset(); 148 cached_logo_.reset();
148 is_cached_logo_valid_ = false; 149 is_cached_logo_valid_ = false;
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 int64_t current, 369 int64_t current,
369 int64_t total, 370 int64_t total,
370 int64_t current_network_bytes) { 371 int64_t current_network_bytes) {
371 if (total > kMaxDownloadBytes || current > kMaxDownloadBytes) { 372 if (total > kMaxDownloadBytes || current > kMaxDownloadBytes) {
372 LOG(WARNING) << "Search provider logo exceeded download size limit"; 373 LOG(WARNING) << "Search provider logo exceeded download size limit";
373 ReturnToIdle(DOWNLOAD_OUTCOME_DOWNLOAD_FAILED); 374 ReturnToIdle(DOWNLOAD_OUTCOME_DOWNLOAD_FAILED);
374 } 375 }
375 } 376 }
376 377
377 } // namespace search_provider_logos 378 } // namespace search_provider_logos
OLDNEW
« no previous file with comments | « components/policy/core/common/cloud/device_management_service.cc ('k') | components/signin/core/browser/signin_metrics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698