| 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_EMBEDDER_EMBEDDER_H_ | 5 #ifndef MOJO_EMBEDDER_EMBEDDER_H_ |
| 6 #define MOJO_EMBEDDER_EMBEDDER_H_ | 6 #define MOJO_EMBEDDER_EMBEDDER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/task_runner.h" | 10 #include "base/task_runner.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // provided to the callback to |CreateChannel()|. | 89 // provided to the callback to |CreateChannel()|. |
| 90 MOJO_SYSTEM_IMPL_EXPORT void DestroyChannelOnIOThread( | 90 MOJO_SYSTEM_IMPL_EXPORT void DestroyChannelOnIOThread( |
| 91 ChannelInfo* channel_info); | 91 ChannelInfo* channel_info); |
| 92 | 92 |
| 93 // Destroys a channel (asynchronously) that was created using |CreateChannel()| | 93 // Destroys a channel (asynchronously) that was created using |CreateChannel()| |
| 94 // (note: NOT |CreateChannelOnIOThread()|); may be called from any thread. | 94 // (note: NOT |CreateChannelOnIOThread()|); may be called from any thread. |
| 95 // |channel_info| should be the value provided to the callback to | 95 // |channel_info| should be the value provided to the callback to |
| 96 // |CreateChannel()|. | 96 // |CreateChannel()|. |
| 97 MOJO_SYSTEM_IMPL_EXPORT void DestroyChannel(ChannelInfo* channel_info); | 97 MOJO_SYSTEM_IMPL_EXPORT void DestroyChannel(ChannelInfo* channel_info); |
| 98 | 98 |
| 99 // Inform the channel that it will soon be destroyed (doing so is optional). |
| 100 // This may be called from any thread, but the caller must ensure that this is |
| 101 // called before |DestroyChannel()| or |DestroyChannelOnIOThread()|. |
| 102 MOJO_SYSTEM_IMPL_EXPORT void WillDestroyChannelSoon(ChannelInfo* channel_info); |
| 103 |
| 99 // Creates a |MojoHandle| that wraps the given |PlatformHandle| (taking | 104 // Creates a |MojoHandle| that wraps the given |PlatformHandle| (taking |
| 100 // ownership of it). This |MojoHandle| can then, e.g., be passed through message | 105 // ownership of it). This |MojoHandle| can then, e.g., be passed through message |
| 101 // pipes. Note: This takes ownership (and thus closes) |platform_handle| even on | 106 // pipes. Note: This takes ownership (and thus closes) |platform_handle| even on |
| 102 // failure, which is different from what you'd expect from a Mojo API, but it | 107 // failure, which is different from what you'd expect from a Mojo API, but it |
| 103 // makes for a more convenient embedder API. | 108 // makes for a more convenient embedder API. |
| 104 MOJO_SYSTEM_IMPL_EXPORT MojoResult | 109 MOJO_SYSTEM_IMPL_EXPORT MojoResult |
| 105 CreatePlatformHandleWrapper(ScopedPlatformHandle platform_handle, | 110 CreatePlatformHandleWrapper(ScopedPlatformHandle platform_handle, |
| 106 MojoHandle* platform_handle_wrapper_handle); | 111 MojoHandle* platform_handle_wrapper_handle); |
| 107 // Retrieves the |PlatformHandle| that was wrapped into a |MojoHandle| (using | 112 // Retrieves the |PlatformHandle| that was wrapped into a |MojoHandle| (using |
| 108 // |CreatePlatformHandleWrapper()| above). Note that the |MojoHandle| must still | 113 // |CreatePlatformHandleWrapper()| above). Note that the |MojoHandle| must still |
| 109 // be closed separately. | 114 // be closed separately. |
| 110 MOJO_SYSTEM_IMPL_EXPORT MojoResult | 115 MOJO_SYSTEM_IMPL_EXPORT MojoResult |
| 111 PassWrappedPlatformHandle(MojoHandle platform_handle_wrapper_handle, | 116 PassWrappedPlatformHandle(MojoHandle platform_handle_wrapper_handle, |
| 112 ScopedPlatformHandle* platform_handle); | 117 ScopedPlatformHandle* platform_handle); |
| 113 | 118 |
| 114 } // namespace embedder | 119 } // namespace embedder |
| 115 } // namespace mojo | 120 } // namespace mojo |
| 116 | 121 |
| 117 #endif // MOJO_EMBEDDER_EMBEDDER_H_ | 122 #endif // MOJO_EMBEDDER_EMBEDDER_H_ |
| OLD | NEW |