Home | History | Annotate | Download | only in impl
      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      * @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(ReadFlags)
     50      */
     51     @Override
     52     public ResultAnd<ReadMessageResult> readMessage(ReadFlags flags) {
     53         return mCore.readMessage(this, flags);
     54     }
     55 }
     56