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

Side by Side Diff: components/resource_provider/public/cpp/resource_loader.cc

Issue 1921923002: Convert //components/[o-t]* from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/resource_provider/public/cpp/resource_loader.h" 5 #include "components/resource_provider/public/cpp/resource_loader.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 if (did_block_ || loaded_) 44 if (did_block_ || loaded_)
45 return loaded_; 45 return loaded_;
46 46
47 did_block_ = true; 47 did_block_ = true;
48 resource_provider_.WaitForIncomingResponse(); 48 resource_provider_.WaitForIncomingResponse();
49 return loaded_; 49 return loaded_;
50 } 50 }
51 51
52 base::File ResourceLoader::ReleaseFile(const std::string& path) { 52 base::File ResourceLoader::ReleaseFile(const std::string& path) {
53 CHECK(resource_map_.count(path)); 53 CHECK(resource_map_.count(path));
54 scoped_ptr<base::File> file_wrapper(std::move(resource_map_[path])); 54 std::unique_ptr<base::File> file_wrapper(std::move(resource_map_[path]));
55 resource_map_.erase(path); 55 resource_map_.erase(path);
56 return std::move(*file_wrapper); 56 return std::move(*file_wrapper);
57 } 57 }
58 58
59 void ResourceLoader::OnGotResources(const std::vector<std::string>& paths, 59 void ResourceLoader::OnGotResources(const std::vector<std::string>& paths,
60 mojo::Array<mojo::ScopedHandle> resources) { 60 mojo::Array<mojo::ScopedHandle> resources) {
61 61
62 CHECK(!resources.is_null()); 62 CHECK(!resources.is_null());
63 CHECK_EQ(resources.size(), paths.size()); 63 CHECK_EQ(resources.size(), paths.size());
64 for (size_t i = 0; i < resources.size(); ++i) { 64 for (size_t i = 0; i < resources.size(); ++i) {
65 resource_map_[paths[i]].reset( 65 resource_map_[paths[i]].reset(
66 new base::File(GetFileFromHandle(std::move(resources[i])))); 66 new base::File(GetFileFromHandle(std::move(resources[i]))));
67 } 67 }
68 loaded_ = true; 68 loaded_ = true;
69 } 69 }
70 70
71 } // namespace resource_provider 71 } // namespace resource_provider
OLDNEW
« no previous file with comments | « components/resource_provider/public/cpp/resource_loader.h ('k') | components/resource_provider/resource_provider_test_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698