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

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

Issue 910883002: Update mojo sdk to rev 8af2ccff2eee4bfca1043015abee30482a030b30 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Apply 9f87aeadbda22441b7d469e596f7bd7d0d73e2a8 (https://codereview.chromium.org/908973002/) Created 5 years, 10 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/data_pipe.go
diff --git a/third_party/mojo/src/mojo/public/go/system/data_pipe.go b/third_party/mojo/src/mojo/public/go/system/data_pipe.go
index b79a1e0395c965452f96dcbbeccb3196c39b0e81..a433074beb7bcb4ec15d801d53ea728e1b145bf6 100644
--- a/third_party/mojo/src/mojo/public/go/system/data_pipe.go
+++ b/third_party/mojo/src/mojo/public/go/system/data_pipe.go
@@ -86,6 +86,9 @@ type dataPipeConsumer struct {
}
func (h *dataPipeConsumer) ReadData(flags MojoReadDataFlags) (MojoResult, []byte) {
+ h.core.mu.Lock()
+ defer h.core.mu.Unlock()
+
cParams := C.MallocReadDataParams()
defer C.FreeReadDataParams(cParams)
*cParams.num_bytes = 0
@@ -103,6 +106,9 @@ func (h *dataPipeConsumer) ReadData(flags MojoReadDataFlags) (MojoResult, []byte
}
func (h *dataPipeConsumer) BeginReadData(numBytes int, flags MojoReadDataFlags) (MojoResult, []byte) {
+ h.core.mu.Lock()
+ defer h.core.mu.Unlock()
+
cParams := C.MallocTwoPhaseActionParams()
defer C.FreeTwoPhaseActionParams(cParams)
*cParams.num_bytes = C.uint32_t(numBytes)
@@ -112,6 +118,9 @@ func (h *dataPipeConsumer) BeginReadData(numBytes int, flags MojoReadDataFlags)
}
func (h *dataPipeConsumer) EndReadData(numBytesRead int) MojoResult {
+ h.core.mu.Lock()
+ defer h.core.mu.Unlock()
+
return MojoResult(C.MojoEndReadData(h.mojoHandle.cValue(), C.uint32_t(numBytesRead)))
}
@@ -120,6 +129,9 @@ type dataPipeProducer struct {
}
func (h *dataPipeProducer) WriteData(data []byte, flags MojoWriteDataFlags) (MojoResult, int) {
+ h.core.mu.Lock()
+ defer h.core.mu.Unlock()
+
cParams := C.MallocWriteDataParams(C.uint32_t(len(data)))
defer C.FreeWriteDataParams(cParams)
*cParams.num_bytes = C.uint32_t(len(data))
@@ -130,6 +142,9 @@ func (h *dataPipeProducer) WriteData(data []byte, flags MojoWriteDataFlags) (Moj
}
func (h *dataPipeProducer) BeginWriteData(numBytes int, flags MojoWriteDataFlags) (MojoResult, []byte) {
+ h.core.mu.Lock()
+ defer h.core.mu.Unlock()
+
cParams := C.MallocTwoPhaseActionParams()
defer C.FreeTwoPhaseActionParams(cParams)
*cParams.num_bytes = C.uint32_t(numBytes)
@@ -139,5 +154,8 @@ func (h *dataPipeProducer) BeginWriteData(numBytes int, flags MojoWriteDataFlags
}
func (h *dataPipeProducer) EndWriteData(numBytesWritten int) MojoResult {
+ h.core.mu.Lock()
+ defer h.core.mu.Unlock()
+
return MojoResult(C.MojoEndWriteData(h.mojoHandle.cValue(), C.uint32_t(numBytesWritten)))
}
« no previous file with comments | « third_party/mojo/src/mojo/public/go/system/core.go ('k') | third_party/mojo/src/mojo/public/go/system/handle.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698