| Index: third_party/WebKit/Source/bindings/tests/results/core/UnrestrictedDoubleOrString.cpp
|
| diff --git a/third_party/WebKit/Source/bindings/tests/results/core/UnrestrictedDoubleOrString.cpp b/third_party/WebKit/Source/bindings/tests/results/core/UnrestrictedDoubleOrString.cpp
|
| index 7070a0ab10bdd3d43a1ce20bef2a391e5e18ffe5..acdface124649c093a483ebf7b64e865b5e2e189 100644
|
| --- a/third_party/WebKit/Source/bindings/tests/results/core/UnrestrictedDoubleOrString.cpp
|
| +++ b/third_party/WebKit/Source/bindings/tests/results/core/UnrestrictedDoubleOrString.cpp
|
| @@ -11,104 +11,91 @@
|
|
|
| namespace blink {
|
|
|
| -UnrestrictedDoubleOrString::UnrestrictedDoubleOrString()
|
| - : m_type(SpecificTypeNone)
|
| -{
|
| -}
|
| +UnrestrictedDoubleOrString::UnrestrictedDoubleOrString() : m_type(SpecificTypeNone) {}
|
|
|
| -double UnrestrictedDoubleOrString::getAsUnrestrictedDouble() const
|
| -{
|
| - ASSERT(isUnrestrictedDouble());
|
| - return m_unrestrictedDouble;
|
| +double UnrestrictedDoubleOrString::getAsUnrestrictedDouble() const {
|
| + DCHECK(isUnrestrictedDouble());
|
| + return m_unrestrictedDouble;
|
| }
|
|
|
| -void UnrestrictedDoubleOrString::setUnrestrictedDouble(double value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_unrestrictedDouble = value;
|
| - m_type = SpecificTypeUnrestrictedDouble;
|
| +void UnrestrictedDoubleOrString::setUnrestrictedDouble(double value) {
|
| + DCHECK(isNull());
|
| + m_unrestrictedDouble = value;
|
| + m_type = SpecificTypeUnrestrictedDouble;
|
| }
|
|
|
| -UnrestrictedDoubleOrString UnrestrictedDoubleOrString::fromUnrestrictedDouble(double value)
|
| -{
|
| - UnrestrictedDoubleOrString container;
|
| - container.setUnrestrictedDouble(value);
|
| - return container;
|
| +UnrestrictedDoubleOrString UnrestrictedDoubleOrString::fromUnrestrictedDouble(double value) {
|
| + UnrestrictedDoubleOrString container;
|
| + container.setUnrestrictedDouble(value);
|
| + return container;
|
| }
|
|
|
| -String UnrestrictedDoubleOrString::getAsString() const
|
| -{
|
| - ASSERT(isString());
|
| - return m_string;
|
| +String UnrestrictedDoubleOrString::getAsString() const {
|
| + DCHECK(isString());
|
| + return m_string;
|
| }
|
|
|
| -void UnrestrictedDoubleOrString::setString(String value)
|
| -{
|
| - ASSERT(isNull());
|
| - m_string = value;
|
| - m_type = SpecificTypeString;
|
| +void UnrestrictedDoubleOrString::setString(String value) {
|
| + DCHECK(isNull());
|
| + m_string = value;
|
| + m_type = SpecificTypeString;
|
| }
|
|
|
| -UnrestrictedDoubleOrString UnrestrictedDoubleOrString::fromString(String value)
|
| -{
|
| - UnrestrictedDoubleOrString container;
|
| - container.setString(value);
|
| - return container;
|
| +UnrestrictedDoubleOrString UnrestrictedDoubleOrString::fromString(String value) {
|
| + UnrestrictedDoubleOrString container;
|
| + container.setString(value);
|
| + return container;
|
| }
|
|
|
| UnrestrictedDoubleOrString::UnrestrictedDoubleOrString(const UnrestrictedDoubleOrString&) = default;
|
| UnrestrictedDoubleOrString::~UnrestrictedDoubleOrString() = default;
|
| UnrestrictedDoubleOrString& UnrestrictedDoubleOrString::operator=(const UnrestrictedDoubleOrString&) = default;
|
|
|
| -DEFINE_TRACE(UnrestrictedDoubleOrString)
|
| -{
|
| +DEFINE_TRACE(UnrestrictedDoubleOrString) {
|
| }
|
|
|
| -void V8UnrestrictedDoubleOrString::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, UnrestrictedDoubleOrString& impl, UnionTypeConversionMode conversionMode, ExceptionState& exceptionState)
|
| -{
|
| - if (v8Value.IsEmpty())
|
| - return;
|
| -
|
| - if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull(v8Value))
|
| - return;
|
| -
|
| - if (v8Value->IsNumber()) {
|
| - double cppValue = toDouble(isolate, v8Value, exceptionState);
|
| - if (exceptionState.hadException())
|
| - return;
|
| - impl.setUnrestrictedDouble(cppValue);
|
| - return;
|
| - }
|
| -
|
| - {
|
| - V8StringResource<> cppValue = v8Value;
|
| - if (!cppValue.prepare(exceptionState))
|
| - return;
|
| - impl.setString(cppValue);
|
| - return;
|
| - }
|
| +void V8UnrestrictedDoubleOrString::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, UnrestrictedDoubleOrString& impl, UnionTypeConversionMode conversionMode, ExceptionState& exceptionState) {
|
| + if (v8Value.IsEmpty())
|
| + return;
|
| +
|
| + if (conversionMode == UnionTypeConversionMode::Nullable && isUndefinedOrNull(v8Value))
|
| + return;
|
| +
|
| + if (v8Value->IsNumber()) {
|
| + double cppValue = toDouble(isolate, v8Value, exceptionState);
|
| + if (exceptionState.hadException())
|
| + return;
|
| + impl.setUnrestrictedDouble(cppValue);
|
| + return;
|
| + }
|
| +
|
| + {
|
| + V8StringResource<> cppValue = v8Value;
|
| + if (!cppValue.prepare(exceptionState))
|
| + return;
|
| + impl.setString(cppValue);
|
| + return;
|
| + }
|
| }
|
|
|
| -v8::Local<v8::Value> toV8(const UnrestrictedDoubleOrString& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
|
| -{
|
| - switch (impl.m_type) {
|
| +v8::Local<v8::Value> toV8(const UnrestrictedDoubleOrString& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) {
|
| + switch (impl.m_type) {
|
| case UnrestrictedDoubleOrString::SpecificTypeNone:
|
| - return v8::Null(isolate);
|
| + return v8::Null(isolate);
|
| case UnrestrictedDoubleOrString::SpecificTypeUnrestrictedDouble:
|
| - return v8::Number::New(isolate, impl.getAsUnrestrictedDouble());
|
| + return v8::Number::New(isolate, impl.getAsUnrestrictedDouble());
|
| case UnrestrictedDoubleOrString::SpecificTypeString:
|
| - return v8String(isolate, impl.getAsString());
|
| + return v8String(isolate, impl.getAsString());
|
| default:
|
| - ASSERT_NOT_REACHED();
|
| - }
|
| - return v8::Local<v8::Value>();
|
| + NOTREACHED();
|
| + }
|
| + return v8::Local<v8::Value>();
|
| }
|
|
|
| -UnrestrictedDoubleOrString NativeValueTraits<UnrestrictedDoubleOrString>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState)
|
| -{
|
| - UnrestrictedDoubleOrString impl;
|
| - V8UnrestrictedDoubleOrString::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNullable, exceptionState);
|
| - return impl;
|
| +UnrestrictedDoubleOrString NativeValueTraits<UnrestrictedDoubleOrString>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState) {
|
| + UnrestrictedDoubleOrString impl;
|
| + V8UnrestrictedDoubleOrString::toImpl(isolate, value, impl, UnionTypeConversionMode::NotNullable, exceptionState);
|
| + return impl;
|
| }
|
|
|
| -} // namespace blink
|
| +} // namespace blink
|
|
|