OLD | NEW |
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 MOJO_EDK_EMBEDDER_EMBEDDER_H_ | 5 #ifndef MOJO_EDK_EMBEDDER_EMBEDDER_H_ |
6 #define MOJO_EDK_EMBEDDER_EMBEDDER_H_ | 6 #define MOJO_EDK_EMBEDDER_EMBEDDER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 21 matching lines...) Expand all Loading... |
32 // -- see test_embedder.h). | 32 // -- see test_embedder.h). |
33 | 33 |
34 // Allows changing the default max message size. Must be called before Init. | 34 // Allows changing the default max message size. Must be called before Init. |
35 MOJO_SYSTEM_IMPL_EXPORT void SetMaxMessageSize(size_t bytes); | 35 MOJO_SYSTEM_IMPL_EXPORT void SetMaxMessageSize(size_t bytes); |
36 | 36 |
37 // Called in the parent process for each child process that is launched. The | 37 // Called in the parent process for each child process that is launched. The |
38 // returned handle must be sent to the child process which then calls | 38 // returned handle must be sent to the child process which then calls |
39 // SetParentPipeHandle. | 39 // SetParentPipeHandle. |
40 MOJO_SYSTEM_IMPL_EXPORT ScopedPlatformHandle ChildProcessLaunched( | 40 MOJO_SYSTEM_IMPL_EXPORT ScopedPlatformHandle ChildProcessLaunched( |
41 base::ProcessHandle child_process); | 41 base::ProcessHandle child_process); |
| 42 |
42 // Like above, except used when the embedder establishes the pipe between the | 43 // Like above, except used when the embedder establishes the pipe between the |
43 // parent and child processes itself. | 44 // parent and child processes itself. |
44 MOJO_SYSTEM_IMPL_EXPORT void ChildProcessLaunched( | 45 MOJO_SYSTEM_IMPL_EXPORT void ChildProcessLaunched( |
45 base::ProcessHandle child_process, ScopedPlatformHandle server_pipe); | 46 base::ProcessHandle child_process, ScopedPlatformHandle server_pipe); |
46 | 47 |
| 48 // Also like above, except used when the embedder has additionally passed an |
| 49 // out-of-band secret to the child process which must be received on this |
| 50 // |server_pipe| and validated before a working pipe can be established. |
| 51 // |
| 52 // NOTE: This should only be used to support Windows named pipes. |
| 53 MOJO_SYSTEM_IMPL_EXPORT void ChildProcessLaunched( |
| 54 base::ProcessHandle child_process, |
| 55 ScopedPlatformHandle server_pipe, |
| 56 const std::string& secret); |
| 57 |
47 // Should be called as early as possible in the child process with the handle | 58 // Should be called as early as possible in the child process with the handle |
48 // that the parent received from ChildProcessLaunched. | 59 // that the parent received from ChildProcessLaunched. |
49 MOJO_SYSTEM_IMPL_EXPORT void SetParentPipeHandle(ScopedPlatformHandle pipe); | 60 MOJO_SYSTEM_IMPL_EXPORT void SetParentPipeHandle(ScopedPlatformHandle pipe); |
50 | 61 |
| 62 // Like above, except used when the parent has passed the child an out-of-band |
| 63 // secret which must be sent on |pipe| before a working pipe can be established. |
| 64 // |
| 65 // NOTE: This should only be used to support Windows named pipes. |
| 66 MOJO_SYSTEM_IMPL_EXPORT void SetParentPipeHandle(ScopedPlatformHandle pipe, |
| 67 const std::string& secret); |
| 68 |
51 // Must be called first, or just after setting configuration parameters, to | 69 // Must be called first, or just after setting configuration parameters, to |
52 // initialize the (global, singleton) system. | 70 // initialize the (global, singleton) system. |
53 MOJO_SYSTEM_IMPL_EXPORT void Init(); | 71 MOJO_SYSTEM_IMPL_EXPORT void Init(); |
54 | 72 |
55 // Basic functions ------------------------------------------------------------- | 73 // Basic functions ------------------------------------------------------------- |
56 | 74 |
57 // The functions in this section are available once |Init()| has been called. | 75 // The functions in this section are available once |Init()| has been called. |
58 | 76 |
59 // Start waiting on the handle asynchronously. On success, |callback| will be | 77 // Start waiting on the handle asynchronously. On success, |callback| will be |
60 // called exactly once, when |handle| satisfies a signal in |signals| or it | 78 // called exactly once, when |handle| satisfies a signal in |signals| or it |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 167 |
150 // Generates a random ASCII token string for use with CreateParentMessagePipe() | 168 // Generates a random ASCII token string for use with CreateParentMessagePipe() |
151 // and CreateChildMessagePipe() above. The generated token is suitably random so | 169 // and CreateChildMessagePipe() above. The generated token is suitably random so |
152 // as to not have to worry about collisions with other generated tokens. | 170 // as to not have to worry about collisions with other generated tokens. |
153 MOJO_SYSTEM_IMPL_EXPORT std::string GenerateRandomToken(); | 171 MOJO_SYSTEM_IMPL_EXPORT std::string GenerateRandomToken(); |
154 | 172 |
155 } // namespace edk | 173 } // namespace edk |
156 } // namespace mojo | 174 } // namespace mojo |
157 | 175 |
158 #endif // MOJO_EDK_EMBEDDER_EMBEDDER_H_ | 176 #endif // MOJO_EDK_EMBEDDER_EMBEDDER_H_ |
OLD | NEW |