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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc

Issue 1873263002: Convert //components/data_reduction_proxy from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address feedback Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc
index a46e1d2cf59ffef45c65497d88ed57be6e6cdde0..302fe806e735183df0fc8f0c6098bc6167a4ba91 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc
@@ -11,7 +11,7 @@
#include "base/command_line.h"
#include "base/location.h"
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_number_conversions.h"
#include "base/trace_event/trace_event.h"
@@ -475,8 +475,9 @@ void DataReductionProxyCompressionStats::InitInt64Pref(const char* pref) {
}
void DataReductionProxyCompressionStats::InitListPref(const char* pref) {
- scoped_ptr<base::ListValue> pref_value = scoped_ptr<base::ListValue>(
- pref_service_->GetList(pref)->DeepCopy());
+ std::unique_ptr<base::ListValue> pref_value =
+ std::unique_ptr<base::ListValue>(
+ pref_service_->GetList(pref)->DeepCopy());
list_pref_map_.add(pref, std::move(pref_value));
}
@@ -637,7 +638,7 @@ void DataReductionProxyCompressionStats::OnConnectionTypeChanged(
}
void DataReductionProxyCompressionStats::OnCurrentDataUsageLoaded(
- scoped_ptr<DataUsageBucket> data_usage) {
+ std::unique_ptr<DataUsageBucket> data_usage) {
DCHECK(current_data_usage_load_status_ == LOADING);
// Exit early if the pref was turned off before loading from storage
@@ -658,7 +659,7 @@ void DataReductionProxyCompressionStats::OnCurrentDataUsageLoaded(
for (const auto& connection_usage : data_usage->connection_usage()) {
for (const auto& site_usage : connection_usage.site_usage()) {
data_usage_map_.set(site_usage.hostname(),
- make_scoped_ptr(new PerSiteDataUsage(site_usage)));
+ base::WrapUnique(new PerSiteDataUsage(site_usage)));
}
}
@@ -1138,7 +1139,7 @@ void DataReductionProxyCompressionStats::RecordDataUsage(
std::string normalized_host = NormalizeHostname(data_usage_host);
auto j = data_usage_map_.add(normalized_host,
- make_scoped_ptr(new PerSiteDataUsage()));
+ base::WrapUnique(new PerSiteDataUsage()));
PerSiteDataUsage* per_site_usage = j.first->second;
per_site_usage->set_hostname(normalized_host);
per_site_usage->set_original_size(per_site_usage->original_size() +
@@ -1153,7 +1154,7 @@ void DataReductionProxyCompressionStats::PersistDataUsage() {
DCHECK(current_data_usage_load_status_ == LOADED);
if (data_usage_map_is_dirty_) {
- scoped_ptr<DataUsageBucket> data_usage_bucket(new DataUsageBucket());
+ std::unique_ptr<DataUsageBucket> data_usage_bucket(new DataUsageBucket());
data_usage_bucket->set_last_updated_timestamp(
data_usage_map_last_updated_.ToInternalValue());
PerConnectionDataUsage* connection_usage =
@@ -1195,7 +1196,7 @@ void DataReductionProxyCompressionStats::GetHistoricalDataUsageImpl(
// This use case is unlikely to occur in practice since current data usage
// should have sufficient time to load before user tries to view data usage.
get_data_usage_callback.Run(
- make_scoped_ptr(new std::vector<DataUsageBucket>()));
+ base::WrapUnique(new std::vector<DataUsageBucket>()));
return;
}
@@ -1206,7 +1207,7 @@ void DataReductionProxyCompressionStats::GetHistoricalDataUsageImpl(
data_usage_map_last_updated_ = base::Time();
// Force the last bucket to be for the current interval.
- scoped_ptr<DataUsageBucket> data_usage_bucket(new DataUsageBucket());
+ std::unique_ptr<DataUsageBucket> data_usage_bucket(new DataUsageBucket());
data_usage_bucket->set_last_updated_timestamp(now.ToInternalValue());
service_->StoreCurrentDataUsageBucket(std::move(data_usage_bucket));
}

Powered by Google App Engine
This is Rietveld 408576698