Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: third_party/WebKit/Source/core/mojo/Mojo.h

Issue 2405093003: [WIP] Mojo native bindings interface.
Patch Set: cleanup 2 Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef Mojo_h
6 #define Mojo_h
7
8 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "mojo/public/cpp/system/core.h"
10
11 namespace blink {
12
13 class ArrayBufferOrArrayBufferView;
14 class MojoCreateMessagePipeOptions;
15 class MojoCreateMessagePipeResult;
16 class MojoHandle;
17 class MojoReadMessageResult;
18 class MojoWatchCallback;
19 class MojoWatcher;
20 class ScriptState;
21
22 class Mojo final : public GarbageCollected<Mojo>, public ScriptWrappable {
23 DEFINE_WRAPPERTYPEINFO();
24
25 public:
26 CORE_EXPORT static Mojo* create();
27
28 // MojoResult
29 static const MojoResult kResultOk = MOJO_HANDLE_SIGNAL_NONE;
30 static const MojoResult kResultCancelled = MOJO_RESULT_CANCELLED;
31 static const MojoResult kResultUnknown = MOJO_RESULT_UNKNOWN;
32 static const MojoResult kResultInvalidArgument = MOJO_RESULT_INVALID_ARGUMENT;
33 static const MojoResult kResultDeadlineExceeded =
34 MOJO_RESULT_DEADLINE_EXCEEDED;
35 static const MojoResult kResultNotFound = MOJO_RESULT_NOT_FOUND;
36 static const MojoResult kResultAlreadyExists = MOJO_RESULT_ALREADY_EXISTS;
37 static const MojoResult kResultPermissionDenied =
38 MOJO_RESULT_PERMISSION_DENIED;
39 static const MojoResult kResultResourceExhausted =
40 MOJO_RESULT_RESOURCE_EXHAUSTED;
41 static const MojoResult kResultFailedPrecondition =
42 MOJO_RESULT_FAILED_PRECONDITION;
43 static const MojoResult kResultAborted = MOJO_RESULT_ABORTED;
44 static const MojoResult kResultOutOfRange = MOJO_RESULT_OUT_OF_RANGE;
45 static const MojoResult kResultUnimplemented = MOJO_RESULT_UNIMPLEMENTED;
46 static const MojoResult kResultInternal = MOJO_RESULT_INTERNAL;
47 static const MojoResult kResultUnavailable = MOJO_RESULT_UNAVAILABLE;
48 static const MojoResult kResultDataLoss = MOJO_RESULT_DATA_LOSS;
49 static const MojoResult kResultBusy = MOJO_RESULT_BUSY;
50 static const MojoResult kResultShouldWait = MOJO_RESULT_SHOULD_WAIT;
51
52 // MojoHandleSignals
53 static const MojoHandleSignals kHandleSignalNone = MOJO_HANDLE_SIGNAL_NONE;
54 static const MojoHandleSignals kHandleSignalReadable =
55 MOJO_HANDLE_SIGNAL_READABLE;
56 static const MojoHandleSignals kHandleSignalWritable =
57 MOJO_HANDLE_SIGNAL_WRITABLE;
58 static const MojoHandleSignals kHandleSignalPeerClosed =
59 MOJO_HANDLE_SIGNAL_PEER_CLOSED;
60
61 // MessagePipe flags.
62 static const MojoCreateMessagePipeOptionsFlags
63 kCreateMessagePipeOptionsFlagNone =
64 MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_NONE;
65 static const MojoWriteMessageFlags kWriteMessageFlagNone =
66 MOJO_WRITE_MESSAGE_FLAG_NONE;
67 static const MojoReadMessageFlags kReadMessageFlagNone =
68 MOJO_READ_MESSAGE_FLAG_NONE;
69 static const MojoReadMessageFlags kReadMessageFlagMayDiscard =
70 MOJO_READ_MESSAGE_FLAG_MAY_DISCARD;
71
72 MojoWatcher* watch(ScriptState*,
73 MojoHandle*,
74 MojoHandleSignals,
75 MojoWatchCallback*);
76
77 void createMessagePipe(const MojoCreateMessagePipeOptions&,
78 MojoCreateMessagePipeResult&);
79 MojoResult writeMessage(MojoHandle*,
80 ArrayBufferOrArrayBufferView&,
81 const HeapVector<Member<MojoHandle>>&,
82 MojoWriteMessageFlags);
83 void readMessage(MojoHandle*, MojoReadMessageFlags, MojoReadMessageResult&);
84
85 DEFINE_INLINE_TRACE() {}
86 };
87
88 } // namespace blink
89
90 #endif // Mojo_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698