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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ExceptionMessages.cpp

Issue 2817533003: Replace ASSERT, RELEASE_ASSERT, and ASSERT_NOT_REACHED in bindings (Closed)
Patch Set: fixed dcheck build error Created 3 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 "' property is neither an array, nor does it have indexed properties."; 138 "' property is neither an array, nor does it have indexed properties.";
139 } 139 }
140 140
141 String ExceptionMessages::NotEnoughArguments(unsigned expected, 141 String ExceptionMessages::NotEnoughArguments(unsigned expected,
142 unsigned provided) { 142 unsigned provided) {
143 return String::Number(expected) + " argument" + (expected > 1 ? "s" : "") + 143 return String::Number(expected) + " argument" + (expected > 1 ? "s" : "") +
144 " required, but only " + String::Number(provided) + " present."; 144 " required, but only " + String::Number(provided) + " present.";
145 } 145 }
146 146
147 String ExceptionMessages::NotAFiniteNumber(double value, const char* name) { 147 String ExceptionMessages::NotAFiniteNumber(double value, const char* name) {
148 ASSERT(!std::isfinite(value)); 148 DCHECK(!std::isfinite(value));
149 return String::Format("The %s is %s.", name, 149 return String::Format("The %s is %s.", name,
150 std::isinf(value) ? "infinite" : "not a number"); 150 std::isinf(value) ? "infinite" : "not a number");
151 } 151 }
152 152
153 String ExceptionMessages::NotAFiniteNumber(const Decimal& value, 153 String ExceptionMessages::NotAFiniteNumber(const Decimal& value,
154 const char* name) { 154 const char* name) {
155 ASSERT(!value.IsFinite()); 155 DCHECK(!value.IsFinite());
156 return String::Format("The %s is %s.", name, 156 return String::Format("The %s is %s.", name,
157 value.IsInfinity() ? "infinite" : "not a number"); 157 value.IsInfinity() ? "infinite" : "not a number");
158 } 158 }
159 159
160 String ExceptionMessages::OrdinalNumber(int number) { 160 String ExceptionMessages::OrdinalNumber(int number) {
161 String suffix("th"); 161 String suffix("th");
162 switch (number % 10) { 162 switch (number % 10) {
163 case 1: 163 case 1:
164 if (number % 100 != 11) 164 if (number % 100 != 11)
165 suffix = "st"; 165 suffix = "st";
(...skipping 21 matching lines...) Expand all
187 CORE_EXPORT String ExceptionMessages::FormatNumber<float>(float number) { 187 CORE_EXPORT String ExceptionMessages::FormatNumber<float>(float number) {
188 return FormatPotentiallyNonFiniteNumber(number); 188 return FormatPotentiallyNonFiniteNumber(number);
189 } 189 }
190 190
191 template <> 191 template <>
192 CORE_EXPORT String ExceptionMessages::FormatNumber<double>(double number) { 192 CORE_EXPORT String ExceptionMessages::FormatNumber<double>(double number) {
193 return FormatPotentiallyNonFiniteNumber(number); 193 return FormatPotentiallyNonFiniteNumber(number);
194 } 194 }
195 195
196 } // namespace blink 196 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698