Commit feb0d6b1 authored by derat@chromium.org's avatar derat@chromium.org

base: Add DCHECK that double Values are finite.

JSON doesn't support NaN or positive/negative infinity.  I'm
hoping that this DCHECK will slightly increase the odds that
bugs are caught before they start corrupting pref files.

BUG=73856
TEST=none


Review URL: http://codereview.chromium.org/7646032

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97111 0039d316-1c4b-4281-b951-d872f2087c98
parent 52172024
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "base/values.h" #include "base/values.h"
#include "base/float_util.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/string_util.h" #include "base/string_util.h"
#include "base/utf_string_conversions.h" #include "base/utf_string_conversions.h"
...@@ -160,6 +161,8 @@ FundamentalValue::FundamentalValue(int in_value) ...@@ -160,6 +161,8 @@ FundamentalValue::FundamentalValue(int in_value)
FundamentalValue::FundamentalValue(double in_value) FundamentalValue::FundamentalValue(double in_value)
: Value(TYPE_DOUBLE), double_value_(in_value) { : Value(TYPE_DOUBLE), double_value_(in_value) {
// JSON doesn't support NaN or positive or negative infinity.
DCHECK(IsFinite(in_value));
} }
FundamentalValue::~FundamentalValue() { FundamentalValue::~FundamentalValue() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment