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

Side by Side Diff: services/file/file_service.h

Issue 2795883002: Eliminate OnConnect usage (Closed)
Patch Set: . Created 3 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/device/device_service.cc ('k') | services/file/file_service.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_FILE_FILE_SERVICE_H_ 5 #ifndef SERVICES_FILE_FILE_SERVICE_H_
6 #define SERVICES_FILE_FILE_SERVICE_H_ 6 #define SERVICES_FILE_FILE_SERVICE_H_
7 7
8 #include "base/callback_forward.h" 8 #include "base/callback_forward.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "components/filesystem/lock_table.h" 10 #include "components/filesystem/lock_table.h"
11 #include "components/leveldb/public/interfaces/leveldb.mojom.h" 11 #include "components/leveldb/public/interfaces/leveldb.mojom.h"
12 #include "mojo/public/cpp/bindings/binding_set.h" 12 #include "mojo/public/cpp/bindings/binding_set.h"
13 #include "services/file/public/interfaces/file_system.mojom.h" 13 #include "services/file/public/interfaces/file_system.mojom.h"
14 #include "services/service_manager/public/cpp/binder_registry.h"
14 #include "services/service_manager/public/cpp/interface_factory.h" 15 #include "services/service_manager/public/cpp/interface_factory.h"
15 #include "services/service_manager/public/cpp/service.h" 16 #include "services/service_manager/public/cpp/service.h"
16 17
17 namespace file { 18 namespace file {
18 19
19 std::unique_ptr<service_manager::Service> CreateFileService( 20 std::unique_ptr<service_manager::Service> CreateFileService(
20 scoped_refptr<base::SingleThreadTaskRunner> file_service_runner, 21 scoped_refptr<base::SingleThreadTaskRunner> file_service_runner,
21 scoped_refptr<base::SingleThreadTaskRunner> leveldb_service_runner); 22 scoped_refptr<base::SingleThreadTaskRunner> leveldb_service_runner);
22 23
23 class FileService 24 class FileService
24 : public service_manager::Service, 25 : public service_manager::Service,
25 public service_manager::InterfaceFactory<mojom::FileSystem>, 26 public service_manager::InterfaceFactory<mojom::FileSystem>,
26 public service_manager::InterfaceFactory<leveldb::mojom::LevelDBService> { 27 public service_manager::InterfaceFactory<leveldb::mojom::LevelDBService> {
27 public: 28 public:
28 FileService( 29 FileService(
29 scoped_refptr<base::SingleThreadTaskRunner> file_service_runner, 30 scoped_refptr<base::SingleThreadTaskRunner> file_service_runner,
30 scoped_refptr<base::SingleThreadTaskRunner> leveldb_service_runner); 31 scoped_refptr<base::SingleThreadTaskRunner> leveldb_service_runner);
31 ~FileService() override; 32 ~FileService() override;
32 33
33 private: 34 private:
34 // |Service| override: 35 // |Service| override:
35 void OnStart() override; 36 void OnStart() override;
36 bool OnConnect(const service_manager::ServiceInfo& remote_info, 37 void OnBindInterface(const service_manager::ServiceInfo& source_info,
37 service_manager::InterfaceRegistry* registry) override; 38 const std::string& interface_name,
39 mojo::ScopedMessagePipeHandle interface_pipe) override;
38 40
39 // |InterfaceFactory<mojom::FileSystem>| implementation: 41 // |InterfaceFactory<mojom::FileSystem>| implementation:
40 void Create(const service_manager::Identity& remote_identity, 42 void Create(const service_manager::Identity& remote_identity,
41 mojom::FileSystemRequest request) override; 43 mojom::FileSystemRequest request) override;
42 44
43 // |InterfaceFactory<LevelDBService>| implementation: 45 // |InterfaceFactory<LevelDBService>| implementation:
44 void Create(const service_manager::Identity& remote_identity, 46 void Create(const service_manager::Identity& remote_identity,
45 leveldb::mojom::LevelDBServiceRequest request) override; 47 leveldb::mojom::LevelDBServiceRequest request) override;
46 48
47 void OnLevelDBServiceError(); 49 void OnLevelDBServiceError();
48 50
49 scoped_refptr<base::SingleThreadTaskRunner> file_service_runner_; 51 scoped_refptr<base::SingleThreadTaskRunner> file_service_runner_;
50 scoped_refptr<base::SingleThreadTaskRunner> leveldb_service_runner_; 52 scoped_refptr<base::SingleThreadTaskRunner> leveldb_service_runner_;
51 53
52 // We create these two objects so we can delete them on the correct task 54 // We create these two objects so we can delete them on the correct task
53 // runners. 55 // runners.
54 class FileSystemObjects; 56 class FileSystemObjects;
55 std::unique_ptr<FileSystemObjects> file_system_objects_; 57 std::unique_ptr<FileSystemObjects> file_system_objects_;
56 58
57 class LevelDBServiceObjects; 59 class LevelDBServiceObjects;
58 std::unique_ptr<LevelDBServiceObjects> leveldb_objects_; 60 std::unique_ptr<LevelDBServiceObjects> leveldb_objects_;
59 61
62 service_manager::BinderRegistry registry_;
63
60 DISALLOW_COPY_AND_ASSIGN(FileService); 64 DISALLOW_COPY_AND_ASSIGN(FileService);
61 }; 65 };
62 66
63 } // namespace file 67 } // namespace file
64 68
65 #endif // SERVICES_FILE_FILE_SERVICE_H_ 69 #endif // SERVICES_FILE_FILE_SERVICE_H_
OLDNEW
« no previous file with comments | « services/device/device_service.cc ('k') | services/file/file_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698