Chromium Code Reviews| 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 MojoCloneBufferHandleFlags; | |
| 15 class MojoCreateSharedBufferResult; | |
| 14 class MojoHandleSignals; | 16 class MojoHandleSignals; |
| 17 class MojoMapBufferResult; | |
| 15 class MojoReadMessageFlags; | 18 class MojoReadMessageFlags; |
| 16 class MojoReadMessageResult; | 19 class MojoReadMessageResult; |
| 17 class MojoWatchCallback; | 20 class MojoWatchCallback; |
| 18 class MojoWatcher; | 21 class MojoWatcher; |
| 19 class ScriptState; | 22 class ScriptState; |
| 20 | 23 |
| 21 class MojoHandle final : public GarbageCollectedFinalized<MojoHandle>, | 24 class MojoHandle final : public GarbageCollectedFinalized<MojoHandle>, |
| 22 public ScriptWrappable { | 25 public ScriptWrappable { |
| 23 DEFINE_WRAPPERTYPEINFO(); | 26 DEFINE_WRAPPERTYPEINFO(); |
| 24 | 27 |
| 25 public: | 28 public: |
| 26 CORE_EXPORT static MojoHandle* create(mojo::ScopedHandle); | 29 CORE_EXPORT static MojoHandle* create(mojo::ScopedHandle); |
| 27 | 30 |
| 28 void close(); | 31 void close(); |
| 29 MojoWatcher* watch(ScriptState*, | 32 MojoWatcher* watch(ScriptState*, |
| 30 const MojoHandleSignals&, | 33 const MojoHandleSignals&, |
| 31 MojoWatchCallback*); | 34 MojoWatchCallback*); |
| 35 | |
| 36 // MessagePipe handle. | |
| 32 MojoResult writeMessage(ArrayBufferOrArrayBufferView&, | 37 MojoResult writeMessage(ArrayBufferOrArrayBufferView&, |
| 33 const HeapVector<Member<MojoHandle>>&); | 38 const HeapVector<Member<MojoHandle>>&); |
| 34 void readMessage(const MojoReadMessageFlags&, MojoReadMessageResult&); | 39 void readMessage(const MojoReadMessageFlags&, MojoReadMessageResult&); |
| 35 | 40 |
| 41 // SharedBuffer handle. | |
| 42 void mapBuffer(unsigned offset, unsigned numBytes, MojoMapBufferResult&); | |
|
yzshen1
2017/03/01 23:11:46
Do we also need a way to explicitly release the ma
jbroman
2017/03/01 23:29:37
+1, this is probably a good thing to have. (I thou
alokp
2017/03/01 23:58:34
I am not sure what the usecase for unmap would be
yzshen1
2017/03/02 17:41:08
Because the mappings holds the underlying shared m
| |
| 43 void clone(const MojoCloneBufferHandleFlags&, MojoCreateSharedBufferResult&); | |
|
yzshen1
2017/03/01 23:11:46
Does it make sense to make the names more consiste
alokp
2017/03/01 23:58:34
Please see my other comment. I am happy to change
| |
| 44 | |
| 36 DEFINE_INLINE_TRACE() {} | 45 DEFINE_INLINE_TRACE() {} |
| 37 | 46 |
| 38 private: | 47 private: |
| 39 explicit MojoHandle(mojo::ScopedHandle); | 48 explicit MojoHandle(mojo::ScopedHandle); |
| 40 | 49 |
| 41 mojo::ScopedHandle m_handle; | 50 mojo::ScopedHandle m_handle; |
| 42 }; | 51 }; |
| 43 | 52 |
| 44 } // namespace blink | 53 } // namespace blink |
| 45 | 54 |
| 46 #endif // MojoHandle_h | 55 #endif // MojoHandle_h |
| OLD | NEW |