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

Side by Side Diff: net/http/mock_http_cache.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/http/http_stream_parser_unittest.cc ('k') | net/http/transport_security_state.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/http/mock_http_cache.h" 5 #include "net/http/mock_http_cache.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 NetLog* net_log, 534 NetLog* net_log,
535 std::unique_ptr<disk_cache::Backend>* backend, 535 std::unique_ptr<disk_cache::Backend>* backend,
536 const CompletionCallback& callback) { 536 const CompletionCallback& callback) {
537 backend->reset(new MockDiskCache()); 537 backend->reset(new MockDiskCache());
538 return OK; 538 return OK;
539 } 539 }
540 540
541 //----------------------------------------------------------------------------- 541 //-----------------------------------------------------------------------------
542 542
543 MockHttpCache::MockHttpCache() 543 MockHttpCache::MockHttpCache()
544 : MockHttpCache(base::WrapUnique(new MockBackendFactory())) {} 544 : MockHttpCache(base::MakeUnique<MockBackendFactory>()) {}
545 545
546 MockHttpCache::MockHttpCache( 546 MockHttpCache::MockHttpCache(
547 std::unique_ptr<HttpCache::BackendFactory> disk_cache_factory) 547 std::unique_ptr<HttpCache::BackendFactory> disk_cache_factory)
548 : http_cache_(base::WrapUnique(new MockNetworkLayer()), 548 : http_cache_(base::MakeUnique<MockNetworkLayer>(),
549 std::move(disk_cache_factory), 549 std::move(disk_cache_factory),
550 true) {} 550 true) {}
551 551
552 disk_cache::Backend* MockHttpCache::backend() { 552 disk_cache::Backend* MockHttpCache::backend() {
553 TestCompletionCallback cb; 553 TestCompletionCallback cb;
554 disk_cache::Backend* backend; 554 disk_cache::Backend* backend;
555 int rv = http_cache_.GetBackend(&backend, cb.callback()); 555 int rv = http_cache_.GetBackend(&backend, cb.callback());
556 rv = cb.GetResult(rv); 556 rv = cb.GetResult(rv);
557 return (rv == OK) ? backend : NULL; 557 return (rv == OK) ? backend : NULL;
558 } 558 }
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 if (!callback_.is_null()) { 683 if (!callback_.is_null()) {
684 if (!fail_) 684 if (!fail_)
685 backend_->reset(new MockDiskCache()); 685 backend_->reset(new MockDiskCache());
686 CompletionCallback cb = callback_; 686 CompletionCallback cb = callback_;
687 callback_.Reset(); 687 callback_.Reset();
688 cb.Run(Result()); // This object can be deleted here. 688 cb.Run(Result()); // This object can be deleted here.
689 } 689 }
690 } 690 }
691 691
692 } // namespace net 692 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_parser_unittest.cc ('k') | net/http/transport_security_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698