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

Unified Diff: third_party/WebKit/Source/bindings/tests/results/core/TestEnumOrDouble.cpp

Issue 2446213002: [Bindings] [Reformat] Reformat template files (Closed)
Patch Set: Rebase (Split out Callbackfunctions) Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/tests/results/core/TestEnumOrDouble.cpp
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/TestEnumOrDouble.cpp b/third_party/WebKit/Source/bindings/tests/results/core/TestEnumOrDouble.cpp
index 806089327c26f9deff50fa14b3069e98311ac25b..d8fa46ea44db354ba1a68e3a7b09664b34467ee6 100644
--- a/third_party/WebKit/Source/bindings/tests/results/core/TestEnumOrDouble.cpp
+++ b/third_party/WebKit/Source/bindings/tests/results/core/TestEnumOrDouble.cpp
@@ -11,123 +11,110 @@
namespace blink {
-TestEnumOrDouble::TestEnumOrDouble()
- : m_type(SpecificTypeNone)
-{
-}
+TestEnumOrDouble::TestEnumOrDouble() : m_type(SpecificTypeNone) {}
-String TestEnumOrDouble::getAsTestEnum() const
-{
- ASSERT(isTestEnum());
- return m_testEnum;
+String TestEnumOrDouble::getAsTestEnum() const {
+ DCHECK(isTestEnum());
+ return m_testEnum;
}
-void TestEnumOrDouble::setTestEnum(String value)
-{
- ASSERT(isNull());
- NonThrowableExceptionState exceptionState;
- const char* validValues[] = {
- "",
- "EnumValue1",
- "EnumValue2",
- "EnumValue3",
- };
- if (!isValidEnum(value, validValues, WTF_ARRAY_LENGTH(validValues), "TestEnum", exceptionState)) {
- ASSERT_NOT_REACHED();
- return;
- }
- m_testEnum = value;
- m_type = SpecificTypeTestEnum;
+void TestEnumOrDouble::setTestEnum(String value) {
+ DCHECK(isNull());
+ NonThrowableExceptionState exceptionState;
+ const char* validValues[] = {
+ "",
+ "EnumValue1",
+ "EnumValue2",
+ "EnumValue3",
+ };
+ if (!isValidEnum(value, validValues, WTF_ARRAY_LENGTH(validValues), "TestEnum", exceptionState)) {
+ NOTREACHED();
+ return;
+ }
+ m_testEnum = value;
+ m_type = SpecificTypeTestEnum;
}
-TestEnumOrDouble TestEnumOrDouble::fromTestEnum(String value)
-{
- TestEnumOrDouble container;
- container.setTestEnum(value);
- return container;
+TestEnumOrDouble TestEnumOrDouble::fromTestEnum(String value) {
+ TestEnumOrDouble container;
+ container.setTestEnum(value);
+ return container;
}
-double TestEnumOrDouble::getAsDouble() const
-{
- ASSERT(isDouble());
- return m_double;
+double TestEnumOrDouble::getAsDouble() const {
+ DCHECK(isDouble());
+ return m_double;
}
-void TestEnumOrDouble::setDouble(double value)
-{
- ASSERT(isNull());
- m_double = value;
- m_type = SpecificTypeDouble;
+void TestEnumOrDouble::setDouble(double value) {
+ DCHECK(isNull());
+ m_double = value;
+ m_type = SpecificTypeDouble;
}
-TestEnumOrDouble TestEnumOrDouble::fromDouble(double value)
-{
- TestEnumOrDouble container;
- container.setDouble(value);
- return container;
+TestEnumOrDouble TestEnumOrDouble::fromDouble(double value) {
+ TestEnumOrDouble container;
+ container.setDouble(value);
+ return container;
}
TestEnumOrDouble::TestEnumOrDouble(const TestEnumOrDouble&) = default;
TestEnumOrDouble::~TestEnumOrDouble() = default;
TestEnumOrDouble& TestEnumOrDouble::operator=(const TestEnumOrDouble&) = default;
-DEFINE_TRACE(TestEnumOrDouble)
-{
+DEFINE_TRACE(TestEnumOrDouble) {
}
-void V8TestEnumOrDouble::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, TestEnumOrDouble& impl, UnionTypeConversionMode conversionMode, ExceptionState& exceptionState)
-{
- if (v8Value.IsEmpty())
- return;
-
- if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull(v8Value))
- return;
-
- if (v8Value->IsNumber()) {
- double cppValue = toRestrictedDouble(isolate, v8Value, exceptionState);
- if (exceptionState.hadException())
- return;
- impl.setDouble(cppValue);
- return;
- }
-
- {
- V8StringResource<> cppValue = v8Value;
- if (!cppValue.prepare(exceptionState))
- return;
- const char* validValues[] = {
- "",
- "EnumValue1",
- "EnumValue2",
- "EnumValue3",
- };
- if (!isValidEnum(cppValue, validValues, WTF_ARRAY_LENGTH(validValues), "TestEnum", exceptionState))
- return;
- impl.setTestEnum(cppValue);
- return;
- }
+void V8TestEnumOrDouble::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, TestEnumOrDouble& impl, UnionTypeConversionMode conversionMode, ExceptionState& exceptionState) {
+ if (v8Value.IsEmpty())
+ return;
+
+ if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull(v8Value))
+ return;
+
+ if (v8Value->IsNumber()) {
+ double cppValue = toRestrictedDouble(isolate, v8Value, exceptionState);
+ if (exceptionState.hadException())
+ return;
+ impl.setDouble(cppValue);
+ return;
+ }
+
+ {
+ V8StringResource<> cppValue = v8Value;
+ if (!cppValue.prepare(exceptionState))
+ return;
+ const char* validValues[] = {
+ "",
+ "EnumValue1",
+ "EnumValue2",
+ "EnumValue3",
+ };
+ if (!isValidEnum(cppValue, validValues, WTF_ARRAY_LENGTH(validValues), "TestEnum", exceptionState))
+ return;
+ impl.setTestEnum(cppValue);
+ return;
+ }
}
-v8::Local<v8::Value> toV8(const TestEnumOrDouble& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
-{
- switch (impl.m_type) {
+v8::Local<v8::Value> toV8(const TestEnumOrDouble& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) {
+ switch (impl.m_type) {
case TestEnumOrDouble::SpecificTypeNone:
- return v8::Null(isolate);
+ return v8::Null(isolate);
case TestEnumOrDouble::SpecificTypeTestEnum:
- return v8String(isolate, impl.getAsTestEnum());
+ return v8String(isolate, impl.getAsTestEnum());
case TestEnumOrDouble::SpecificTypeDouble:
- return v8::Number::New(isolate, impl.getAsDouble());
+ return v8::Number::New(isolate, impl.getAsDouble());
default:
- ASSERT_NOT_REACHED();
- }
- return v8::Local<v8::Value>();
+ NOTREACHED();
+ }
+ return v8::Local<v8::Value>();
}
-TestEnumOrDouble NativeValueTraits<TestEnumOrDouble>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState)
-{
- TestEnumOrDouble impl;
- V8TestEnumOrDouble::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNullable, exceptionState);
- return impl;
+TestEnumOrDouble NativeValueTraits<TestEnumOrDouble>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState) {
+ TestEnumOrDouble impl;
+ V8TestEnumOrDouble::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNullable, exceptionState);
+ return impl;
}
-} // namespace blink
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698