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

Side by Side Diff: services/preferences/tracked/pref_hash_store_impl.cc

Issue 2919253002: Don't move raw pointers in services (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « no previous file | services/ui/public/cpp/bitmap/child_shared_bitmap_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "services/preferences/tracked/pref_hash_store_impl.h" 5 #include "services/preferences/tracked/pref_hash_store_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 const std::string& legacy_device_id, 83 const std::string& legacy_device_id,
84 bool use_super_mac) 84 bool use_super_mac)
85 : pref_hash_calculator_(seed, GenerateDeviceId(), legacy_device_id), 85 : pref_hash_calculator_(seed, GenerateDeviceId(), legacy_device_id),
86 use_super_mac_(use_super_mac) {} 86 use_super_mac_(use_super_mac) {}
87 87
88 PrefHashStoreImpl::~PrefHashStoreImpl() {} 88 PrefHashStoreImpl::~PrefHashStoreImpl() {}
89 89
90 std::unique_ptr<PrefHashStoreTransaction> PrefHashStoreImpl::BeginTransaction( 90 std::unique_ptr<PrefHashStoreTransaction> PrefHashStoreImpl::BeginTransaction(
91 HashStoreContents* storage) { 91 HashStoreContents* storage) {
92 return std::unique_ptr<PrefHashStoreTransaction>( 92 return std::unique_ptr<PrefHashStoreTransaction>(
93 new PrefHashStoreTransactionImpl(this, std::move(storage))); 93 new PrefHashStoreTransactionImpl(this, storage));
94 } 94 }
95 95
96 std::string PrefHashStoreImpl::ComputeMac(const std::string& path, 96 std::string PrefHashStoreImpl::ComputeMac(const std::string& path,
97 const base::Value* value) { 97 const base::Value* value) {
98 return pref_hash_calculator_.Calculate(path, value); 98 return pref_hash_calculator_.Calculate(path, value);
99 } 99 }
100 100
101 std::unique_ptr<base::DictionaryValue> PrefHashStoreImpl::ComputeSplitMacs( 101 std::unique_ptr<base::DictionaryValue> PrefHashStoreImpl::ComputeSplitMacs(
102 const std::string& path, 102 const std::string& path,
103 const base::DictionaryValue* split_values) { 103 const base::DictionaryValue* split_values) {
(...skipping 15 matching lines...) Expand all
119 it.key(), ComputeMac(keyed_path, &it.value())); 119 it.key(), ComputeMac(keyed_path, &it.value()));
120 } 120 }
121 121
122 return split_macs; 122 return split_macs;
123 } 123 }
124 124
125 PrefHashStoreImpl::PrefHashStoreTransactionImpl::PrefHashStoreTransactionImpl( 125 PrefHashStoreImpl::PrefHashStoreTransactionImpl::PrefHashStoreTransactionImpl(
126 PrefHashStoreImpl* outer, 126 PrefHashStoreImpl* outer,
127 HashStoreContents* storage) 127 HashStoreContents* storage)
128 : outer_(outer), 128 : outer_(outer),
129 contents_(std::move(storage)), 129 contents_(storage),
130 super_mac_valid_(false), 130 super_mac_valid_(false),
131 super_mac_dirty_(false) { 131 super_mac_dirty_(false) {
132 if (!outer_->use_super_mac_) 132 if (!outer_->use_super_mac_)
133 return; 133 return;
134 134
135 // The store must have a valid super MAC to be trusted. 135 // The store must have a valid super MAC to be trusted.
136 std::string super_mac = contents_->GetSuperMac(); 136 std::string super_mac = contents_->GetSuperMac();
137 if (super_mac.empty()) 137 if (super_mac.empty())
138 return; 138 return;
139 139
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 bool PrefHashStoreImpl::PrefHashStoreTransactionImpl::IsSuperMACValid() const { 312 bool PrefHashStoreImpl::PrefHashStoreTransactionImpl::IsSuperMACValid() const {
313 return super_mac_valid_; 313 return super_mac_valid_;
314 } 314 }
315 315
316 bool PrefHashStoreImpl::PrefHashStoreTransactionImpl::StampSuperMac() { 316 bool PrefHashStoreImpl::PrefHashStoreTransactionImpl::StampSuperMac() {
317 if (!outer_->use_super_mac_ || super_mac_valid_) 317 if (!outer_->use_super_mac_ || super_mac_valid_)
318 return false; 318 return false;
319 super_mac_dirty_ = true; 319 super_mac_dirty_ = true;
320 return true; 320 return true;
321 } 321 }
OLDNEW
« no previous file with comments | « no previous file | services/ui/public/cpp/bitmap/child_shared_bitmap_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698