| 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/reader.h" | 5 #include "services/catalog/reader.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_enumerator.h" | 8 #include "base/files/file_enumerator.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/json/json_file_value_serializer.h" | 10 #include "base/json/json_file_value_serializer.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 GetManifestPath(package_dir, mojo_name), package_dir); | 126 GetManifestPath(package_dir, mojo_name), package_dir); |
| 127 if (!entry) { | 127 if (!entry) { |
| 128 entry.reset(new Entry(mojo_name)); | 128 entry.reset(new Entry(mojo_name)); |
| 129 entry->set_path(GetPackagePath( | 129 entry->set_path(GetPackagePath( |
| 130 package_dir.AppendASCII(kMojoApplicationsDirName), mojo_name)); | 130 package_dir.AppendASCII(kMojoApplicationsDirName), mojo_name)); |
| 131 } | 131 } |
| 132 return entry; | 132 return entry; |
| 133 } | 133 } |
| 134 | 134 |
| 135 void AddEntryToCache(EntryCache* cache, std::unique_ptr<Entry> entry) { | 135 void AddEntryToCache(EntryCache* cache, std::unique_ptr<Entry> entry) { |
| 136 for (auto child : entry->applications()) | 136 for (auto* child : entry->applications()) |
| 137 AddEntryToCache(cache, base::WrapUnique(child)); | 137 AddEntryToCache(cache, base::WrapUnique(child)); |
| 138 (*cache)[entry->name()] = std::move(entry); | 138 (*cache)[entry->name()] = std::move(entry); |
| 139 } | 139 } |
| 140 | 140 |
| 141 void DoNothing(shell::mojom::ResolveResultPtr) {} | 141 void DoNothing(shell::mojom::ResolveResultPtr) {} |
| 142 | 142 |
| 143 } // namespace | 143 } // namespace |
| 144 | 144 |
| 145 // A sequenced task runner is used to guarantee requests are serviced in the | 145 // A sequenced task runner is used to guarantee requests are serviced in the |
| 146 // order requested. To do otherwise means we may run callbacks in an | 146 // order requested. To do otherwise means we may run callbacks in an |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 EntryCache* cache, | 207 EntryCache* cache, |
| 208 const CreateEntryForNameCallback& entry_created_callback, | 208 const CreateEntryForNameCallback& entry_created_callback, |
| 209 std::unique_ptr<Entry> entry) { | 209 std::unique_ptr<Entry> entry) { |
| 210 shell::mojom::ResolveResultPtr result = | 210 shell::mojom::ResolveResultPtr result = |
| 211 shell::mojom::ResolveResult::From(*entry); | 211 shell::mojom::ResolveResult::From(*entry); |
| 212 AddEntryToCache(cache, std::move(entry)); | 212 AddEntryToCache(cache, std::move(entry)); |
| 213 entry_created_callback.Run(std::move(result)); | 213 entry_created_callback.Run(std::move(result)); |
| 214 } | 214 } |
| 215 | 215 |
| 216 } // namespace catalog | 216 } // namespace catalog |
| OLD | NEW |