| OLD | NEW |
| 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 serialization | 5 package serialization |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "bytes" | 8 "bytes" |
| 9 "compress/gzip" | 9 "compress/gzip" |
| 10 "encoding/base64" | 10 "encoding/base64" |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 | 617 |
| 618 func translateUserValueRef(r *mojom.UserValueRef) mojom_types.Value { | 618 func translateUserValueRef(r *mojom.UserValueRef) mojom_types.Value { |
| 619 switch t := r.ResolvedConcreteValue().(type) { | 619 switch t := r.ResolvedConcreteValue().(type) { |
| 620 case mojom.BuiltInConstantValue: | 620 case mojom.BuiltInConstantValue: |
| 621 return translateBuiltInConstantValue(t) | 621 return translateBuiltInConstantValue(t) |
| 622 default: | 622 default: |
| 623 valueKey := stringPointer(r.ResolvedDeclaredValue().ValueKey()) | 623 valueKey := stringPointer(r.ResolvedDeclaredValue().ValueKey()) |
| 624 return &mojom_types.ValueUserValueReference{mojom_types.UserValu
eReference{ | 624 return &mojom_types.ValueUserValueReference{mojom_types.UserValu
eReference{ |
| 625 Identifier: r.Identifier(), | 625 Identifier: r.Identifier(), |
| 626 ValueKey: valueKey}} | 626 ValueKey: valueKey}} |
| 627 // We do not populate ResolvedConcreteValue because it is deprec
ated. | |
| 628 } | 627 } |
| 629 } | 628 } |
| 630 | 629 |
| 631 func translateDeclarationData(d *mojom.DeclarationData) *mojom_types.Declaration
Data { | 630 func translateDeclarationData(d *mojom.DeclarationData) *mojom_types.Declaration
Data { |
| 632 declData := mojom_types.DeclarationData{} | 631 declData := mojom_types.DeclarationData{} |
| 633 | 632 |
| 634 // attributes field | 633 // attributes field |
| 635 if d.Attributes() != nil { | 634 if d.Attributes() != nil { |
| 636 declData.Attributes = new([]mojom_types.Attribute) | 635 declData.Attributes = new([]mojom_types.Attribute) |
| 637 for _, attr := range d.Attributes().List { | 636 for _, attr := range d.Attributes().List { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 | 727 |
| 729 // stringPointer is a convenience function for creating a pointer to a string wh
ose value | 728 // stringPointer is a convenience function for creating a pointer to a string wh
ose value |
| 730 // is the specified string. It may be used in situations where the compiler will | 729 // is the specified string. It may be used in situations where the compiler will |
| 731 // not allow you to take the address of a string value directly, such as the | 730 // not allow you to take the address of a string value directly, such as the |
| 732 // return value of a function. It is necessary to create pointers to strings bec
ause | 731 // return value of a function. It is necessary to create pointers to strings bec
ause |
| 733 // that is how the Mojom type |string?| (i.e. nullable string) is represented in | 732 // that is how the Mojom type |string?| (i.e. nullable string) is represented in |
| 734 // in the Mojom Go bindings. | 733 // in the Mojom Go bindings. |
| 735 func stringPointer(s string) *string { | 734 func stringPointer(s string) *string { |
| 736 return &s | 735 return &s |
| 737 } | 736 } |
| OLD | NEW |