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

Side by Side Diff: services/catalog/reader.h

Issue 1910673002: Convert //services 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
« no previous file with comments | « services/catalog/instance.cc ('k') | services/catalog/reader.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 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_READER_H_ 5 #ifndef SERVICES_CATALOG_READER_H_
6 #define SERVICES_CATALOG_READER_H_ 6 #define SERVICES_CATALOG_READER_H_
7 7
8 #include <memory>
9
8 #include "base/callback.h" 10 #include "base/callback.h"
9 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
10 #include "base/macros.h" 12 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
13 #include "services/catalog/types.h" 14 #include "services/catalog/types.h"
14 #include "services/shell/public/interfaces/shell_resolver.mojom.h" 15 #include "services/shell/public/interfaces/shell_resolver.mojom.h"
15 16
16 namespace base { 17 namespace base {
17 class TaskRunner; 18 class TaskRunner;
18 } 19 }
19 20
20 namespace catalog { 21 namespace catalog {
21 22
22 class Entry; 23 class Entry;
23 class ManifestProvider; 24 class ManifestProvider;
24 25
25 // Responsible for loading manifests & building the Entry data structures. 26 // Responsible for loading manifests & building the Entry data structures.
26 class Reader { 27 class Reader {
27 public: 28 public:
28 using ReadManifestCallback = 29 using ReadManifestCallback = base::Callback<void(std::unique_ptr<Entry>)>;
29 base::Callback<void(scoped_ptr<Entry>)>; 30 using CreateEntryForNameCallback =
30 using CreateEntryForNameCallback =
31 base::Callback<void(shell::mojom::ResolveResultPtr)>; 31 base::Callback<void(shell::mojom::ResolveResultPtr)>;
32 32
33 Reader(base::TaskRunner* file_task_runner, 33 Reader(base::TaskRunner* file_task_runner,
34 ManifestProvider* manifest_provider); 34 ManifestProvider* manifest_provider);
35 ~Reader(); 35 ~Reader();
36 36
37 // Scans the contents of |package_dir|, reading all application manifests and 37 // Scans the contents of |package_dir|, reading all application manifests and
38 // populating |cache|. Runs |read_complete_closure| when done. 38 // populating |cache|. Runs |read_complete_closure| when done.
39 void Read(const base::FilePath& package_dir, 39 void Read(const base::FilePath& package_dir,
40 EntryCache* cache, 40 EntryCache* cache,
41 const base::Closure& read_complete_closure); 41 const base::Closure& read_complete_closure);
42 42
43 // Returns an Entry for |mojo_name| via |callback|, assuming a manifest file 43 // Returns an Entry for |mojo_name| via |callback|, assuming a manifest file
44 // in the canonical location 44 // in the canonical location
45 void CreateEntryForName( 45 void CreateEntryForName(
46 const std::string& mojo_name, 46 const std::string& mojo_name,
47 EntryCache* cache, 47 EntryCache* cache,
48 const CreateEntryForNameCallback& entry_created_callback); 48 const CreateEntryForNameCallback& entry_created_callback);
49 49
50 private: 50 private:
51 void OnReadManifest(EntryCache* cache, 51 void OnReadManifest(EntryCache* cache,
52 const CreateEntryForNameCallback& entry_created_callback, 52 const CreateEntryForNameCallback& entry_created_callback,
53 scoped_ptr<Entry> entry); 53 std::unique_ptr<Entry> entry);
54 54
55 base::FilePath system_package_dir_; 55 base::FilePath system_package_dir_;
56 base::TaskRunner* file_task_runner_; 56 base::TaskRunner* file_task_runner_;
57 ManifestProvider* const manifest_provider_; 57 ManifestProvider* const manifest_provider_;
58 base::WeakPtrFactory<Reader> weak_factory_; 58 base::WeakPtrFactory<Reader> weak_factory_;
59 59
60 DISALLOW_COPY_AND_ASSIGN(Reader); 60 DISALLOW_COPY_AND_ASSIGN(Reader);
61 }; 61 };
62 62
63 } // namespace catalog 63 } // namespace catalog
64 64
65 #endif // SERVICES_CATALOG_READER_H_ 65 #endif // SERVICES_CATALOG_READER_H_
OLDNEW
« no previous file with comments | « services/catalog/instance.cc ('k') | services/catalog/reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698