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

Side by Side Diff: base/values.cc

Issue 7646032: base: Add DCHECK that double Values are finite. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge; unrelated libcros failures Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/values.h" 5 #include "base/values.h"
6 6
7 #include "base/float_util.h"
7 #include "base/logging.h" 8 #include "base/logging.h"
8 #include "base/string_util.h" 9 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
10 11
11 namespace { 12 namespace {
12 13
13 // Make a deep copy of |node|, but don't include empty lists or dictionaries 14 // Make a deep copy of |node|, but don't include empty lists or dictionaries
14 // in the copy. It's possible for this function to return NULL and it 15 // in the copy. It's possible for this function to return NULL and it
15 // expects |node| to always be non-NULL. 16 // expects |node| to always be non-NULL.
16 Value* CopyWithoutEmptyChildren(Value* node) { 17 Value* CopyWithoutEmptyChildren(Value* node) {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 FundamentalValue::FundamentalValue(bool in_value) 154 FundamentalValue::FundamentalValue(bool in_value)
154 : Value(TYPE_BOOLEAN), boolean_value_(in_value) { 155 : Value(TYPE_BOOLEAN), boolean_value_(in_value) {
155 } 156 }
156 157
157 FundamentalValue::FundamentalValue(int in_value) 158 FundamentalValue::FundamentalValue(int in_value)
158 : Value(TYPE_INTEGER), integer_value_(in_value) { 159 : Value(TYPE_INTEGER), integer_value_(in_value) {
159 } 160 }
160 161
161 FundamentalValue::FundamentalValue(double in_value) 162 FundamentalValue::FundamentalValue(double in_value)
162 : Value(TYPE_DOUBLE), double_value_(in_value) { 163 : Value(TYPE_DOUBLE), double_value_(in_value) {
164 // JSON doesn't support NaN or positive or negative infinity.
165 DCHECK(IsFinite(in_value));
163 } 166 }
164 167
165 FundamentalValue::~FundamentalValue() { 168 FundamentalValue::~FundamentalValue() {
166 } 169 }
167 170
168 bool FundamentalValue::GetAsBoolean(bool* out_value) const { 171 bool FundamentalValue::GetAsBoolean(bool* out_value) const {
169 if (out_value && IsType(TYPE_BOOLEAN)) 172 if (out_value && IsType(TYPE_BOOLEAN))
170 *out_value = boolean_value_; 173 *out_value = boolean_value_;
171 return (IsType(TYPE_BOOLEAN)); 174 return (IsType(TYPE_BOOLEAN));
172 } 175 }
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 if (lhs_it != end() || rhs_it != other_list->end()) 899 if (lhs_it != end() || rhs_it != other_list->end())
897 return false; 900 return false;
898 901
899 return true; 902 return true;
900 } 903 }
901 904
902 ValueSerializer::~ValueSerializer() { 905 ValueSerializer::~ValueSerializer() {
903 } 906 }
904 907
905 } // namespace base 908 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698