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

Unified Diff: third_party/mojo/src/mojo/public/go/bindings/decoder.go

Issue 1157843002: Update mojo sdk to rev 1dc8a9a5db73d3718d99917fadf31f5fb2ebad4f (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 9711e23b4473e8cb9fe4034ab215abd962b34987..dac511021e56387ad9de8ffbfa18d8e278862934 100644
--- a/third_party/mojo/src/mojo/public/go/bindings/decoder.go
+++ b/third_party/mojo/src/mojo/public/go/bindings/decoder.go
@@ -149,6 +149,21 @@ func (d *Decoder) StartStruct() (DataHeader, error) {
return header, nil
}
+// StartUnion starts decoding a union and reads its header.
+// Returns the read data header. The caller should check if it is valid.
+// Note: it doesn't read the data field.
+func (d *Decoder) StartUnion() (DataHeader, error) {
+ header, err := d.readDataHeader()
+ if err != nil {
+ return DataHeader{}, err
+ }
+
+ if err := d.pushState(header, 0); err != nil {
+ return DataHeader{}, err
+ }
+ return header, nil
+}
+
func (d *Decoder) readDataHeader() (DataHeader, error) {
if err := d.claimData(dataHeaderSize); err != nil {
return DataHeader{}, err
« no previous file with comments | « third_party/mojo/src/mojo/public/dart/src/types.dart ('k') | third_party/mojo/src/mojo/public/go/bindings/encoder.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698