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> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/process/process_handle.h" | 15 #include "base/process/process_handle.h" |
16 #include "base/task_runner.h" | 16 #include "base/task_runner.h" |
17 #include "mojo/edk/embedder/scoped_platform_handle.h" | |
18 #include "mojo/edk/system/system_impl_export.h" | 17 #include "mojo/edk/system/system_impl_export.h" |
19 #include "mojo/public/cpp/system/message_pipe.h" | 18 #include "mojo/public/cpp/system/message_pipe.h" |
20 | 19 |
21 namespace mojo { | 20 namespace mojo { |
22 namespace edk { | 21 namespace edk { |
23 | 22 |
24 class ProcessDelegate; | 23 class ProcessDelegate; |
| 24 class ScopedPlatformHandle; |
25 | 25 |
26 // Basic configuration/initialization ------------------------------------------ | 26 // Basic configuration/initialization ------------------------------------------ |
27 | 27 |
28 // |Init()| sets up the basic Mojo system environment, making the |Mojo...()| | 28 // |Init()| sets up the basic Mojo system environment, making the |Mojo...()| |
29 // functions available and functional. This is never shut down (except in tests | 29 // functions available and functional. This is never shut down (except in tests |
30 // -- see test_embedder.h). | 30 // -- see test_embedder.h). |
31 | 31 |
32 // Allows changing the default max message size. Must be called before Init. | 32 // Allows changing the default max message size. Must be called before Init. |
33 MOJO_SYSTEM_IMPL_EXPORT void SetMaxMessageSize(size_t bytes); | 33 MOJO_SYSTEM_IMPL_EXPORT void SetMaxMessageSize(size_t bytes); |
34 | 34 |
(...skipping 14 matching lines...) Expand all Loading... |
49 base::ProcessHandle child_process, ScopedPlatformHandle server_pipe); | 49 base::ProcessHandle child_process, ScopedPlatformHandle server_pipe); |
50 | 50 |
51 // Should be called as early as possible in the child process with the handle | 51 // Should be called as early as possible in the child process with the handle |
52 // that the parent received from ChildProcessLaunched. | 52 // that the parent received from ChildProcessLaunched. |
53 MOJO_SYSTEM_IMPL_EXPORT void SetParentPipeHandle(ScopedPlatformHandle pipe); | 53 MOJO_SYSTEM_IMPL_EXPORT void SetParentPipeHandle(ScopedPlatformHandle pipe); |
54 | 54 |
55 // Must be called first, or just after setting configuration parameters, to | 55 // Must be called first, or just after setting configuration parameters, to |
56 // initialize the (global, singleton) system. | 56 // initialize the (global, singleton) system. |
57 MOJO_SYSTEM_IMPL_EXPORT void Init(); | 57 MOJO_SYSTEM_IMPL_EXPORT void Init(); |
58 | 58 |
| 59 // Initialized Mojo EDK. |
| 60 // TODO(jam): Remove Init(), InitIPCSupport() and ShutdownIPCSupport() |
| 61 MOJO_SYSTEM_IMPL_EXPORT void Init( |
| 62 scoped_refptr<base::TaskRunner> io_thread_task_runner); |
| 63 |
59 // Basic functions ------------------------------------------------------------- | 64 // Basic functions ------------------------------------------------------------- |
60 | 65 |
61 // The functions in this section are available once |Init()| has been called. | 66 // The functions in this section are available once |Init()| has been called. |
62 | 67 |
63 // Start waiting on the handle asynchronously. On success, |callback| will be | 68 // Start waiting on the handle asynchronously. On success, |callback| will be |
64 // called exactly once, when |handle| satisfies a signal in |signals| or it | 69 // called exactly once, when |handle| satisfies a signal in |signals| or it |
65 // becomes known that it will never do so. |callback| will be executed on an | 70 // becomes known that it will never do so. |callback| will be executed on an |
66 // arbitrary thread, so it must not call any Mojo system or embedder functions. | 71 // arbitrary thread, so it must not call any Mojo system or embedder functions. |
67 MOJO_SYSTEM_IMPL_EXPORT MojoResult | 72 MOJO_SYSTEM_IMPL_EXPORT MojoResult |
68 AsyncWait(MojoHandle handle, | 73 AsyncWait(MojoHandle handle, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 MOJO_SYSTEM_IMPL_EXPORT void ShutdownIPCSupport(); | 123 MOJO_SYSTEM_IMPL_EXPORT void ShutdownIPCSupport(); |
119 | 124 |
120 // Creates a message pipe from a platform handle. Safe to call from any thread. | 125 // Creates a message pipe from a platform handle. Safe to call from any thread. |
121 MOJO_SYSTEM_IMPL_EXPORT ScopedMessagePipeHandle | 126 MOJO_SYSTEM_IMPL_EXPORT ScopedMessagePipeHandle |
122 CreateMessagePipe(ScopedPlatformHandle platform_handle); | 127 CreateMessagePipe(ScopedPlatformHandle platform_handle); |
123 | 128 |
124 } // namespace edk | 129 } // namespace edk |
125 } // namespace mojo | 130 } // namespace mojo |
126 | 131 |
127 #endif // MOJO_EDK_EMBEDDER_EMBEDDER_H_ | 132 #endif // MOJO_EDK_EMBEDDER_EMBEDDER_H_ |
OLD | NEW |