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

Side by Side Diff: third_party/mojo/src/mojo/public/go/bindings/encoder.go

Issue 1127293003: Update mojo sdk to rev f84766d3b6420b7cf6a113d9d65d73cb5fe18d90 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: formatting 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package bindings 5 package bindings
6 6
7 import ( 7 import (
8 "encoding/binary" 8 "encoding/binary"
9 "fmt" 9 "fmt"
10 "math" 10 "math"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 func (e *Encoder) StartArray(length, elementBitSize uint32) { 144 func (e *Encoder) StartArray(length, elementBitSize uint32) {
145 dataSize := dataHeaderSize + bytesForBits(uint64(length)*uint64(elementB itSize)) 145 dataSize := dataHeaderSize + bytesForBits(uint64(length)*uint64(elementB itSize))
146 header := DataHeader{uint32(dataSize), length} 146 header := DataHeader{uint32(dataSize), length}
147 e.pushState(header, elementBitSize) 147 e.pushState(header, elementBitSize)
148 } 148 }
149 149
150 // StartMap starts encoding a map and writes its data header. 150 // StartMap starts encoding a map and writes its data header.
151 // Note: it doesn't write a pointer to the encoded map. 151 // Note: it doesn't write a pointer to the encoded map.
152 // Call |Finish()| after writing keys array and values array. 152 // Call |Finish()| after writing keys array and values array.
153 func (e *Encoder) StartMap() { 153 func (e *Encoder) StartMap() {
154 » e.pushState(mapHeader, pointerBitSize) 154 » e.pushState(mapHeader, 0)
155 } 155 }
156 156
157 // StartStruct starts encoding a struct and writes its data header. 157 // StartStruct starts encoding a struct and writes its data header.
158 // Note: it doesn't write a pointer to the encoded struct. 158 // Note: it doesn't write a pointer to the encoded struct.
159 // Call |Finish()| after writing all fields. 159 // Call |Finish()| after writing all fields.
160 func (e *Encoder) StartStruct(size, version uint32) { 160 func (e *Encoder) StartStruct(size, version uint32) {
161 dataSize := dataHeaderSize + int(size) 161 dataSize := dataHeaderSize + int(size)
162 header := DataHeader{uint32(dataSize), version} 162 header := DataHeader{uint32(dataSize), version}
163 e.pushState(header, 0) 163 e.pushState(header, 0)
164 } 164 }
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 336
337 // WriteInterface writes an interface and invalidates the passed handle object. 337 // WriteInterface writes an interface and invalidates the passed handle object.
338 func (e *Encoder) WriteInterface(handle system.Handle) error { 338 func (e *Encoder) WriteInterface(handle system.Handle) error {
339 if err := e.WriteHandle(handle); err != nil { 339 if err := e.WriteHandle(handle); err != nil {
340 return err 340 return err
341 } 341 }
342 e.state().elementsProcessed-- 342 e.state().elementsProcessed--
343 // Set the version field to 0 for now. 343 // Set the version field to 0 for now.
344 return e.WriteUint32(0) 344 return e.WriteUint32(0)
345 } 345 }
OLDNEW
« no previous file with comments | « third_party/mojo/src/mojo/public/go/bindings/decoder.go ('k') | third_party/mojo/src/mojo/public/go/bindings/message.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698