| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 case PP_VARTYPE_BOOL: | 151 case PP_VARTYPE_BOOL: |
| 152 return AsBool() == other.AsBool(); | 152 return AsBool() == other.AsBool(); |
| 153 case PP_VARTYPE_INT32: | 153 case PP_VARTYPE_INT32: |
| 154 return AsInt() == other.AsInt(); | 154 return AsInt() == other.AsInt(); |
| 155 case PP_VARTYPE_DOUBLE: | 155 case PP_VARTYPE_DOUBLE: |
| 156 return AsDouble() == other.AsDouble(); | 156 return AsDouble() == other.AsDouble(); |
| 157 case PP_VARTYPE_STRING: | 157 case PP_VARTYPE_STRING: |
| 158 if (var_.value.as_id == other.var_.value.as_id) | 158 if (var_.value.as_id == other.var_.value.as_id) |
| 159 return true; | 159 return true; |
| 160 return AsString() == other.AsString(); | 160 return AsString() == other.AsString(); |
| 161 case PP_VARTYPE_OBJECT: |
| 162 case PP_VARTYPE_ARRAY: |
| 163 case PP_VARTYPE_DICTIONARY: |
| 161 default: // Objects, arrays, dictionaries. | 164 default: // Objects, arrays, dictionaries. |
| 162 return var_.value.as_id == other.var_.value.as_id; | 165 return var_.value.as_id == other.var_.value.as_id; |
| 163 } | 166 } |
| 164 } | 167 } |
| 165 | 168 |
| 166 bool Var::AsBool() const { | 169 bool Var::AsBool() const { |
| 167 if (!is_bool()) { | 170 if (!is_bool()) { |
| 168 PP_NOTREACHED(); | 171 PP_NOTREACHED(); |
| 169 return false; | 172 return false; |
| 170 } | 173 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 str.append("..."); | 230 str.append("..."); |
| 228 } | 231 } |
| 229 snprintf(buf, sizeof(buf), format, str.c_str()); | 232 snprintf(buf, sizeof(buf), format, str.c_str()); |
| 230 } else if (is_object()) { | 233 } else if (is_object()) { |
| 231 snprintf(buf, sizeof(buf), "Var<OBJECT>"); | 234 snprintf(buf, sizeof(buf), "Var<OBJECT>"); |
| 232 } | 235 } |
| 233 return buf; | 236 return buf; |
| 234 } | 237 } |
| 235 | 238 |
| 236 } // namespace pp | 239 } // namespace pp |
| OLD | NEW |