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/data_reduction_proxy/core/browser/data_reduction_proxy_data.cc

Issue 2842833003: Update SupportsUserData uses with unique_ptr. (Closed)
Patch Set: rebase Created 3 years, 7 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 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 "components/data_reduction_proxy/core/browser/data_reduction_proxy_data .h" 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_data .h"
6 6
7 #include "base/memory/ptr_util.h"
7 #include "net/url_request/url_request.h" 8 #include "net/url_request/url_request.h"
8 9
9 namespace data_reduction_proxy { 10 namespace data_reduction_proxy {
10 11
11 const void* const kDataReductionProxyUserDataKey = 12 const void* const kDataReductionProxyUserDataKey =
12 &kDataReductionProxyUserDataKey; 13 &kDataReductionProxyUserDataKey;
13 14
14 DataReductionProxyData::DataReductionProxyData() 15 DataReductionProxyData::DataReductionProxyData()
15 : used_data_reduction_proxy_(false), 16 : used_data_reduction_proxy_(false),
16 lofi_requested_(false), 17 lofi_requested_(false),
(...skipping 25 matching lines...) Expand all
42 } 43 }
43 44
44 DataReductionProxyData* DataReductionProxyData::GetDataAndCreateIfNecessary( 45 DataReductionProxyData* DataReductionProxyData::GetDataAndCreateIfNecessary(
45 net::URLRequest* request) { 46 net::URLRequest* request) {
46 if (!request) 47 if (!request)
47 return nullptr; 48 return nullptr;
48 DataReductionProxyData* data = GetData(*request); 49 DataReductionProxyData* data = GetData(*request);
49 if (data) 50 if (data)
50 return data; 51 return data;
51 data = new DataReductionProxyData(); 52 data = new DataReductionProxyData();
52 request->SetUserData(kDataReductionProxyUserDataKey, data); 53 request->SetUserData(kDataReductionProxyUserDataKey, base::WrapUnique(data));
53 return data; 54 return data;
54 } 55 }
55 56
56 void DataReductionProxyData::ClearData(net::URLRequest* request) { 57 void DataReductionProxyData::ClearData(net::URLRequest* request) {
57 request->RemoveUserData(kDataReductionProxyUserDataKey); 58 request->RemoveUserData(kDataReductionProxyUserDataKey);
58 } 59 }
59 60
60 } // namespace data_reduction_proxy 61 } // namespace data_reduction_proxy
OLDNEW
« no previous file with comments | « chrome/browser/tracing/navigation_tracing.h ('k') | components/data_use_measurement/core/data_use_measurement.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698