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/bindings/decoder.go

Issue 1019173002: Update mojo sdk to rev 7214b7ec7d27563b2666afad86cf1c5895c56c18 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Keep permission service alive if embedder drops requests Created 5 years, 9 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/bindings/decoder.go
diff --git a/third_party/mojo/src/mojo/public/go/bindings/decoder.go b/third_party/mojo/src/mojo/public/go/bindings/decoder.go
index 6f6b4330add2107b980af93755955a376002707c..34a230ef9acd8de1c430f195bc256d8889c6cf02 100644
--- a/third_party/mojo/src/mojo/public/go/bindings/decoder.go
+++ b/third_party/mojo/src/mojo/public/go/bindings/decoder.go
@@ -125,22 +125,22 @@ func (d *Decoder) StartMap() error {
return nil
}
-// StartStruct starts decoding a struct and reads its data header,
-// returning struct version declared in data header.
+// StartStruct starts decoding a struct and reads its data header.
+// Returns the read data header. The caller should check if it is valid.
// Note: it doesn't read a pointer to the encoded struct.
// Call |Finish()| after reading all fields.
-func (d *Decoder) StartStruct() (uint32, error) {
+func (d *Decoder) StartStruct() (DataHeader, error) {
header, err := d.readDataHeader()
if err != nil {
- return 0, err
+ return DataHeader{}, err
}
if header.Size < dataHeaderSize {
- return 0, fmt.Errorf("data header size is too small: is %d, but should be at least %d", header.Size, dataHeaderSize)
+ return DataHeader{}, fmt.Errorf("data header size(%d) should be at least %d", header.Size, dataHeaderSize)
}
if err := d.pushState(header, 0); err != nil {
- return 0, err
+ return DataHeader{}, err
}
- return header.ElementsOrVersion, nil
+ return header, nil
}
func (d *Decoder) readDataHeader() (DataHeader, error) {

Powered by Google App Engine
This is Rietveld 408576698