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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/process/process.h" |
13 #include "base/task_runner.h" | 14 #include "base/task_runner.h" |
14 #include "mojo/edk/embedder/scoped_platform_handle.h" | 15 #include "mojo/edk/embedder/scoped_platform_handle.h" |
15 #include "mojo/edk/system/system_impl_export.h" | 16 #include "mojo/edk/system/system_impl_export.h" |
16 #include "mojo/public/cpp/system/message_pipe.h" | 17 #include "mojo/public/cpp/system/message_pipe.h" |
17 | 18 |
18 namespace mojo { | 19 namespace mojo { |
19 namespace edk { | 20 namespace edk { |
20 | 21 |
21 class ProcessDelegate; | 22 class ProcessDelegate; |
22 | 23 |
23 // Basic configuration/initialization ------------------------------------------ | 24 // Basic configuration/initialization ------------------------------------------ |
24 | 25 |
25 // |Init()| sets up the basic Mojo system environment, making the |Mojo...()| | 26 // |Init()| sets up the basic Mojo system environment, making the |Mojo...()| |
26 // functions available and functional. This is never shut down (except in tests | 27 // functions available and functional. This is never shut down (except in tests |
27 // -- see test_embedder.h). | 28 // -- see test_embedder.h). |
28 | 29 |
29 // Allows changing the default max message size. Must be called before Init. | 30 // Allows changing the default max message size. Must be called before Init. |
30 MOJO_SYSTEM_IMPL_EXPORT void SetMaxMessageSize(size_t bytes); | 31 MOJO_SYSTEM_IMPL_EXPORT void SetMaxMessageSize(size_t bytes); |
31 | 32 |
| 33 #if defined(OS_WIN) |
| 34 // Must be called before Init in the parent (unsandboxed) process. |
| 35 MOJO_SYSTEM_IMPL_EXPORT void PreInitializeParentProcess(); |
| 36 |
| 37 // Must be called before Init in the child (sandboxed) process. |
| 38 MOJO_SYSTEM_IMPL_EXPORT void PreInitializeChildProcess(); |
| 39 |
| 40 // Called in the parent process for each child process that is launched. The |
| 41 // returned handle must be sent to the child process which then calls |
| 42 // SetParentPipeHandle. |
| 43 MOJO_SYSTEM_IMPL_EXPORT HANDLE ChildProcessLaunched(HANDLE child_process); |
| 44 // Like above, except used when the embedder establishes the pipe between the |
| 45 // parent and child processes itself. |
| 46 MOJO_SYSTEM_IMPL_EXPORT void ChildProcessLaunched(HANDLE child_process, |
| 47 HANDLE server_pipe); |
| 48 |
| 49 // Should be called as early as possible in the child process with the handle |
| 50 // that the parent received from ChildProcessLaunched. |
| 51 MOJO_SYSTEM_IMPL_EXPORT void SetParentPipeHandle(HANDLE pipe); |
| 52 #endif |
| 53 |
32 // Must be called first, or just after setting configuration parameters, to | 54 // Must be called first, or just after setting configuration parameters, to |
33 // initialize the (global, singleton) system. | 55 // initialize the (global, singleton) system. |
34 MOJO_SYSTEM_IMPL_EXPORT void Init(); | 56 MOJO_SYSTEM_IMPL_EXPORT void Init(); |
35 | 57 |
36 // Basic functions ------------------------------------------------------------- | 58 // Basic functions ------------------------------------------------------------- |
37 | 59 |
38 // The functions in this section are available once |Init()| has been called. | 60 // The functions in this section are available once |Init()| has been called. |
39 | 61 |
40 // Start waiting on the handle asynchronously. On success, |callback| will be | 62 // Start waiting on the handle asynchronously. On success, |callback| will be |
41 // called exactly once, when |handle| satisfies a signal in |signals| or it | 63 // called exactly once, when |handle| satisfies a signal in |signals| or it |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 MOJO_SYSTEM_IMPL_EXPORT void ShutdownIPCSupportAndWaitForNoChannels(); | 122 MOJO_SYSTEM_IMPL_EXPORT void ShutdownIPCSupportAndWaitForNoChannels(); |
101 | 123 |
102 // Creates a message pipe from a platform handle. Safe to call from any thread. | 124 // Creates a message pipe from a platform handle. Safe to call from any thread. |
103 MOJO_SYSTEM_IMPL_EXPORT ScopedMessagePipeHandle | 125 MOJO_SYSTEM_IMPL_EXPORT ScopedMessagePipeHandle |
104 CreateMessagePipe(ScopedPlatformHandle platform_handle); | 126 CreateMessagePipe(ScopedPlatformHandle platform_handle); |
105 | 127 |
106 } // namespace edk | 128 } // namespace edk |
107 } // namespace mojo | 129 } // namespace mojo |
108 | 130 |
109 #endif // MOJO_EDK_EMBEDDER_EMBEDDER_H_ | 131 #endif // MOJO_EDK_EMBEDDER_EMBEDDER_H_ |
OLD | NEW |