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

Side by Side Diff: chrome/browser/chromeos/policy/cloud_external_data_manager_base.cc

Issue 1557693002: Convert Pass()→std::move() in //chrome/browser/chromeos/policy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 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 "chrome/browser/chromeos/policy/cloud_external_data_manager_base.h" 5 #include "chrome/browser/chromeos/policy/cloud_external_data_manager_base.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9
10 #include <map> 9 #include <map>
11 #include <string> 10 #include <string>
11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/bind_helpers.h" 15 #include "base/bind_helpers.h"
16 #include "base/callback.h" 16 #include "base/callback.h"
17 #include "base/location.h" 17 #include "base/location.h"
18 #include "base/logging.h" 18 #include "base/logging.h"
19 #include "base/macros.h" 19 #include "base/macros.h"
20 #include "base/sequenced_task_runner.h" 20 #include "base/sequenced_task_runner.h"
21 #include "base/single_thread_task_runner.h" 21 #include "base/single_thread_task_runner.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 scoped_ptr<CloudExternalDataStore> external_data_store) { 164 scoped_ptr<CloudExternalDataStore> external_data_store) {
165 external_data_store_.reset(external_data_store.release()); 165 external_data_store_.reset(external_data_store.release());
166 if (metadata_set_ && external_data_store_) 166 if (metadata_set_ && external_data_store_)
167 external_data_store_->Prune(metadata_); 167 external_data_store_->Prune(metadata_);
168 } 168 }
169 169
170 void CloudExternalDataManagerBase::Backend::Connect( 170 void CloudExternalDataManagerBase::Backend::Connect(
171 scoped_ptr<ExternalPolicyDataFetcher> external_policy_data_fetcher) { 171 scoped_ptr<ExternalPolicyDataFetcher> external_policy_data_fetcher) {
172 DCHECK(!updater_); 172 DCHECK(!updater_);
173 updater_.reset(new ExternalPolicyDataUpdater( 173 updater_.reset(new ExternalPolicyDataUpdater(
174 task_runner_, 174 task_runner_, std::move(external_policy_data_fetcher),
175 external_policy_data_fetcher.Pass(),
176 kMaxParallelFetches)); 175 kMaxParallelFetches));
177 for (FetchCallbackMap::const_iterator it = pending_downloads_.begin(); 176 for (FetchCallbackMap::const_iterator it = pending_downloads_.begin();
178 it != pending_downloads_.end(); ++it) { 177 it != pending_downloads_.end(); ++it) {
179 StartDownload(it->first); 178 StartDownload(it->first);
180 } 179 }
181 } 180 }
182 181
183 void CloudExternalDataManagerBase::Backend::Disconnect() { 182 void CloudExternalDataManagerBase::Backend::Disconnect() {
184 updater_.reset(); 183 updater_.reset();
185 } 184 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 pending_downloads_[policy].push_back(callback); 259 pending_downloads_[policy].push_back(callback);
261 return; 260 return;
262 } 261 }
263 262
264 scoped_ptr<std::string> data(new std::string); 263 scoped_ptr<std::string> data(new std::string);
265 if (external_data_store_ && external_data_store_->Load( 264 if (external_data_store_ && external_data_store_->Load(
266 policy, metadata->second.hash, GetMaxExternalDataSize(policy), 265 policy, metadata->second.hash, GetMaxExternalDataSize(policy),
267 data.get())) { 266 data.get())) {
268 // If the external data referenced by |policy| exists in the cache and 267 // If the external data referenced by |policy| exists in the cache and
269 // matches the expected hash, pass it to the callback. 268 // matches the expected hash, pass it to the callback.
270 RunCallback(callback, data.Pass()); 269 RunCallback(callback, std::move(data));
271 return; 270 return;
272 } 271 }
273 272
274 // Request a download of the the external data referenced by |policy| and 273 // Request a download of the the external data referenced by |policy| and
275 // initialize the list of callbacks by adding |callback|. 274 // initialize the list of callbacks by adding |callback|.
276 pending_downloads_[policy].push_back(callback); 275 pending_downloads_[policy].push_back(callback);
277 StartDownload(policy); 276 StartDownload(policy);
278 } 277 }
279 278
280 void CloudExternalDataManagerBase::Backend::FetchAll() { 279 void CloudExternalDataManagerBase::Backend::FetchAll() {
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 max_external_data_size_for_testing = max_size; 444 max_external_data_size_for_testing = max_size;
446 } 445 }
447 446
448 void CloudExternalDataManagerBase::FetchAll() { 447 void CloudExternalDataManagerBase::FetchAll() {
449 DCHECK(CalledOnValidThread()); 448 DCHECK(CalledOnValidThread());
450 backend_task_runner_->PostTask(FROM_HERE, base::Bind( 449 backend_task_runner_->PostTask(FROM_HERE, base::Bind(
451 &Backend::FetchAll, base::Unretained(backend_.get()))); 450 &Backend::FetchAll, base::Unretained(backend_.get())));
452 } 451 }
453 452
454 } // namespace policy 453 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698