OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/catalog/public/cpp/resource_loader.h" | 5 #include "services/catalog/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" |
11 #include "base/files/file.h" | 11 #include "base/files/file.h" |
12 #include "components/filesystem/public/interfaces/directory.mojom.h" | 12 #include "components/filesystem/public/interfaces/directory.mojom.h" |
13 #include "mojo/public/cpp/system/platform_handle.h" | 13 #include "mojo/public/cpp/system/platform_handle.h" |
14 #include "services/shell/public/cpp/connector.h" | 14 #include "services/service_manager/public/cpp/connector.h" |
15 #include "services/shell/public/interfaces/interface_provider.mojom.h" | 15 #include "services/service_manager/public/interfaces/interface_provider.mojom.h" |
16 | 16 |
17 namespace catalog { | 17 namespace catalog { |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 base::File GetFileFromHandle(mojo::ScopedHandle handle) { | 21 base::File GetFileFromHandle(mojo::ScopedHandle handle) { |
22 CHECK(handle.is_valid()); | 22 CHECK(handle.is_valid()); |
23 base::PlatformFile platform_file; | 23 base::PlatformFile platform_file; |
24 CHECK_EQ(mojo::UnwrapPlatformFile(std::move(handle), &platform_file), | 24 CHECK_EQ(mojo::UnwrapPlatformFile(std::move(handle), &platform_file), |
25 MOJO_RESULT_OK); | 25 MOJO_RESULT_OK); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 return true; | 57 return true; |
58 } | 58 } |
59 | 59 |
60 base::File ResourceLoader::TakeFile(const std::string& path) { | 60 base::File ResourceLoader::TakeFile(const std::string& path) { |
61 std::unique_ptr<base::File> file_wrapper(std::move(resource_map_[path])); | 61 std::unique_ptr<base::File> file_wrapper(std::move(resource_map_[path])); |
62 resource_map_.erase(path); | 62 resource_map_.erase(path); |
63 return std::move(*file_wrapper); | 63 return std::move(*file_wrapper); |
64 } | 64 } |
65 | 65 |
66 } // namespace catalog | 66 } // namespace catalog |
OLD | NEW |