aboutsummaryrefslogtreecommitdiff
path: root/mojo/android/system/src/org/chromium/mojo/system/impl/MessagePipeHandleImpl.java
blob: b3df0aed5becd92666bc4db63373fe8255acad80 (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
// Copyright 2014 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.

package org.chromium.mojo.system.impl;

import org.chromium.mojo.system.Handle;
import org.chromium.mojo.system.MessagePipeHandle;
import org.chromium.mojo.system.ResultAnd;

import java.nio.ByteBuffer;
import java.util.List;

/**
 * Implementation of {@link MessagePipeHandle}.
 */
class MessagePipeHandleImpl extends HandleBase implements MessagePipeHandle {

    /**
     * @see HandleBase#HandleBase(CoreImpl, int)
     */
    MessagePipeHandleImpl(CoreImpl core, int mojoHandle) {
        super(core, mojoHandle);
    }

    /**
     * @see HandleBase#HandleBase(HandleBase)
     */
    MessagePipeHandleImpl(HandleBase handle) {
        super(handle);
    }

    /**
     * @see org.chromium.mojo.system.MessagePipeHandle#pass()
     */
    @Override
    public MessagePipeHandle pass() {
        return new MessagePipeHandleImpl(this);
    }

    /**
     * @see MessagePipeHandle#writeMessage(ByteBuffer, List, WriteFlags)
     */
    @Override
    public void writeMessage(ByteBuffer bytes, List<? extends Handle> handles, WriteFlags flags) {
        mCore.writeMessage(this, bytes, handles, flags);
    }

    /**
     * @see MessagePipeHandle#readMessage(ByteBuffer, int, ReadFlags)
     */
    @Override
    public ResultAnd<ReadMessageResult> readMessage(
            ByteBuffer bytes, int maxNumberOfHandles, ReadFlags flags) {
        return mCore.readMessage(this, bytes, maxNumberOfHandles, flags);
    }

}