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" |
11 #include "mojo/embedder/scoped_platform_handle.h" | 11 #include "mojo/embedder/scoped_platform_handle.h" |
12 #include "mojo/public/cpp/system/core.h" | 12 #include "mojo/public/cpp/system/core.h" |
13 #include "mojo/system/system_impl_export.h" | 13 #include "mojo/system/system_impl_export.h" |
14 | 14 |
15 namespace mojo { | 15 namespace mojo { |
16 namespace embedder { | 16 namespace embedder { |
17 | 17 |
18 // Must be called first to initialize the (global, singleton) system. | |
19 MOJO_SYSTEM_IMPL_EXPORT void Init(); | |
20 | |
21 // Creates a new "channel", returning a handle to the bootstrap message pipe on | 18 // Creates a new "channel", returning a handle to the bootstrap message pipe on |
22 // that channel. |platform_handle| should be an OS-dependent handle to one side | 19 // that channel. |platform_handle| should be an OS-dependent handle to one side |
23 // of a suitable bidirectional OS "pipe" (e.g., a file descriptor to a socket on | 20 // of a suitable bidirectional OS "pipe" (e.g., a file descriptor to a socket on |
24 // POSIX, a handle to a named pipe on Windows); this "pipe" should be connected | 21 // POSIX, a handle to a named pipe on Windows); this "pipe" should be connected |
25 // and ready for operation (e.g., to be written to or read from). | 22 // and ready for operation (e.g., to be written to or read from). |
26 // |io_thread_task_runner| should be a |TaskRunner| for the thread on which the | 23 // |io_thread_task_runner| should be a |TaskRunner| for the thread on which the |
27 // "channel" will run (read data and demultiplex). | 24 // "channel" will run (read data and demultiplex). |
28 // | 25 // |
29 // On completion, it will run |callback| with a pointer to a |ChannelInfo| | 26 // On completion, it will run |callback| with a pointer to a |ChannelInfo| |
30 // (which is meant to be opaque to the embedder). If | 27 // (which is meant to be opaque to the embedder). If |
(...skipping 22 matching lines...) Expand all Loading... |
53 DidCreateChannelCallback callback, | 50 DidCreateChannelCallback callback, |
54 scoped_refptr<base::TaskRunner> callback_thread_task_runner); | 51 scoped_refptr<base::TaskRunner> callback_thread_task_runner); |
55 | 52 |
56 MOJO_SYSTEM_IMPL_EXPORT void DestroyChannelOnIOThread( | 53 MOJO_SYSTEM_IMPL_EXPORT void DestroyChannelOnIOThread( |
57 ChannelInfo* channel_info); | 54 ChannelInfo* channel_info); |
58 | 55 |
59 } // namespace embedder | 56 } // namespace embedder |
60 } // namespace mojo | 57 } // namespace mojo |
61 | 58 |
62 #endif // MOJO_EMBEDDER_EMBEDDER_H_ | 59 #endif // MOJO_EMBEDDER_EMBEDDER_H_ |
OLD | NEW |