- Revision
- 125481
- Author
- [email protected]
- Date
- 2012-08-13 17:49:48 -0700 (Mon, 13 Aug 2012)
Log Message
[V8] Remove v8ValueToWebCoreString()
https://bugs.webkit.org/show_bug.cgi?id=93822
Reviewed by Adam Barth.
There are two equivalent ways to convert a V8 value to a WebCore String;
i.e. v8ValueToWebCoreString() and toWebCoreString(). We can remove the former.
In a follow-up patch, I will replace v8ValueToAtomicWebCoreString()
with toWebCoreAtomicString(), for consistency with toWebCoreString().
No tests. No change in behavior.
* bindings/v8/Dictionary.cpp:
(WebCore::Dictionary::get):
(WebCore::Dictionary::getWithUndefinedOrNullCheck):
(WebCore::Dictionary::getOwnPropertiesAsStringHashMap):
* bindings/v8/IDBBindingUtilities.cpp:
(WebCore::createIDBKeyFromValue):
* bindings/v8/ScriptDebugServer.cpp:
(WebCore::ScriptDebugServer::setBreakpoint):
* bindings/v8/V8Binding.cpp:
(WebCore::toWebCoreString):
(WebCore::v8ValueToWebCoreDOMStringList):
* bindings/v8/V8Binding.h:
(WebCore::toWebCoreStringWithNullCheck):
* bindings/v8/custom/V8MessageEventCustom.cpp:
(WebCore::V8MessageEvent::initMessageEventCallback):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (125480 => 125481)
--- trunk/Source/WebCore/ChangeLog 2012-08-14 00:47:05 UTC (rev 125480)
+++ trunk/Source/WebCore/ChangeLog 2012-08-14 00:49:48 UTC (rev 125481)
@@ -1,5 +1,36 @@
2012-08-13 Kentaro Hara <[email protected]>
+ [V8] Remove v8ValueToWebCoreString()
+ https://bugs.webkit.org/show_bug.cgi?id=93822
+
+ Reviewed by Adam Barth.
+
+ There are two equivalent ways to convert a V8 value to a WebCore String;
+ i.e. v8ValueToWebCoreString() and toWebCoreString(). We can remove the former.
+
+ In a follow-up patch, I will replace v8ValueToAtomicWebCoreString()
+ with toWebCoreAtomicString(), for consistency with toWebCoreString().
+
+ No tests. No change in behavior.
+
+ * bindings/v8/Dictionary.cpp:
+ (WebCore::Dictionary::get):
+ (WebCore::Dictionary::getWithUndefinedOrNullCheck):
+ (WebCore::Dictionary::getOwnPropertiesAsStringHashMap):
+ * bindings/v8/IDBBindingUtilities.cpp:
+ (WebCore::createIDBKeyFromValue):
+ * bindings/v8/ScriptDebugServer.cpp:
+ (WebCore::ScriptDebugServer::setBreakpoint):
+ * bindings/v8/V8Binding.cpp:
+ (WebCore::toWebCoreString):
+ (WebCore::v8ValueToWebCoreDOMStringList):
+ * bindings/v8/V8Binding.h:
+ (WebCore::toWebCoreStringWithNullCheck):
+ * bindings/v8/custom/V8MessageEventCustom.cpp:
+ (WebCore::V8MessageEvent::initMessageEventCallback):
+
+2012-08-13 Kentaro Hara <[email protected]>
+
[V8] Move the ConstructorMode class from V8Binding.h to SafeAllocation.h
https://bugs.webkit.org/show_bug.cgi?id=93821
Modified: trunk/Source/WebCore/bindings/v8/Dictionary.cpp (125480 => 125481)
--- trunk/Source/WebCore/bindings/v8/Dictionary.cpp 2012-08-14 00:47:05 UTC (rev 125480)
+++ trunk/Source/WebCore/bindings/v8/Dictionary.cpp 2012-08-14 00:49:48 UTC (rev 125481)
@@ -160,7 +160,7 @@
// an empty string and returning true when we should be returning false.
// See fast/dom/Geolocation/script-tests/argument-types.js for a similar
// example.
- value = v8ValueToWebCoreString(v8Value);
+ value = toWebCoreString(v8Value);
return true;
}
@@ -285,7 +285,7 @@
v8::Local<v8::Array> v8Array = v8::Local<v8::Array>::Cast(v8Value);
for (size_t i = 0; i < v8Array->Length(); ++i) {
v8::Local<v8::Value> indexedValue = v8Array->Get(v8Integer(i));
- value.add(v8ValueToWebCoreString(indexedValue));
+ value.add(toWebCoreString(indexedValue));
}
return true;
@@ -301,7 +301,7 @@
// an empty string and returning true when we should be returning false.
// See fast/dom/Geolocation/script-tests/argument-types.js for a similar
// example.
- value = WebCore::isUndefinedOrNull(v8Value) ? String() : v8ValueToWebCoreString(v8Value);
+ value = WebCore::isUndefinedOrNull(v8Value) ? String() : toWebCoreString(v8Value);
return true;
}
@@ -446,7 +446,7 @@
v8::Local<v8::Array> v8Array = v8::Local<v8::Array>::Cast(v8Value);
for (size_t i = 0; i < v8Array->Length(); ++i) {
v8::Local<v8::Value> indexedValue = v8Array->Get(v8::Uint32::New(i));
- value.append(v8ValueToWebCoreString(indexedValue));
+ value.append(toWebCoreString(indexedValue));
}
return true;
@@ -485,8 +485,8 @@
continue;
v8::Local<v8::Value> value = options->Get(key);
- String stringKey = v8ValueToWebCoreString(key);
- String stringValue = v8ValueToWebCoreString(value);
+ String stringKey = toWebCoreString(key);
+ String stringValue = toWebCoreString(value);
if (!stringKey.isEmpty())
hashMap.set(stringKey, stringValue);
}
Modified: trunk/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp (125480 => 125481)
--- trunk/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp 2012-08-14 00:47:05 UTC (rev 125480)
+++ trunk/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp 2012-08-14 00:49:48 UTC (rev 125481)
@@ -47,7 +47,7 @@
if (value->IsNumber() && !isnan(value->NumberValue()))
return IDBKey::createNumber(value->NumberValue());
if (value->IsString())
- return IDBKey::createString(v8ValueToWebCoreString(value));
+ return IDBKey::createString(toWebCoreString(value));
if (value->IsDate() && !isnan(value->NumberValue()))
return IDBKey::createDate(value->NumberValue());
if (value->IsArray()) {
Modified: trunk/Source/WebCore/bindings/v8/ScriptDebugServer.cpp (125480 => 125481)
--- trunk/Source/WebCore/bindings/v8/ScriptDebugServer.cpp 2012-08-14 00:47:05 UTC (rev 125480)
+++ trunk/Source/WebCore/bindings/v8/ScriptDebugServer.cpp 2012-08-14 00:49:48 UTC (rev 125481)
@@ -89,7 +89,7 @@
return "";
*actualLineNumber = args->Get(v8::String::New("lineNumber"))->Int32Value();
*actualColumnNumber = args->Get(v8::String::New("columnNumber"))->Int32Value();
- return v8ValueToWebCoreString(breakpointId->ToString());
+ return toWebCoreString(breakpointId->ToString());
}
void ScriptDebugServer::removeBreakpoint(const String& breakpointId)
Modified: trunk/Source/WebCore/bindings/v8/V8Binding.cpp (125480 => 125481)
--- trunk/Source/WebCore/bindings/v8/V8Binding.cpp 2012-08-14 00:47:05 UTC (rev 125480)
+++ trunk/Source/WebCore/bindings/v8/V8Binding.cpp 2012-08-14 00:49:48 UTC (rev 125481)
@@ -81,7 +81,7 @@
return AtomicString(v8NonStringValueToWebCoreString(object));
}
-String v8ValueToWebCoreString(v8::Handle<v8::Value> value)
+String toWebCoreString(v8::Handle<v8::Value> value)
{
if (value->IsString())
return v8StringToWebCoreString<String>(v8::Handle<v8::String>::Cast(value), Externalize);
@@ -350,7 +350,7 @@
v8::Local<v8::Array> v8Array = v8::Local<v8::Array>::Cast(v8Value);
for (size_t i = 0; i < v8Array->Length(); ++i) {
v8::Local<v8::Value> indexedValue = v8Array->Get(v8Integer(i));
- ret->append(v8ValueToWebCoreString(indexedValue));
+ ret->append(toWebCoreString(indexedValue));
}
return ret.release();
}
Modified: trunk/Source/WebCore/bindings/v8/V8Binding.h (125480 => 125481)
--- trunk/Source/WebCore/bindings/v8/V8Binding.h 2012-08-14 00:47:05 UTC (rev 125480)
+++ trunk/Source/WebCore/bindings/v8/V8Binding.h 2012-08-14 00:49:48 UTC (rev 125481)
@@ -94,7 +94,7 @@
// Convert v8 types to a WTF::String. If the V8 string is not already
// an external string then it is transformed into an external string at this
// point to avoid repeated conversions.
- String v8ValueToWebCoreString(v8::Handle<v8::Value>);
+ String toWebCoreString(v8::Handle<v8::Value>);
// Convert a V8 value to a WTF::AtomicString.
AtomicString v8ValueToAtomicWebCoreString(v8::Handle<v8::Value>);
@@ -195,7 +195,7 @@
struct NativeValueTraits<String> {
static inline String arrayNativeValue(const v8::Local<v8::Array>& array, size_t i)
{
- return v8ValueToWebCoreString(array->Get(i));
+ return toWebCoreString(array->Get(i));
}
};
@@ -294,17 +294,6 @@
return static_cast<long long>(value->IntegerValue());
}
- // FIXME: Drop this in favor of the type specific v8ValueToWebCoreString when we rework the code generation.
- inline String toWebCoreString(v8::Handle<v8::Value> object)
- {
- return v8ValueToWebCoreString(object);
- }
-
- inline String toWebCoreString(const v8::Arguments& args, int index)
- {
- return v8ValueToWebCoreString(args[index]);
- }
-
// The string returned by this function is still owned by the argument
// and will be deallocated when the argument is deallocated.
inline const uint16_t* fromWebCoreString(const String& str)
@@ -349,7 +338,7 @@
inline String toWebCoreStringWithNullCheck(v8::Handle<v8::Value> value)
{
- return value->IsNull() ? String() : v8ValueToWebCoreString(value);
+ return value->IsNull() ? String() : toWebCoreString(value);
}
inline AtomicString toAtomicWebCoreStringWithNullCheck(v8::Handle<v8::Value> value)
Modified: trunk/Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp (125480 => 125481)
--- trunk/Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp 2012-08-14 00:47:05 UTC (rev 125480)
+++ trunk/Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp 2012-08-14 00:49:48 UTC (rev 125481)
@@ -110,12 +110,12 @@
{
INC_STATS("DOM.MessageEvent.initMessageEvent");
MessageEvent* event = V8MessageEvent::toNative(args.Holder());
- String typeArg = v8ValueToWebCoreString(args[0]);
+ String typeArg = toWebCoreString(args[0]);
bool canBubbleArg = args[1]->BooleanValue();
bool cancelableArg = args[2]->BooleanValue();
ScriptValue dataArg = ScriptValue(args[3]);
- String originArg = v8ValueToWebCoreString(args[4]);
- String lastEventIdArg = v8ValueToWebCoreString(args[5]);
+ String originArg = toWebCoreString(args[4]);
+ String lastEventIdArg = toWebCoreString(args[5]);
DOMWindow* sourceArg = 0;
if (args[6]->IsObject()) {