OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 MojoHandle_h | 5 #ifndef MojoHandle_h |
6 #define MojoHandle_h | 6 #define MojoHandle_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptWrappable.h" | 8 #include "bindings/core/v8/ScriptWrappable.h" |
9 #include "mojo/public/cpp/system/core.h" | 9 #include "mojo/public/cpp/system/core.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 class ArrayBufferOrArrayBufferView; | 13 class ArrayBufferOrArrayBufferView; |
14 class MojoHandleSignals; | 14 class MojoHandleSignals; |
| 15 class MojoMapBufferResult; |
15 class MojoReadMessageFlags; | 16 class MojoReadMessageFlags; |
16 class MojoReadMessageResult; | 17 class MojoReadMessageResult; |
17 class MojoWatchCallback; | 18 class MojoWatchCallback; |
18 class MojoWatcher; | 19 class MojoWatcher; |
19 class ScriptState; | 20 class ScriptState; |
20 | 21 |
21 class MojoHandle final : public GarbageCollectedFinalized<MojoHandle>, | 22 class MojoHandle final : public GarbageCollectedFinalized<MojoHandle>, |
22 public ScriptWrappable { | 23 public ScriptWrappable { |
23 DEFINE_WRAPPERTYPEINFO(); | 24 DEFINE_WRAPPERTYPEINFO(); |
24 | 25 |
25 public: | 26 public: |
26 CORE_EXPORT static MojoHandle* create(mojo::ScopedHandle); | 27 CORE_EXPORT static MojoHandle* create(mojo::ScopedHandle); |
27 | 28 |
28 void close(); | 29 void close(); |
29 MojoWatcher* watch(ScriptState*, | 30 MojoWatcher* watch(ScriptState*, |
30 const MojoHandleSignals&, | 31 const MojoHandleSignals&, |
31 MojoWatchCallback*); | 32 MojoWatchCallback*); |
| 33 |
| 34 // MessagePipe handle. |
32 MojoResult writeMessage(ArrayBufferOrArrayBufferView&, | 35 MojoResult writeMessage(ArrayBufferOrArrayBufferView&, |
33 const HeapVector<Member<MojoHandle>>&); | 36 const HeapVector<Member<MojoHandle>>&); |
34 void readMessage(const MojoReadMessageFlags&, MojoReadMessageResult&); | 37 void readMessage(const MojoReadMessageFlags&, MojoReadMessageResult&); |
35 | 38 |
| 39 // SharedBuffer handle. |
| 40 void mapBuffer(unsigned offset, unsigned numBytes, MojoMapBufferResult&); |
| 41 |
36 DEFINE_INLINE_TRACE() {} | 42 DEFINE_INLINE_TRACE() {} |
37 | 43 |
38 private: | 44 private: |
39 explicit MojoHandle(mojo::ScopedHandle); | 45 explicit MojoHandle(mojo::ScopedHandle); |
40 | 46 |
41 mojo::ScopedHandle m_handle; | 47 mojo::ScopedHandle m_handle; |
42 }; | 48 }; |
43 | 49 |
44 } // namespace blink | 50 } // namespace blink |
45 | 51 |
46 #endif // MojoHandle_h | 52 #endif // MojoHandle_h |
OLD | NEW |