OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "ppapi/cpp/var.h" | 5 #include "ppapi/cpp/var.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 case PP_VARTYPE_INT32: | 158 case PP_VARTYPE_INT32: |
159 return AsInt() == other.AsInt(); | 159 return AsInt() == other.AsInt(); |
160 case PP_VARTYPE_DOUBLE: | 160 case PP_VARTYPE_DOUBLE: |
161 return AsDouble() == other.AsDouble(); | 161 return AsDouble() == other.AsDouble(); |
162 case PP_VARTYPE_STRING: | 162 case PP_VARTYPE_STRING: |
163 if (var_.value.as_id == other.var_.value.as_id) | 163 if (var_.value.as_id == other.var_.value.as_id) |
164 return true; | 164 return true; |
165 return AsString() == other.AsString(); | 165 return AsString() == other.AsString(); |
166 case PP_VARTYPE_OBJECT: | 166 case PP_VARTYPE_OBJECT: |
167 case PP_VARTYPE_ARRAY: | 167 case PP_VARTYPE_ARRAY: |
| 168 case PP_VARTYPE_ARRAY_BUFFER: |
168 case PP_VARTYPE_DICTIONARY: | 169 case PP_VARTYPE_DICTIONARY: |
169 default: // Objects, arrays, dictionaries. | 170 default: // Objects, arrays, dictionaries. |
170 return var_.value.as_id == other.var_.value.as_id; | 171 return var_.value.as_id == other.var_.value.as_id; |
171 } | 172 } |
172 } | 173 } |
173 | 174 |
174 bool Var::AsBool() const { | 175 bool Var::AsBool() const { |
175 if (!is_bool()) { | 176 if (!is_bool()) { |
176 PP_NOTREACHED(); | 177 PP_NOTREACHED(); |
177 return false; | 178 return false; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 snprintf(buf, sizeof(buf), format, str.c_str()); | 235 snprintf(buf, sizeof(buf), format, str.c_str()); |
235 } else if (is_array_buffer()) { | 236 } else if (is_array_buffer()) { |
236 snprintf(buf, sizeof(buf), "Var(ARRAY_BUFFER)"); | 237 snprintf(buf, sizeof(buf), "Var(ARRAY_BUFFER)"); |
237 } else if (is_object()) { | 238 } else if (is_object()) { |
238 snprintf(buf, sizeof(buf), "Var(OBJECT)"); | 239 snprintf(buf, sizeof(buf), "Var(OBJECT)"); |
239 } | 240 } |
240 return buf; | 241 return buf; |
241 } | 242 } |
242 | 243 |
243 } // namespace pp | 244 } // namespace pp |
OLD | NEW |