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

Side by Side Diff: chrome/browser/android/data_usage/data_use_matcher.cc

Issue 2334613003: Re-write many calls to WrapUnique() with MakeUnique() (Closed)
Patch Set: Changes from review by sky 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 "chrome/browser/android/data_usage/data_use_matcher.h" 5 #include "chrome/browser/android/data_usage/data_use_matcher.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 73 }
74 std::unique_ptr<re2::RE2> pattern(new re2::RE2(url_regex, options)); 74 std::unique_ptr<re2::RE2> pattern(new re2::RE2(url_regex, options));
75 if (!pattern->ok()) { 75 if (!pattern->ok()) {
76 invalid_rules++; 76 invalid_rules++;
77 continue; 77 continue;
78 } 78 }
79 79
80 if (expiration <= now_ticks) 80 if (expiration <= now_ticks)
81 continue; // skip expired matching rules. 81 continue; // skip expired matching rules.
82 DCHECK(!labels.at(i).empty()); 82 DCHECK(!labels.at(i).empty());
83 matching_rules_.push_back(base::WrapUnique(new MatchingRule( 83 matching_rules_.push_back(base::MakeUnique<MatchingRule>(
84 app_package_name, std::move(pattern), labels.at(i), expiration))); 84 app_package_name, std::move(pattern), labels.at(i), expiration));
85 85
86 removed_matching_rule_labels.erase(labels.at(i)); 86 removed_matching_rule_labels.erase(labels.at(i));
87 } 87 }
88 88
89 for (const std::string& label : removed_matching_rule_labels) 89 for (const std::string& label : removed_matching_rule_labels)
90 on_tracking_label_removed_callback_.Run(label); 90 on_tracking_label_removed_callback_.Run(label);
91 91
92 UMA_HISTOGRAM_COUNTS_100("DataUsage.MatchingRulesCount.Valid", 92 UMA_HISTOGRAM_COUNTS_100("DataUsage.MatchingRulesCount.Valid",
93 matching_rules_.size()); 93 matching_rules_.size());
94 UMA_HISTOGRAM_COUNTS_100("DataUsage.MatchingRulesCount.Invalid", 94 UMA_HISTOGRAM_COUNTS_100("DataUsage.MatchingRulesCount.Invalid",
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 return label_; 199 return label_;
200 } 200 }
201 201
202 const base::TimeTicks& DataUseMatcher::MatchingRule::expiration() const { 202 const base::TimeTicks& DataUseMatcher::MatchingRule::expiration() const {
203 return expiration_; 203 return expiration_;
204 } 204 }
205 205
206 } // namespace android 206 } // namespace android
207 207
208 } // namespace chrome 208 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698