| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef MOJO_COMMON_VALUES_STRUCT_TRAITS_H_ | 5 #ifndef MOJO_COMMON_VALUES_STRUCT_TRAITS_H_ |
| 6 #define MOJO_COMMON_VALUES_STRUCT_TRAITS_H_ | 6 #define MOJO_COMMON_VALUES_STRUCT_TRAITS_H_ |
| 7 | 7 |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "mojo/common/values.mojom.h" | 9 #include "mojo/common/values.mojom.h" |
| 10 #include "mojo/public/cpp/bindings/array_traits.h" | 10 #include "mojo/public/cpp/bindings/array_traits.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 case base::Value::Type::DOUBLE: | 128 case base::Value::Type::DOUBLE: |
| 129 return common::mojom::ValueDataView::Tag::DOUBLE_VALUE; | 129 return common::mojom::ValueDataView::Tag::DOUBLE_VALUE; |
| 130 case base::Value::Type::STRING: | 130 case base::Value::Type::STRING: |
| 131 return common::mojom::ValueDataView::Tag::STRING_VALUE; | 131 return common::mojom::ValueDataView::Tag::STRING_VALUE; |
| 132 case base::Value::Type::BINARY: | 132 case base::Value::Type::BINARY: |
| 133 return common::mojom::ValueDataView::Tag::BINARY_VALUE; | 133 return common::mojom::ValueDataView::Tag::BINARY_VALUE; |
| 134 case base::Value::Type::DICTIONARY: | 134 case base::Value::Type::DICTIONARY: |
| 135 return common::mojom::ValueDataView::Tag::DICTIONARY_VALUE; | 135 return common::mojom::ValueDataView::Tag::DICTIONARY_VALUE; |
| 136 case base::Value::Type::LIST: | 136 case base::Value::Type::LIST: |
| 137 return common::mojom::ValueDataView::Tag::LIST_VALUE; | 137 return common::mojom::ValueDataView::Tag::LIST_VALUE; |
| 138 case base::Value::Type::DELETED: |
| 139 // TODO(crbug.com/697817): This means a use-after-free. |
| 140 CHECK(false); |
| 141 return common::mojom::ValueDataView::Tag::NULL_VALUE; |
| 138 } | 142 } |
| 139 NOTREACHED(); | 143 NOTREACHED(); |
| 140 return common::mojom::ValueDataView::Tag::NULL_VALUE; | 144 return common::mojom::ValueDataView::Tag::NULL_VALUE; |
| 141 } | 145 } |
| 142 | 146 |
| 143 static common::mojom::NullValuePtr null_value(const base::Value& value) { | 147 static common::mojom::NullValuePtr null_value(const base::Value& value) { |
| 144 return common::mojom::NullValuePtr(); | 148 return common::mojom::NullValuePtr(); |
| 145 } | 149 } |
| 146 | 150 |
| 147 static bool bool_value(const base::Value& value) { | 151 static bool bool_value(const base::Value& value) { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 base::Value>::dictionary_value(*value); | 252 base::Value>::dictionary_value(*value); |
| 249 } | 253 } |
| 250 | 254 |
| 251 static bool Read(common::mojom::ValueDataView data, | 255 static bool Read(common::mojom::ValueDataView data, |
| 252 std::unique_ptr<base::Value>* value); | 256 std::unique_ptr<base::Value>* value); |
| 253 }; | 257 }; |
| 254 | 258 |
| 255 } // namespace mojo | 259 } // namespace mojo |
| 256 | 260 |
| 257 #endif // MOJO_COMMON_VALUES_STRUCT_TRAITS_H_ | 261 #endif // MOJO_COMMON_VALUES_STRUCT_TRAITS_H_ |
| OLD | NEW |