| 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 <functional> |
| 8 #include <memory> | 9 #include <memory> |
| 9 #include <string> | 10 #include <string> |
| 10 | 11 |
| 11 #include "base/callback.h" | 12 #include "base/callback.h" |
| 12 #include "base/task_runner.h" | |
| 13 #include "mojo/edk/embedder/channel_info_forward.h" | 13 #include "mojo/edk/embedder/channel_info_forward.h" |
| 14 #include "mojo/edk/embedder/platform_task_runner.h" | 14 #include "mojo/edk/embedder/platform_task_runner.h" |
| 15 #include "mojo/edk/embedder/process_type.h" | 15 #include "mojo/edk/embedder/process_type.h" |
| 16 #include "mojo/edk/embedder/scoped_platform_handle.h" | 16 #include "mojo/edk/embedder/scoped_platform_handle.h" |
| 17 #include "mojo/edk/embedder/slave_info.h" | 17 #include "mojo/edk/embedder/slave_info.h" |
| 18 #include "mojo/public/cpp/system/message_pipe.h" | 18 #include "mojo/public/cpp/system/message_pipe.h" |
| 19 | 19 |
| 20 namespace mojo { | 20 namespace mojo { |
| 21 namespace embedder { | 21 namespace embedder { |
| 22 | 22 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 41 // Basic functions ------------------------------------------------------------- | 41 // Basic functions ------------------------------------------------------------- |
| 42 | 42 |
| 43 // The functions in this section are available once |Init()| has been called. | 43 // The functions in this section are available once |Init()| has been called. |
| 44 | 44 |
| 45 // Start waiting on the handle asynchronously. On success, |callback| will be | 45 // Start waiting on the handle asynchronously. On success, |callback| will be |
| 46 // called exactly once, when |handle| satisfies a signal in |signals| or it | 46 // called exactly once, when |handle| satisfies a signal in |signals| or it |
| 47 // becomes known that it will never do so. |callback| will be executed on an | 47 // becomes known that it will never do so. |callback| will be executed on an |
| 48 // arbitrary thread, so it must not call any Mojo system or embedder functions. | 48 // arbitrary thread, so it must not call any Mojo system or embedder functions. |
| 49 MojoResult AsyncWait(MojoHandle handle, | 49 MojoResult AsyncWait(MojoHandle handle, |
| 50 MojoHandleSignals signals, | 50 MojoHandleSignals signals, |
| 51 const base::Callback<void(MojoResult)>& callback); | 51 const std::function<void(MojoResult)>& callback); |
| 52 | 52 |
| 53 // Creates a |MojoHandle| that wraps the given |PlatformHandle| (taking | 53 // Creates a |MojoHandle| that wraps the given |PlatformHandle| (taking |
| 54 // ownership of it). This |MojoHandle| can then, e.g., be passed through message | 54 // ownership of it). This |MojoHandle| can then, e.g., be passed through message |
| 55 // pipes. Note: This takes ownership (and thus closes) |platform_handle| even on | 55 // pipes. Note: This takes ownership (and thus closes) |platform_handle| even on |
| 56 // failure, which is different from what you'd expect from a Mojo API, but it | 56 // failure, which is different from what you'd expect from a Mojo API, but it |
| 57 // makes for a more convenient embedder API. | 57 // makes for a more convenient embedder API. |
| 58 MojoResult CreatePlatformHandleWrapper( | 58 MojoResult CreatePlatformHandleWrapper( |
| 59 ScopedPlatformHandle platform_handle, | 59 ScopedPlatformHandle platform_handle, |
| 60 MojoHandle* platform_handle_wrapper_handle); | 60 MojoHandle* platform_handle_wrapper_handle); |
| 61 | 61 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 | 227 |
| 228 // Inform the channel that it will soon be destroyed (doing so is optional). | 228 // Inform the channel that it will soon be destroyed (doing so is optional). |
| 229 // This may be called from any thread, but the caller must ensure that this is | 229 // This may be called from any thread, but the caller must ensure that this is |
| 230 // called before |DestroyChannel()|. | 230 // called before |DestroyChannel()|. |
| 231 void WillDestroyChannelSoon(ChannelInfo* channel_info); | 231 void WillDestroyChannelSoon(ChannelInfo* channel_info); |
| 232 | 232 |
| 233 } // namespace embedder | 233 } // namespace embedder |
| 234 } // namespace mojo | 234 } // namespace mojo |
| 235 | 235 |
| 236 #endif // MOJO_EDK_EMBEDDER_EMBEDDER_H_ | 236 #endif // MOJO_EDK_EMBEDDER_EMBEDDER_H_ |
| OLD | NEW |