Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: mojo/public/go/system/shared_buffer.go

Issue 2250183003: Make the fuchsia mojo/public repo the source of truth. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/go/system/mojo_types.go ('k') | mojo/public/go/system/system.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/go/system/shared_buffer.go
diff --git a/mojo/public/go/system/shared_buffer.go b/mojo/public/go/system/shared_buffer.go
deleted file mode 100644
index dad439f816de8ac0c8980316f1d73fb7e3ccf6e1..0000000000000000000000000000000000000000
--- a/mojo/public/go/system/shared_buffer.go
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2015 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 system
-
-// SharedBufferHandle is a handle for a buffer that can be shared between
-// applications.
-type SharedBufferHandle interface {
- Handle
-
- // DuplicateBufferHandle duplicates the handle to a buffer.
- DuplicateBufferHandle(opts *DuplicateBufferHandleOptions) (MojoResult, SharedBufferHandle)
-
- // MapBuffer maps the requested part of the shared buffer given by handle
- // into memory with specified flags. On success, it returns slice that
- // points to the requested shared buffer.
- MapBuffer(offset uint64, numBytes int, flags MojoMapBufferFlags) (MojoResult, []byte)
-
- // UnmapBuffer unmaps a buffer that was returned by MapBuffer.
- UnmapBuffer(buffer []byte) MojoResult
-
- // Gets the shared buffer information (buffer size, and the specified flags).
- GetBufferInformation() (MojoResult, MojoBufferInformation)
-}
-
-type sharedBuffer struct {
- // baseHandle should always be the first component of this struct,
- // see |finalizeHandle()| for more details.
- baseHandle
-}
-
-func (h *sharedBuffer) DuplicateBufferHandle(opts *DuplicateBufferHandleOptions) (MojoResult, SharedBufferHandle) {
- var flags uint32
- if opts != nil {
- flags = uint32(opts.Flags)
- }
- h.core.mu.Lock()
- r, dup := sysImpl.DuplicateBufferHandle(uint32(h.mojoHandle), flags)
- h.core.mu.Unlock()
- return MojoResult(r), core.AcquireNativeHandle(MojoHandle(dup)).ToSharedBufferHandle()
-}
-
-func (h *sharedBuffer) MapBuffer(offset uint64, numBytes int, flags MojoMapBufferFlags) (MojoResult, []byte) {
- h.core.mu.Lock()
- r, buf := sysImpl.MapBuffer(uint32(h.mojoHandle), offset, uint64(numBytes), uint32(flags))
- h.core.mu.Unlock()
- if r != 0 {
- return MojoResult(r), nil
- }
-
- return MojoResult(r), buf
-}
-
-func (h *sharedBuffer) UnmapBuffer(buffer []byte) MojoResult {
- h.core.mu.Lock()
- r := sysImpl.UnmapBuffer(buffer)
- h.core.mu.Unlock()
- return MojoResult(r)
-}
-
-func (h *sharedBuffer) GetBufferInformation() (MojoResult, MojoBufferInformation) {
- h.core.mu.Lock()
- r, flags, numBytes := sysImpl.GetBufferInformation(uint32(h.mojoHandle))
- h.core.mu.Unlock()
-
- if r != 0 {
- return MojoResult(r), MojoBufferInformation{}
- }
-
- return MojoResult(r), MojoBufferInformation{
- Flags: MojoBufferInformationFlags(flags),
- NumBytes: numBytes}
-}
« no previous file with comments | « mojo/public/go/system/mojo_types.go ('k') | mojo/public/go/system/system.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698