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

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

Issue 2259823002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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/cookies/cookie_monster_unittest.cc ('k') | net/dns/dns_session.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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 248
249 SimpleBackendImpl::~SimpleBackendImpl() { 249 SimpleBackendImpl::~SimpleBackendImpl() {
250 index_->WriteToDisk(SimpleIndex::INDEX_WRITE_REASON_SHUTDOWN); 250 index_->WriteToDisk(SimpleIndex::INDEX_WRITE_REASON_SHUTDOWN);
251 } 251 }
252 252
253 int SimpleBackendImpl::Init(const CompletionCallback& completion_callback) { 253 int SimpleBackendImpl::Init(const CompletionCallback& completion_callback) {
254 worker_pool_ = g_sequenced_worker_pool.Get().GetTaskRunner(); 254 worker_pool_ = g_sequenced_worker_pool.Get().GetTaskRunner();
255 255
256 index_.reset(new SimpleIndex( 256 index_.reset(new SimpleIndex(
257 base::ThreadTaskRunnerHandle::Get(), this, cache_type_, 257 base::ThreadTaskRunnerHandle::Get(), this, cache_type_,
258 base::WrapUnique(new SimpleIndexFile(cache_thread_, worker_pool_.get(), 258 base::MakeUnique<SimpleIndexFile>(cache_thread_, worker_pool_.get(),
259 cache_type_, path_)))); 259 cache_type_, path_)));
260 index_->ExecuteWhenReady( 260 index_->ExecuteWhenReady(
261 base::Bind(&RecordIndexLoad, cache_type_, base::TimeTicks::Now())); 261 base::Bind(&RecordIndexLoad, cache_type_, base::TimeTicks::Now()));
262 262
263 PostTaskAndReplyWithResult( 263 PostTaskAndReplyWithResult(
264 cache_thread_.get(), 264 cache_thread_.get(),
265 FROM_HERE, 265 FROM_HERE,
266 base::Bind( 266 base::Bind(
267 &SimpleBackendImpl::InitCacheStructureOnDisk, path_, orig_max_size_), 267 &SimpleBackendImpl::InitCacheStructureOnDisk, path_, orig_max_size_),
268 base::Bind(&SimpleBackendImpl::InitializeIndex, 268 base::Bind(&SimpleBackendImpl::InitializeIndex,
269 AsWeakPtr(), 269 AsWeakPtr(),
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 } 718 }
719 719
720 // static 720 // static
721 void SimpleBackendImpl::FlushWorkerPoolForTesting() { 721 void SimpleBackendImpl::FlushWorkerPoolForTesting() {
722 // We only need to do this if we there is an active task runner. 722 // We only need to do this if we there is an active task runner.
723 if (base::ThreadTaskRunnerHandle::IsSet()) 723 if (base::ThreadTaskRunnerHandle::IsSet())
724 g_sequenced_worker_pool.Get().FlushForTesting(); 724 g_sequenced_worker_pool.Get().FlushForTesting();
725 } 725 }
726 726
727 } // namespace disk_cache 727 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/cookies/cookie_monster_unittest.cc ('k') | net/dns/dns_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698