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

Unified Diff: mojo/public/go/system/impl/core_impl.go

Issue 664163004: -Go bindings for creating/managing shared buffers between applications (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Go build patches Created 6 years, 2 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/core.go ('k') | mojo/public/go/system/impl/mojo_types.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/go/system/impl/core_impl.go
diff --git a/mojo/public/go/system/impl/core_impl.go b/mojo/public/go/system/impl/core_impl.go
index 8284b8b7a5418df4d761daa8f4a37751a509fead..601ebd2fb26cb5ab2dba0321977844ac4fccbb24 100644
--- a/mojo/public/go/system/impl/core_impl.go
+++ b/mojo/public/go/system/impl/core_impl.go
@@ -7,6 +7,7 @@ package impl
//#include "mojo/public/platform/native/system_thunks.h"
//#include "mojo/public/c/system/main.h"
import "C"
+import "unsafe"
var core *CoreImpl
@@ -81,3 +82,28 @@ func (c *CoreImpl) ReadData(consumer MojoHandle, flags MojoReadDataFlags) (MojoR
result = C.MojoReadData(consumer.cType(), cArrayBytes(data), &num_bytes, flags.cType())
return (MojoResult)(result), data
}
+
+func (c *CoreImpl) CreateSharedBuffer(opts *SharedBufferOptions, numBytes uint64) (MojoResult, MojoHandle) {
+ var handle C.MojoHandle
+ result := C.MojoCreateSharedBuffer(opts.cType(), (C.uint64_t)(numBytes), &handle)
+ return (MojoResult)(result), (MojoHandle)(handle)
+}
+
+func (c *CoreImpl) DuplicateBufferHandle(handle MojoHandle, opts *DuplicateBufferHandleOptions) (MojoResult, MojoHandle) {
+ var duplicate C.MojoHandle
+ result := C.MojoDuplicateBufferHandle(handle.cType(), opts.cType(), &duplicate)
+ return (MojoResult)(result), (MojoHandle)(duplicate)
+}
+
+func (c *CoreImpl) MapBuffer(handle MojoHandle, offset uint64, numBytes uint64, flags MojoMapBufferFlags) (MojoResult, unsafe.Pointer) {
+ var bufPtr unsafe.Pointer
+ result := C.MojoMapBuffer(handle.cType(), (C.uint64_t)(offset), (C.uint64_t)(numBytes), &bufPtr, flags.cType())
+ if result != C.MOJO_RESULT_OK {
+ return (MojoResult)(result), nil
+ }
+ return MOJO_RESULT_OK, bufPtr
+}
+
+func (c *CoreImpl) UnmapBuffer(buffer unsafe.Pointer) MojoResult {
+ return (MojoResult)(C.MojoUnmapBuffer(buffer))
+}
« no previous file with comments | « mojo/public/go/system/core.go ('k') | mojo/public/go/system/impl/mojo_types.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698