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

Side by Side Diff: net/disk_cache/simple/simple_backend_impl.cc

Issue 1545233002: Convert Pass()→std::move() in //net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 | « net/disk_cache/net_log_parameters.cc ('k') | net/disk_cache/simple/simple_entry_impl.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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "net/disk_cache/simple/simple_backend_impl.h" 5 #include "net/disk_cache/simple/simple_backend_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstdlib> 8 #include <cstdlib>
9 #include <functional> 9 #include <functional>
10 10
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 DCHECK_EQ(1U, backend_->active_entries_.count(entry_hash_)); 207 DCHECK_EQ(1U, backend_->active_entries_.count(entry_hash_));
208 backend_->active_entries_.erase(entry_hash_); 208 backend_->active_entries_.erase(entry_hash_);
209 } 209 }
210 } 210 }
211 211
212 static scoped_ptr<SimpleEntryImpl::ActiveEntryProxy> Create( 212 static scoped_ptr<SimpleEntryImpl::ActiveEntryProxy> Create(
213 int64_t entry_hash, 213 int64_t entry_hash,
214 SimpleBackendImpl* backend) { 214 SimpleBackendImpl* backend) {
215 scoped_ptr<SimpleEntryImpl::ActiveEntryProxy> 215 scoped_ptr<SimpleEntryImpl::ActiveEntryProxy>
216 proxy(new ActiveEntryProxy(entry_hash, backend)); 216 proxy(new ActiveEntryProxy(entry_hash, backend));
217 return proxy.Pass(); 217 return proxy;
218 } 218 }
219 219
220 private: 220 private:
221 ActiveEntryProxy(uint64_t entry_hash, SimpleBackendImpl* backend) 221 ActiveEntryProxy(uint64_t entry_hash, SimpleBackendImpl* backend)
222 : entry_hash_(entry_hash), backend_(backend->AsWeakPtr()) {} 222 : entry_hash_(entry_hash), backend_(backend->AsWeakPtr()) {}
223 223
224 uint64_t entry_hash_; 224 uint64_t entry_hash_;
225 base::WeakPtr<SimpleBackendImpl> backend_; 225 base::WeakPtr<SimpleBackendImpl> backend_;
226 }; 226 };
227 227
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 int index_initialization_error_code) { 485 int index_initialization_error_code) {
486 if (!backend_) { 486 if (!backend_) {
487 callback.Run(net::ERR_FAILED); 487 callback.Run(net::ERR_FAILED);
488 return; 488 return;
489 } 489 }
490 if (index_initialization_error_code != net::OK) { 490 if (index_initialization_error_code != net::OK) {
491 callback.Run(index_initialization_error_code); 491 callback.Run(index_initialization_error_code);
492 return; 492 return;
493 } 493 }
494 if (!hashes_to_enumerate_) 494 if (!hashes_to_enumerate_)
495 hashes_to_enumerate_ = backend_->index()->GetAllHashes().Pass(); 495 hashes_to_enumerate_ = backend_->index()->GetAllHashes();
496 496
497 while (!hashes_to_enumerate_->empty()) { 497 while (!hashes_to_enumerate_->empty()) {
498 uint64_t entry_hash = hashes_to_enumerate_->back(); 498 uint64_t entry_hash = hashes_to_enumerate_->back();
499 hashes_to_enumerate_->pop_back(); 499 hashes_to_enumerate_->pop_back();
500 if (backend_->index()->Has(entry_hash)) { 500 if (backend_->index()->Has(entry_hash)) {
501 *next_entry = NULL; 501 *next_entry = NULL;
502 CompletionCallback continue_iteration = base::Bind( 502 CompletionCallback continue_iteration = base::Bind(
503 &SimpleIterator::CheckIterationReturnValue, 503 &SimpleIterator::CheckIterationReturnValue,
504 weak_factory_.GetWeakPtr(), 504 weak_factory_.GetWeakPtr(),
505 next_entry, 505 next_entry,
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 } 746 }
747 747
748 // static 748 // static
749 void SimpleBackendImpl::FlushWorkerPoolForTesting() { 749 void SimpleBackendImpl::FlushWorkerPoolForTesting() {
750 // We only need to do this if we there is an active task runner. 750 // We only need to do this if we there is an active task runner.
751 if (base::ThreadTaskRunnerHandle::IsSet()) 751 if (base::ThreadTaskRunnerHandle::IsSet())
752 g_sequenced_worker_pool.Get().FlushForTesting(); 752 g_sequenced_worker_pool.Get().FlushForTesting();
753 } 753 }
754 754
755 } // namespace disk_cache 755 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/net_log_parameters.cc ('k') | net/disk_cache/simple/simple_entry_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698