summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/mojo/mojo.h
blob: a81831c93b0bb99f0660b4e82699e8c46fa3b3b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_MOJO_MOJO_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_MOJO_MOJO_H_

#include "mojo/public/cpp/system/core.h"
#include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"

namespace blink {

class MojoCreateDataPipeOptions;
class MojoCreateDataPipeResult;
class MojoCreateMessagePipeResult;
class MojoCreateSharedBufferResult;
class MojoHandle;
class ScriptState;

class Mojo final : public ScriptWrappable {
  DEFINE_WRAPPERTYPEINFO();

 public:
  // MojoResult
  static const MojoResult kResultOk = MOJO_RESULT_OK;
  static const MojoResult kResultCancelled = MOJO_RESULT_CANCELLED;
  static const MojoResult kResultUnknown = MOJO_RESULT_UNKNOWN;
  static const MojoResult kResultInvalidArgument = MOJO_RESULT_INVALID_ARGUMENT;
  static const MojoResult kResultDeadlineExceeded =
      MOJO_RESULT_DEADLINE_EXCEEDED;
  static const MojoResult kResultNotFound = MOJO_RESULT_NOT_FOUND;
  static const MojoResult kResultAlreadyExists = MOJO_RESULT_ALREADY_EXISTS;
  static const MojoResult kResultPermissionDenied =
      MOJO_RESULT_PERMISSION_DENIED;
  static const MojoResult kResultResourceExhausted =
      MOJO_RESULT_RESOURCE_EXHAUSTED;
  static const MojoResult kResultFailedPrecondition =
      MOJO_RESULT_FAILED_PRECONDITION;
  static const MojoResult kResultAborted = MOJO_RESULT_ABORTED;
  static const MojoResult kResultOutOfRange = MOJO_RESULT_OUT_OF_RANGE;
  static const MojoResult kResultUnimplemented = MOJO_RESULT_UNIMPLEMENTED;
  static const MojoResult kResultInternal = MOJO_RESULT_INTERNAL;
  static const MojoResult kResultUnavailable = MOJO_RESULT_UNAVAILABLE;
  static const MojoResult kResultDataLoss = MOJO_RESULT_DATA_LOSS;
  static const MojoResult kResultBusy = MOJO_RESULT_BUSY;
  static const MojoResult kResultShouldWait = MOJO_RESULT_SHOULD_WAIT;

  static MojoCreateMessagePipeResult* createMessagePipe();
  static MojoCreateDataPipeResult* createDataPipe(
      const MojoCreateDataPipeOptions*);
  static MojoCreateSharedBufferResult* createSharedBuffer(unsigned num_bytes);

  static void bindInterface(ScriptState*,
                            const String& interface_name,
                            MojoHandle*,
                            const String& scope);
};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_CORE_MOJO_MOJO_H_