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

Side by Side Diff: components/filesystem/file_system_app.cc

Issue 2476063002: Service Manager: Rework Service and ServiceContext lifetime (Closed)
Patch Set: . Created 4 years, 1 month 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 | « components/filesystem/file_system_app.h ('k') | components/font_service/font_service_app.h » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/filesystem/file_system_app.h" 5 #include "components/filesystem/file_system_app.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "mojo/public/cpp/bindings/strong_binding.h" 12 #include "mojo/public/cpp/bindings/strong_binding.h"
13 #include "services/service_manager/public/cpp/connection.h" 13 #include "services/service_manager/public/cpp/connection.h"
14 #include "services/service_manager/public/cpp/connector.h" 14 #include "services/service_manager/public/cpp/connector.h"
15 #include "services/service_manager/public/cpp/interface_registry.h"
16 #include "services/service_manager/public/cpp/service_context.h"
15 17
16 #if defined(OS_WIN) 18 #if defined(OS_WIN)
17 #include "base/base_paths_win.h" 19 #include "base/base_paths_win.h"
18 #include "base/path_service.h" 20 #include "base/path_service.h"
19 #include "base/strings/utf_string_conversions.h" 21 #include "base/strings/utf_string_conversions.h"
20 #elif defined(OS_ANDROID) 22 #elif defined(OS_ANDROID)
21 #include "base/base_paths_android.h" 23 #include "base/base_paths_android.h"
22 #include "base/path_service.h" 24 #include "base/path_service.h"
23 #elif defined(OS_LINUX) 25 #elif defined(OS_LINUX)
24 #include "base/environment.h" 26 #include "base/environment.h"
25 #include "base/nix/xdg_util.h" 27 #include "base/nix/xdg_util.h"
26 #elif defined(OS_MACOSX) 28 #elif defined(OS_MACOSX)
27 #include "base/base_paths_mac.h" 29 #include "base/base_paths_mac.h"
28 #include "base/path_service.h" 30 #include "base/path_service.h"
29 #endif 31 #endif
30 32
31 namespace filesystem { 33 namespace filesystem {
32 34
33 namespace { 35 namespace {
34 36
35 const char kUserDataDir[] = "user-data-dir"; 37 const char kUserDataDir[] = "user-data-dir";
36 38
37 } // namespace filesystem 39 } // namespace filesystem
38 40
39 FileSystemApp::FileSystemApp() : lock_table_(new LockTable) {} 41 FileSystemApp::FileSystemApp() : lock_table_(new LockTable) {}
40 42
41 FileSystemApp::~FileSystemApp() {} 43 FileSystemApp::~FileSystemApp() {}
42 44
43 void FileSystemApp::OnStart(const service_manager::ServiceInfo& info) { 45 void FileSystemApp::OnStart(service_manager::ServiceContext* context) {
44 tracing_.Initialize(connector(), info.identity.name()); 46 tracing_.Initialize(context->connector(), context->identity().name());
45 } 47 }
46 48
47 bool FileSystemApp::OnConnect(const service_manager::ServiceInfo& remote_info, 49 bool FileSystemApp::OnConnect(const service_manager::ServiceInfo& remote_info,
48 service_manager::InterfaceRegistry* registry) { 50 service_manager::InterfaceRegistry* registry) {
49 registry->AddInterface<mojom::FileSystem>(this); 51 registry->AddInterface<mojom::FileSystem>(this);
50 return true; 52 return true;
51 } 53 }
52 54
53 // |InterfaceFactory<Files>| implementation: 55 // |InterfaceFactory<Files>| implementation:
54 void FileSystemApp::Create(const service_manager::Identity& remote_identity, 56 void FileSystemApp::Create(const service_manager::Identity& remote_identity,
(...skipping 28 matching lines...) Expand all
83 path = path.Append(FILE_PATH_LITERAL("filesystem")); 85 path = path.Append(FILE_PATH_LITERAL("filesystem"));
84 } 86 }
85 87
86 if (!base::PathExists(path)) 88 if (!base::PathExists(path))
87 base::CreateDirectory(path); 89 base::CreateDirectory(path);
88 90
89 return path; 91 return path;
90 } 92 }
91 93
92 } // namespace filesystem 94 } // namespace filesystem
OLDNEW
« no previous file with comments | « components/filesystem/file_system_app.h ('k') | components/font_service/font_service_app.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698