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

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

Issue 1348903003: third_party/mojo: Remove python/go/dart bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
Index: third_party/mojo/src/mojo/public/go/system/shared_buffer.go
diff --git a/third_party/mojo/src/mojo/public/go/system/shared_buffer.go b/third_party/mojo/src/mojo/public/go/system/shared_buffer.go
deleted file mode 100644
index f3048f877918d78252457048ddbb66abf732f116..0000000000000000000000000000000000000000
--- a/third_party/mojo/src/mojo/public/go/system/shared_buffer.go
+++ /dev/null
@@ -1,75 +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
-
-import (
- "reflect"
- "unsafe"
-)
-
-// 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
-}
-
-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 newUnsafeSlice(ptr unsafe.Pointer, length int) unsafe.Pointer {
- header := &reflect.SliceHeader{
- Data: uintptr(ptr),
- Len: length,
- Cap: length,
- }
- return unsafe.Pointer(header)
-}
-
-func unsafeByteSlice(ptr unsafe.Pointer, length int) []byte {
- return *(*[]byte)(newUnsafeSlice(ptr, length))
-}
« no previous file with comments | « third_party/mojo/src/mojo/public/go/system/mojo_types.go ('k') | third_party/mojo/src/mojo/public/go/system/system.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698