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

Side by Side Diff: components/browsing_data/core/counters/browsing_data_counter.cc

Issue 2257793002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/browsing_data/core/counters/browsing_data_counter.h" 5 #include "components/browsing_data/core/counters/browsing_data_counter.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "components/browsing_data/core/browsing_data_utils.h" 10 #include "components/browsing_data/core/browsing_data_utils.h"
(...skipping 27 matching lines...) Expand all
38 return CalculateBeginDeleteTime(static_cast<TimePeriod>(*period_)); 38 return CalculateBeginDeleteTime(static_cast<TimePeriod>(*period_));
39 } 39 }
40 40
41 void BrowsingDataCounter::Restart() { 41 void BrowsingDataCounter::Restart() {
42 DCHECK(initialized_); 42 DCHECK(initialized_);
43 43
44 // If this data type was unchecked for deletion, we do not need to count it. 44 // If this data type was unchecked for deletion, we do not need to count it.
45 if (!pref_service_->GetBoolean(GetPrefName())) 45 if (!pref_service_->GetBoolean(GetPrefName()))
46 return; 46 return;
47 47
48 callback_.Run(base::WrapUnique(new Result(this))); 48 callback_.Run(base::MakeUnique<Result>(this));
49 49
50 Count(); 50 Count();
51 } 51 }
52 52
53 void BrowsingDataCounter::ReportResult(ResultInt value) { 53 void BrowsingDataCounter::ReportResult(ResultInt value) {
54 DCHECK(initialized_); 54 DCHECK(initialized_);
55 callback_.Run(base::WrapUnique(new FinishedResult(this, value))); 55 callback_.Run(base::MakeUnique<FinishedResult>(this, value));
56 } 56 }
57 57
58 void BrowsingDataCounter::ReportResult(std::unique_ptr<Result> result) { 58 void BrowsingDataCounter::ReportResult(std::unique_ptr<Result> result) {
59 DCHECK(initialized_); 59 DCHECK(initialized_);
60 callback_.Run(std::move(result)); 60 callback_.Run(std::move(result));
61 } 61 }
62 62
63 PrefService* BrowsingDataCounter::GetPrefs() const { 63 PrefService* BrowsingDataCounter::GetPrefs() const {
64 return pref_service_; 64 return pref_service_;
65 } 65 }
(...skipping 21 matching lines...) Expand all
87 bool BrowsingDataCounter::FinishedResult::Finished() const { 87 bool BrowsingDataCounter::FinishedResult::Finished() const {
88 return true; 88 return true;
89 } 89 }
90 90
91 BrowsingDataCounter::ResultInt BrowsingDataCounter::FinishedResult::Value() 91 BrowsingDataCounter::ResultInt BrowsingDataCounter::FinishedResult::Value()
92 const { 92 const {
93 return value_; 93 return value_;
94 } 94 }
95 95
96 } // namespace browsing_data 96 } // namespace browsing_data
OLDNEW
« no previous file with comments | « components/bookmarks/browser/bookmark_index_unittest.cc ('k') | components/browsing_data/core/counters/history_counter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698