| 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 #ifndef SERVICES_CATALOG_PUBLIC_CPP_RESOURCE_LOADER_H_ | 5 #ifndef SERVICES_CATALOG_PUBLIC_CPP_RESOURCE_LOADER_H_ |
| 6 #define SERVICES_CATALOG_PUBLIC_CPP_RESOURCE_LOADER_H_ | 6 #define SERVICES_CATALOG_PUBLIC_CPP_RESOURCE_LOADER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // and return the file handles. Use TakeFile() to retrieve a base::File to use | 23 // and return the file handles. Use TakeFile() to retrieve a base::File to use |
| 24 // in client code. | 24 // in client code. |
| 25 class ResourceLoader { | 25 class ResourceLoader { |
| 26 public: | 26 public: |
| 27 ResourceLoader(); | 27 ResourceLoader(); |
| 28 ~ResourceLoader(); | 28 ~ResourceLoader(); |
| 29 | 29 |
| 30 // (Synchronously) opens all of the files in |paths| for reading. Use | 30 // (Synchronously) opens all of the files in |paths| for reading. Use |
| 31 // TakeFile() subsequently to obtain base::Files to use. Returns true if the | 31 // TakeFile() subsequently to obtain base::Files to use. Returns true if the |
| 32 // sync operation completed, false if it did not. | 32 // sync operation completed, false if it did not. |
| 33 bool OpenFiles(filesystem::DirectoryPtr directory, | 33 bool OpenFiles(filesystem::mojom::DirectoryPtr directory, |
| 34 const std::set<std::string>& paths); | 34 const std::set<std::string>& paths); |
| 35 | 35 |
| 36 // Releases and returns the file wrapping the handle. | 36 // Releases and returns the file wrapping the handle. |
| 37 base::File TakeFile(const std::string& path); | 37 base::File TakeFile(const std::string& path); |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 using ResourceMap = std::map<std::string, std::unique_ptr<base::File>>; | 40 using ResourceMap = std::map<std::string, std::unique_ptr<base::File>>; |
| 41 | 41 |
| 42 ResourceMap resource_map_; | 42 ResourceMap resource_map_; |
| 43 | 43 |
| 44 DISALLOW_COPY_AND_ASSIGN(ResourceLoader); | 44 DISALLOW_COPY_AND_ASSIGN(ResourceLoader); |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 } // namespace | 47 } // namespace |
| 48 | 48 |
| 49 #endif // SERVICES_CATALOG_PUBLIC_CPP_RESOURCE_LOADER_H_ | 49 #endif // SERVICES_CATALOG_PUBLIC_CPP_RESOURCE_LOADER_H_ |
| OLD | NEW |