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

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

Issue 2742213002: bindings: Make v8_union iterate through its members by type name (Closed)
Patch Set: Created 3 years, 9 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/StringOrDouble.cpp
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/StringOrDouble.cpp b/third_party/WebKit/Source/bindings/tests/results/core/StringOrDouble.cpp
index cdd8166a505f0937996b0853837228f3178bf062..383112948c4d62ebc8ee05c20bbe3649513e1c15 100644
--- a/third_party/WebKit/Source/bindings/tests/results/core/StringOrDouble.cpp
+++ b/third_party/WebKit/Source/bindings/tests/results/core/StringOrDouble.cpp
@@ -19,37 +19,37 @@ namespace blink {
StringOrDouble::StringOrDouble() : m_type(SpecificTypeNone) {}
-String StringOrDouble::getAsString() const {
- DCHECK(isString());
- return m_string;
+double StringOrDouble::getAsDouble() const {
+ DCHECK(isDouble());
+ return m_double;
}
-void StringOrDouble::setString(String value) {
+void StringOrDouble::setDouble(double value) {
DCHECK(isNull());
- m_string = value;
- m_type = SpecificTypeString;
+ m_double = value;
+ m_type = SpecificTypeDouble;
}
-StringOrDouble StringOrDouble::fromString(String value) {
+StringOrDouble StringOrDouble::fromDouble(double value) {
StringOrDouble container;
- container.setString(value);
+ container.setDouble(value);
return container;
}
-double StringOrDouble::getAsDouble() const {
- DCHECK(isDouble());
- return m_double;
+String StringOrDouble::getAsString() const {
+ DCHECK(isString());
+ return m_string;
}
-void StringOrDouble::setDouble(double value) {
+void StringOrDouble::setString(String value) {
DCHECK(isNull());
- m_double = value;
- m_type = SpecificTypeDouble;
+ m_string = value;
+ m_type = SpecificTypeString;
}
-StringOrDouble StringOrDouble::fromDouble(double value) {
+StringOrDouble StringOrDouble::fromString(String value) {
StringOrDouble container;
- container.setDouble(value);
+ container.setString(value);
return container;
}
@@ -88,10 +88,10 @@ v8::Local<v8::Value> ToV8(const StringOrDouble& impl, v8::Local<v8::Object> crea
switch (impl.m_type) {
case StringOrDouble::SpecificTypeNone:
return v8::Null(isolate);
- case StringOrDouble::SpecificTypeString:
- return v8String(isolate, impl.getAsString());
case StringOrDouble::SpecificTypeDouble:
return v8::Number::New(isolate, impl.getAsDouble());
+ case StringOrDouble::SpecificTypeString:
+ return v8String(isolate, impl.getAsString());
default:
NOTREACHED();
}

Powered by Google App Engine
This is Rietveld 408576698