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

Unified Diff: third_party/WebKit/Source/bindings/tests/results/core/TestInterfaceOrLong.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/TestInterfaceOrLong.cpp
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/TestInterfaceOrLong.cpp b/third_party/WebKit/Source/bindings/tests/results/core/TestInterfaceOrLong.cpp
index ad84da7c30fa2c6d68a2a2e25d88ec73ec600895..e0dcec736d4ba633bf0f0f17094aa85e63a7a576 100644
--- a/third_party/WebKit/Source/bindings/tests/results/core/TestInterfaceOrLong.cpp
+++ b/third_party/WebKit/Source/bindings/tests/results/core/TestInterfaceOrLong.cpp
@@ -17,111 +17,98 @@
namespace blink {
-TestInterfaceOrLong::TestInterfaceOrLong()
- : m_type(SpecificTypeNone)
-{
-}
+TestInterfaceOrLong::TestInterfaceOrLong() : m_type(SpecificTypeNone) {}
-TestInterfaceImplementation* TestInterfaceOrLong::getAsTestInterface() const
-{
- ASSERT(isTestInterface());
- return m_testInterface;
+TestInterfaceImplementation* TestInterfaceOrLong::getAsTestInterface() const {
+ DCHECK(isTestInterface());
+ return m_testInterface;
}
-void TestInterfaceOrLong::setTestInterface(TestInterfaceImplementation* value)
-{
- ASSERT(isNull());
- m_testInterface = value;
- m_type = SpecificTypeTestInterface;
+void TestInterfaceOrLong::setTestInterface(TestInterfaceImplementation* value) {
+ DCHECK(isNull());
+ m_testInterface = value;
+ m_type = SpecificTypeTestInterface;
}
-TestInterfaceOrLong TestInterfaceOrLong::fromTestInterface(TestInterfaceImplementation* value)
-{
- TestInterfaceOrLong container;
- container.setTestInterface(value);
- return container;
+TestInterfaceOrLong TestInterfaceOrLong::fromTestInterface(TestInterfaceImplementation* value) {
+ TestInterfaceOrLong container;
+ container.setTestInterface(value);
+ return container;
}
-int TestInterfaceOrLong::getAsLong() const
-{
- ASSERT(isLong());
- return m_long;
+int TestInterfaceOrLong::getAsLong() const {
+ DCHECK(isLong());
+ return m_long;
}
-void TestInterfaceOrLong::setLong(int value)
-{
- ASSERT(isNull());
- m_long = value;
- m_type = SpecificTypeLong;
+void TestInterfaceOrLong::setLong(int value) {
+ DCHECK(isNull());
+ m_long = value;
+ m_type = SpecificTypeLong;
}
-TestInterfaceOrLong TestInterfaceOrLong::fromLong(int value)
-{
- TestInterfaceOrLong container;
- container.setLong(value);
- return container;
+TestInterfaceOrLong TestInterfaceOrLong::fromLong(int value) {
+ TestInterfaceOrLong container;
+ container.setLong(value);
+ return container;
}
TestInterfaceOrLong::TestInterfaceOrLong(const TestInterfaceOrLong&) = default;
TestInterfaceOrLong::~TestInterfaceOrLong() = default;
TestInterfaceOrLong& TestInterfaceOrLong::operator=(const TestInterfaceOrLong&) = default;
-DEFINE_TRACE(TestInterfaceOrLong)
-{
- visitor->trace(m_testInterface);
+DEFINE_TRACE(TestInterfaceOrLong) {
+ visitor->trace(m_testInterface);
}
-void V8TestInterfaceOrLong::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, TestInterfaceOrLong& impl, UnionTypeConversionMode conversionMode, ExceptionState& exceptionState)
-{
- if (v8Value.IsEmpty())
- return;
-
- if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull(v8Value))
- return;
-
- if (V8TestInterface::hasInstance(v8Value, isolate)) {
- TestInterfaceImplementation* cppValue = V8TestInterface::toImpl(v8::Local<v8::Object>::Cast(v8Value));
- impl.setTestInterface(cppValue);
- return;
- }
-
- if (v8Value->IsNumber()) {
- int cppValue = toInt32(isolate, v8Value, NormalConversion, exceptionState);
- if (exceptionState.hadException())
- return;
- impl.setLong(cppValue);
- return;
- }
-
- {
- int cppValue = toInt32(isolate, v8Value, NormalConversion, exceptionState);
- if (exceptionState.hadException())
- return;
- impl.setLong(cppValue);
- return;
- }
+void V8TestInterfaceOrLong::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, TestInterfaceOrLong& impl, UnionTypeConversionMode conversionMode, ExceptionState& exceptionState) {
+ if (v8Value.IsEmpty())
+ return;
+
+ if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull(v8Value))
+ return;
+
+ if (V8TestInterface::hasInstance(v8Value, isolate)) {
+ TestInterfaceImplementation* cppValue = V8TestInterface::toImpl(v8::Local<v8::Object>::Cast(v8Value));
+ impl.setTestInterface(cppValue);
+ return;
+ }
+
+ if (v8Value->IsNumber()) {
+ int cppValue = toInt32(isolate, v8Value, NormalConversion, exceptionState);
+ if (exceptionState.hadException())
+ return;
+ impl.setLong(cppValue);
+ return;
+ }
+
+ {
+ int cppValue = toInt32(isolate, v8Value, NormalConversion, exceptionState);
+ if (exceptionState.hadException())
+ return;
+ impl.setLong(cppValue);
+ return;
+ }
}
-v8::Local<v8::Value> toV8(const TestInterfaceOrLong& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
-{
- switch (impl.m_type) {
+v8::Local<v8::Value> toV8(const TestInterfaceOrLong& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) {
+ switch (impl.m_type) {
case TestInterfaceOrLong::SpecificTypeNone:
- return v8::Null(isolate);
+ return v8::Null(isolate);
case TestInterfaceOrLong::SpecificTypeTestInterface:
- return toV8(impl.getAsTestInterface(), creationContext, isolate);
+ return toV8(impl.getAsTestInterface(), creationContext, isolate);
case TestInterfaceOrLong::SpecificTypeLong:
- return v8::Integer::New(isolate, impl.getAsLong());
+ return v8::Integer::New(isolate, impl.getAsLong());
default:
- ASSERT_NOT_REACHED();
- }
- return v8::Local<v8::Value>();
+ NOTREACHED();
+ }
+ return v8::Local<v8::Value>();
}
-TestInterfaceOrLong NativeValueTraits<TestInterfaceOrLong>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState)
-{
- TestInterfaceOrLong impl;
- V8TestInterfaceOrLong::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNullable, exceptionState);
- return impl;
+TestInterfaceOrLong NativeValueTraits<TestInterfaceOrLong>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState) {
+ TestInterfaceOrLong impl;
+ V8TestInterfaceOrLong::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNullable, exceptionState);
+ return impl;
}
-} // namespace blink
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698