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

Side by Side Diff: chrome/browser/safe_browsing/certificate_reporting_service.cc

Issue 2561963002: base: Remove the string logging from CHECK(). (Closed)
Patch Set: checkstring: rebase Created 4 years 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/time/clock.h" 5 #include "base/time/clock.h"
6 #include "base/time/default_clock.h" 6 #include "base/time/default_clock.h"
7 #include "chrome/browser/safe_browsing/certificate_reporting_service.h" 7 #include "chrome/browser/safe_browsing/certificate_reporting_service.h"
8 #include "content/public/browser/browser_thread.h" 8 #include "content/public/browser/browser_thread.h"
9 9
10 namespace { 10 namespace {
11 // Compare function that orders Reports in reverse chronological order (i.e. 11 // Compare function that orders Reports in reverse chronological order (i.e.
12 // oldest item is last). 12 // oldest item is last).
13 bool ReportCompareFunc(const CertificateReportingService::Report& item1, 13 bool ReportCompareFunc(const CertificateReportingService::Report& item1,
14 const CertificateReportingService::Report& item2) { 14 const CertificateReportingService::Report& item2) {
15 return item1.creation_time > item2.creation_time; 15 return item1.creation_time > item2.creation_time;
16 } 16 }
17 17
18 } // namespace 18 } // namespace
19 19
20 CertificateReportingService::BoundedReportList::BoundedReportList( 20 CertificateReportingService::BoundedReportList::BoundedReportList(
21 size_t max_size) 21 size_t max_size)
22 : max_size_(max_size) { 22 : max_size_(max_size) {
23 CHECK(max_size <= 20) 23 // Current implementation is not efficient for a large list.
24 << "Current implementation is not efficient for a large list."; 24 CHECK(max_size <= 20);
25 DCHECK(thread_checker_.CalledOnValidThread()); 25 DCHECK(thread_checker_.CalledOnValidThread());
26 } 26 }
27 27
28 CertificateReportingService::BoundedReportList::~BoundedReportList() {} 28 CertificateReportingService::BoundedReportList::~BoundedReportList() {}
29 29
30 void CertificateReportingService::BoundedReportList::Add(const Report& item) { 30 void CertificateReportingService::BoundedReportList::Add(const Report& item) {
31 DCHECK(thread_checker_.CalledOnValidThread()); 31 DCHECK(thread_checker_.CalledOnValidThread());
32 DCHECK(items_.size() <= max_size_); 32 DCHECK(items_.size() <= max_size_);
33 if (items_.size() == max_size_) { 33 if (items_.size() == max_size_) {
34 const Report& last = items_.back(); 34 const Report& last = items_.back();
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 auto it = inflight_reports_.find(report_id); 121 auto it = inflight_reports_.find(report_id);
122 DCHECK(it != inflight_reports_.end()); 122 DCHECK(it != inflight_reports_.end());
123 retry_list_->Add(it->second); 123 retry_list_->Add(it->second);
124 CHECK_GT(inflight_reports_.erase(report_id), 0u); 124 CHECK_GT(inflight_reports_.erase(report_id), 0u);
125 } 125 }
126 126
127 void CertificateReportingService::Reporter::SuccessCallback(int report_id) { 127 void CertificateReportingService::Reporter::SuccessCallback(int report_id) {
128 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 128 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
129 CHECK_GT(inflight_reports_.erase(report_id), 0u); 129 CHECK_GT(inflight_reports_.erase(report_id), 0u);
130 } 130 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698