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