| 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/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/memory/shared_memory_handle.h" | 16 #include "base/memory/shared_memory_handle.h" |
| 17 #include "base/process/process_handle.h" | 17 #include "base/process/process_handle.h" |
| 18 #include "base/task_runner.h" | 18 #include "base/task_runner.h" |
| 19 #include "mojo/edk/embedder/scoped_platform_handle.h" | 19 #include "mojo/edk/embedder/scoped_platform_handle.h" |
| 20 #include "mojo/edk/system/system_impl_export.h" | 20 #include "mojo/edk/system/system_impl_export.h" |
| 21 #include "mojo/public/cpp/system/message_pipe.h" | 21 #include "mojo/public/cpp/system/message_pipe.h" |
| 22 | 22 |
| 23 namespace base { |
| 24 class PortProvider; |
| 25 } |
| 26 |
| 23 namespace mojo { | 27 namespace mojo { |
| 24 namespace edk { | 28 namespace edk { |
| 25 | 29 |
| 26 class ProcessDelegate; | 30 class ProcessDelegate; |
| 27 | 31 |
| 28 // Basic configuration/initialization ------------------------------------------ | 32 // Basic configuration/initialization ------------------------------------------ |
| 29 | 33 |
| 30 // |Init()| sets up the basic Mojo system environment, making the |Mojo...()| | 34 // |Init()| sets up the basic Mojo system environment, making the |Mojo...()| |
| 31 // functions available and functional. This is never shut down (except in tests | 35 // functions available and functional. This is never shut down (except in tests |
| 32 // -- see test_embedder.h). | 36 // -- see test_embedder.h). |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 MOJO_SYSTEM_IMPL_EXPORT void InitIPCSupport( | 131 MOJO_SYSTEM_IMPL_EXPORT void InitIPCSupport( |
| 128 ProcessDelegate* process_delegate, | 132 ProcessDelegate* process_delegate, |
| 129 scoped_refptr<base::TaskRunner> io_thread_task_runner); | 133 scoped_refptr<base::TaskRunner> io_thread_task_runner); |
| 130 | 134 |
| 131 // Shuts down the subsystem initialized by |InitIPCSupport()|. It be called from | 135 // Shuts down the subsystem initialized by |InitIPCSupport()|. It be called from |
| 132 // any thread and will attempt to complete shutdown on the I/O thread with which | 136 // any thread and will attempt to complete shutdown on the I/O thread with which |
| 133 // the system was initialized. Upon completion the ProcessDelegate's | 137 // the system was initialized. Upon completion the ProcessDelegate's |
| 134 // |OnShutdownComplete()| method is invoked. | 138 // |OnShutdownComplete()| method is invoked. |
| 135 MOJO_SYSTEM_IMPL_EXPORT void ShutdownIPCSupport(); | 139 MOJO_SYSTEM_IMPL_EXPORT void ShutdownIPCSupport(); |
| 136 | 140 |
| 141 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 142 // Set the |base::PortProvider| for this process, if not already set. Can be |
| 143 // called on any thread, but must be set in the root process before any Mach |
| 144 // ports can be transferred. It is safe to call this multiple times, as long as |
| 145 // the same port provider is used every time. |
| 146 MOJO_SYSTEM_IMPL_EXPORT void SetMachPortProviderIfNeeded( |
| 147 base::PortProvider* port_provider); |
| 148 #endif |
| 149 |
| 137 // Creates a message pipe over an arbitrary platform channel. The other end of | 150 // Creates a message pipe over an arbitrary platform channel. The other end of |
| 138 // the channel must also be passed to this function. Either endpoint can be in | 151 // the channel must also be passed to this function. Either endpoint can be in |
| 139 // any process. | 152 // any process. |
| 140 // | 153 // |
| 141 // Note that the channel is only used to negotiate pipe connection, not as the | 154 // Note that the channel is only used to negotiate pipe connection, not as the |
| 142 // transport for messages on the pipe. | 155 // transport for messages on the pipe. |
| 143 MOJO_SYSTEM_IMPL_EXPORT ScopedMessagePipeHandle | 156 MOJO_SYSTEM_IMPL_EXPORT ScopedMessagePipeHandle |
| 144 CreateMessagePipe(ScopedPlatformHandle platform_handle); | 157 CreateMessagePipe(ScopedPlatformHandle platform_handle); |
| 145 | 158 |
| 146 // Creates a message pipe from a token. A child embedder must also have this | 159 // Creates a message pipe from a token. A child embedder must also have this |
| (...skipping 10 matching lines...) Expand all Loading... |
| 157 | 170 |
| 158 // Generates a random ASCII token string for use with CreateParentMessagePipe() | 171 // Generates a random ASCII token string for use with CreateParentMessagePipe() |
| 159 // and CreateChildMessagePipe() above. The generated token is suitably random so | 172 // and CreateChildMessagePipe() above. The generated token is suitably random so |
| 160 // as to not have to worry about collisions with other generated tokens. | 173 // as to not have to worry about collisions with other generated tokens. |
| 161 MOJO_SYSTEM_IMPL_EXPORT std::string GenerateRandomToken(); | 174 MOJO_SYSTEM_IMPL_EXPORT std::string GenerateRandomToken(); |
| 162 | 175 |
| 163 } // namespace edk | 176 } // namespace edk |
| 164 } // namespace mojo | 177 } // namespace mojo |
| 165 | 178 |
| 166 #endif // MOJO_EDK_EMBEDDER_EMBEDDER_H_ | 179 #endif // MOJO_EDK_EMBEDDER_EMBEDDER_H_ |
| OLD | NEW |