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

Side by Side Diff: services/shell/runner/host/mach_broker.h

Issue 2419063003: Move services/shell to services/service_manager (Closed)
Patch Set: Created 4 years, 2 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/shell/runner/host/linux_sandbox.cc ('k') | services/shell/runner/host/mach_broker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef SERVICES_SHELL_RUNNER_HOST_MACH_BROKER_H_
6 #define SERVICES_SHELL_RUNNER_HOST_MACH_BROKER_H_
7
8 #include "base/mac/mach_port_broker.h"
9
10 namespace base {
11 template <typename T> struct DefaultSingletonTraits;
12 }
13
14 namespace shell {
15
16 // A global singleton |MachBroker| is used by the shell to provide access to
17 // Mach task ports for shell out-of-process applications.
18 class MachBroker {
19 public:
20 // Sends the task port of the current process to the parent over Mach IPC.
21 // For use in child processes.
22 static void SendTaskPortToParent();
23
24 // Returns the global |MachBroker|. For use in the shell.
25 static MachBroker* GetInstance();
26
27 // Registers |pid| with a MACH_PORT_NULL task port in the port provider. A
28 // child's pid must be registered before the broker will accept a task port
29 // from that child.
30 // Callers MUST acquire the lock given by GetLock() before calling this method
31 // (and release the lock afterwards).
32 void ExpectPid(base::ProcessHandle pid);
33
34 // Removes |pid| from the port provider.
35 // Callers MUST acquire the lock given by GetLock() before calling this method
36 // (and release the lock afterwards).
37 void RemovePid(base::ProcessHandle pid);
38
39 base::Lock& GetLock() { return broker_.GetLock(); }
40 base::PortProvider* port_provider() { return &broker_; }
41
42 private:
43 MachBroker();
44 ~MachBroker();
45 friend struct base::DefaultSingletonTraits<MachBroker>;
46
47 base::MachPortBroker broker_;
48 };
49
50 } // namespace shell
51
52 #endif // SERVICES_SHELL_RUNNER_HOST_MACH_BROKER_H_
OLDNEW
« no previous file with comments | « services/shell/runner/host/linux_sandbox.cc ('k') | services/shell/runner/host/mach_broker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698