Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / mojo / android / system / src / org / chromium / mojo / system / impl / MessagePipeHandleImpl.java
1 // Copyright 2014 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 package org.chromium.mojo.system.impl;
6
7 import org.chromium.mojo.system.Handle;
8 import org.chromium.mojo.system.MessagePipeHandle;
9
10 import java.nio.ByteBuffer;
11 import java.util.List;
12
13 /**
14  * Implementation of {@link MessagePipeHandle}.
15  */
16 class MessagePipeHandleImpl extends HandleBase implements MessagePipeHandle {
17
18     /**
19      * @see HandleBase#HandleBase(CoreImpl, int)
20      */
21     MessagePipeHandleImpl(CoreImpl core, int mojoHandle) {
22         super(core, mojoHandle);
23     }
24
25     /**
26      * @see HandleBase#HandleBase(HandleBase)
27      */
28     MessagePipeHandleImpl(HandleBase handle) {
29         super(handle);
30     }
31
32     /**
33      * @see org.chromium.mojo.system.MessagePipeHandle#pass()
34      */
35     @Override
36     public MessagePipeHandle pass() {
37         return new MessagePipeHandleImpl(this);
38     }
39
40     /**
41      * @see MessagePipeHandle#writeMessage(ByteBuffer, List, WriteFlags)
42      */
43     @Override
44     public void writeMessage(ByteBuffer bytes, List<? extends Handle> handles, WriteFlags flags) {
45         mCore.writeMessage(this, bytes, handles, flags);
46     }
47
48     /**
49      * @see MessagePipeHandle#readMessage(ByteBuffer, int, ReadFlags)
50      */
51     @Override
52     public ReadMessageResult readMessage(ByteBuffer bytes,
53             int maxNumberOfHandles,
54             ReadFlags flags) {
55         return mCore.readMessage(this, bytes, maxNumberOfHandles, flags);
56     }
57
58 }