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

Side by Side Diff: services/service_manager/runner/host/service_process_launcher.h

Issue 2680973006: Mojo EDK: Add safe process connection API (Closed)
Patch Set: . Created 3 years, 10 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_SERVICE_MANAGER_RUNNER_HOST_SERVICE_PROCESS_LAUNCHER_H_ 5 #ifndef SERVICES_SERVICE_MANAGER_RUNNER_HOST_SERVICE_PROCESS_LAUNCHER_H_
6 #define SERVICES_SERVICE_MANAGER_RUNNER_HOST_SERVICE_PROCESS_LAUNCHER_H_ 6 #define SERVICES_SERVICE_MANAGER_RUNNER_HOST_SERVICE_PROCESS_LAUNCHER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/process/process.h" 16 #include "base/process/process.h"
17 #include "base/synchronization/waitable_event.h" 17 #include "base/synchronization/waitable_event.h"
18 #include "mojo/edk/embedder/pending_process_connection.h"
18 #include "mojo/edk/embedder/platform_channel_pair.h" 19 #include "mojo/edk/embedder/platform_channel_pair.h"
19 #include "services/service_manager/public/interfaces/service_factory.mojom.h" 20 #include "services/service_manager/public/interfaces/service_factory.mojom.h"
20 21
21 namespace base { 22 namespace base {
22 class CommandLine; 23 class CommandLine;
23 class TaskRunner; 24 class TaskRunner;
24 } 25 }
25 26
26 namespace service_manager { 27 namespace service_manager {
27 28
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 scoped_refptr<base::TaskRunner> launch_process_runner_; 77 scoped_refptr<base::TaskRunner> launch_process_runner_;
77 Delegate* delegate_ = nullptr; 78 Delegate* delegate_ = nullptr;
78 bool start_sandboxed_ = false; 79 bool start_sandboxed_ = false;
79 Identity target_; 80 Identity target_;
80 base::FilePath service_path_; 81 base::FilePath service_path_;
81 base::Process child_process_; 82 base::Process child_process_;
82 83
83 // Used to initialize the Mojo IPC channel between parent and child. 84 // Used to initialize the Mojo IPC channel between parent and child.
84 std::unique_ptr<mojo::edk::PlatformChannelPair> mojo_ipc_channel_; 85 std::unique_ptr<mojo::edk::PlatformChannelPair> mojo_ipc_channel_;
85 mojo::edk::HandlePassingInformation handle_passing_info_; 86 mojo::edk::HandlePassingInformation handle_passing_info_;
86 const std::string child_token_; 87 mojo::edk::PendingProcessConnection process_connection_;
87 88
88 // Since Start() calls a method on another thread, we use an event to block 89 // Since Start() calls a method on another thread, we use an event to block
89 // the main thread if it tries to destruct |this| while launching the process. 90 // the main thread if it tries to destruct |this| while launching the process.
90 base::WaitableEvent start_child_process_event_; 91 base::WaitableEvent start_child_process_event_;
91 92
92 base::WeakPtrFactory<ServiceProcessLauncher> weak_factory_; 93 base::WeakPtrFactory<ServiceProcessLauncher> weak_factory_;
93 94
94 DISALLOW_COPY_AND_ASSIGN(ServiceProcessLauncher); 95 DISALLOW_COPY_AND_ASSIGN(ServiceProcessLauncher);
95 }; 96 };
96 97
97 class ServiceProcessLauncherFactory { 98 class ServiceProcessLauncherFactory {
98 public: 99 public:
99 virtual ~ServiceProcessLauncherFactory() {} 100 virtual ~ServiceProcessLauncherFactory() {}
100 virtual std::unique_ptr<ServiceProcessLauncher> Create( 101 virtual std::unique_ptr<ServiceProcessLauncher> Create(
101 const base::FilePath& service_path) = 0; 102 const base::FilePath& service_path) = 0;
102 }; 103 };
103 104
104 } // namespace service_manager 105 } // namespace service_manager
105 106
106 #endif // SERVICES_SERVICE_MANAGER_RUNNER_HOST_SERVICE_PROCESS_LAUNCHER_H_ 107 #endif // SERVICES_SERVICE_MANAGER_RUNNER_HOST_SERVICE_PROCESS_LAUNCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698