• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.SharedBufferHandle;
8 
9 import java.nio.ByteBuffer;
10 
11 /**
12  * Implementation of {@link SharedBufferHandle}.
13  */
14 class SharedBufferHandleImpl extends HandleBase implements SharedBufferHandle {
15     /**
16      * @see HandleBase#HandleBase(CoreImpl, int)
17      */
SharedBufferHandleImpl(CoreImpl core, int mojoHandle)18     SharedBufferHandleImpl(CoreImpl core, int mojoHandle) {
19         super(core, mojoHandle);
20     }
21 
22     /**
23      * @see HandleBase#HandleBase(HandleBase)
24      */
SharedBufferHandleImpl(HandleBase handle)25     SharedBufferHandleImpl(HandleBase handle) {
26         super(handle);
27     }
28 
29     /**
30      * @see org.chromium.mojo.system.SharedBufferHandle#pass()
31      */
32     @Override
pass()33     public SharedBufferHandle pass() {
34         return new SharedBufferHandleImpl(this);
35     }
36 
37     /**
38      * @see SharedBufferHandle#duplicate(DuplicateOptions)
39      */
40     @Override
duplicate(DuplicateOptions options)41     public SharedBufferHandle duplicate(DuplicateOptions options) {
42         return mCore.duplicate(this, options);
43     }
44 
45     /**
46      * @see SharedBufferHandle#map(long, long, MapFlags)
47      */
48     @Override
map(long offset, long numBytes, MapFlags flags)49     public ByteBuffer map(long offset, long numBytes, MapFlags flags) {
50         return mCore.map(this, offset, numBytes, flags);
51     }
52 
53     /**
54      * @see SharedBufferHandle#unmap(ByteBuffer)
55      */
56     @Override
unmap(ByteBuffer buffer)57     public void unmap(ByteBuffer buffer) {
58         mCore.unmap(buffer);
59     }
60 }
61