File: mojo.h

package info (click to toggle)
chromium 138.0.7204.183-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,908 kB
  • sloc: cpp: 34,937,088; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (77 lines) | stat: -rw-r--r-- 3,128 bytes parent folder | download | duplicates (4)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Copyright 2017 The Chromium Authors
// 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/c/system/types.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
#include "third_party/blink/renderer/platform/supplementable.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 V8MojoScope;

class CORE_EXPORT Mojo final : public ScriptWrappable,
                               public Supplementable<Mojo> {
  DEFINE_WRAPPERTYPEINFO();

 public:
  Mojo() = default;
  Mojo(const Mojo&) = delete;
  Mojo& operator=(const Mojo&) = delete;

  // 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 V8MojoScope& scope,
                            ExceptionState& exception_state);

  void Trace(Visitor* visitor) const override {
    ScriptWrappable::Trace(visitor);
    Supplementable<Mojo>::Trace(visitor);
  }
};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_CORE_MOJO_MOJO_H_