Title: [124566] trunk/Source/WebCore
Revision
124566
Author
[email protected]
Date
2012-08-03 00:23:45 -0700 (Fri, 03 Aug 2012)

Log Message

[V8] Make v8NonStringValueToWebCoreString a static method
https://bugs.webkit.org/show_bug.cgi?id=93066

Reviewed by Adam Barth.

v8NonStringValueToWebCoreString() and v8NonStringValueToAtomicWebCoreString()
are not intended to be used from outside V8Binding.cpp.
They should be static methods.

No tests. No change in behavior.

* bindings/v8/V8Binding.cpp:
(WebCore::v8NonStringValueToWebCoreString):
(WebCore):
(WebCore::v8NonStringValueToAtomicWebCoreString):
* bindings/v8/V8Binding.h:
(WebCore::v8StringToWebCoreString):
(WebCore::v8StringToAtomicWebCoreString):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (124565 => 124566)


--- trunk/Source/WebCore/ChangeLog	2012-08-03 06:27:38 UTC (rev 124565)
+++ trunk/Source/WebCore/ChangeLog	2012-08-03 07:23:45 UTC (rev 124566)
@@ -1,3 +1,24 @@
+2012-08-03  Kentaro Hara  <[email protected]>
+
+        [V8] Make v8NonStringValueToWebCoreString a static method
+        https://bugs.webkit.org/show_bug.cgi?id=93066
+
+        Reviewed by Adam Barth.
+
+        v8NonStringValueToWebCoreString() and v8NonStringValueToAtomicWebCoreString()
+        are not intended to be used from outside V8Binding.cpp.
+        They should be static methods.
+
+        No tests. No change in behavior.
+
+        * bindings/v8/V8Binding.cpp:
+        (WebCore::v8NonStringValueToWebCoreString):
+        (WebCore):
+        (WebCore::v8NonStringValueToAtomicWebCoreString):
+        * bindings/v8/V8Binding.h:
+        (WebCore::v8StringToWebCoreString):
+        (WebCore::v8StringToAtomicWebCoreString):
+
 2012-08-02  Abhishek Arya  <[email protected]>
 
         Crash due to layer not removed from parent for anonymous block.

Modified: trunk/Source/WebCore/bindings/v8/V8Binding.cpp (124565 => 124566)


--- trunk/Source/WebCore/bindings/v8/V8Binding.cpp	2012-08-03 06:27:38 UTC (rev 124565)
+++ trunk/Source/WebCore/bindings/v8/V8Binding.cpp	2012-08-03 07:23:45 UTC (rev 124566)
@@ -210,6 +210,35 @@
 }
 #endif
 
+static String v8NonStringValueToWebCoreString(v8::Handle<v8::Value> object)
+{
+    ASSERT(!object->IsString());
+    if (object->IsInt32())
+        return int32ToWebCoreString(object->Int32Value());
+
+    v8::TryCatch block;
+    v8::Handle<v8::String> v8String = object->ToString();
+    // Handle the case where an exception is thrown as part of invoking toString on the object.
+    if (block.HasCaught()) {
+        throwError(block.Exception());
+        return StringImpl::empty();
+    }
+    // This path is unexpected. However there is hypothesis that it
+    // might be combination of v8 and v8 bindings bugs. For now
+    // just bailout as we'll crash if attempt to convert empty handle into a string.
+    if (v8String.IsEmpty()) {
+        ASSERT_NOT_REACHED();
+        return StringImpl::empty();
+    }
+    return v8StringToWebCoreString<String>(v8String, DoNotExternalize);
+}
+
+static AtomicString v8NonStringValueToAtomicWebCoreString(v8::Handle<v8::Value> object)
+{
+    ASSERT(!object->IsString());
+    return AtomicString(v8NonStringValueToWebCoreString(object));
+}
+
 String v8ValueToWebCoreString(v8::Handle<v8::Value> value)
 {
     if (value->IsString())
@@ -417,35 +446,6 @@
     return String::number(value);
 }
 
-String v8NonStringValueToWebCoreString(v8::Handle<v8::Value> object)
-{
-    ASSERT(!object->IsString());
-    if (object->IsInt32())
-        return int32ToWebCoreString(object->Int32Value());
-
-    v8::TryCatch block;
-    v8::Handle<v8::String> v8String = object->ToString();
-    // Handle the case where an exception is thrown as part of invoking toString on the object.
-    if (block.HasCaught()) {
-        throwError(block.Exception());
-        return StringImpl::empty();
-    }
-    // This path is unexpected.  However there is hypothesis that it
-    // might be combination of v8 and v8 bindings bugs.  For now
-    // just bailout as we'll crash if attempt to convert empty handle into a string.
-    if (v8String.IsEmpty()) {
-        ASSERT_NOT_REACHED();
-        return StringImpl::empty();
-    }
-    return v8StringToWebCoreString<String>(v8String, DoNotExternalize);
-}
-
-AtomicString v8NonStringValueToAtomicWebCoreString(v8::Handle<v8::Value> object)
-{
-    ASSERT(!object->IsString());
-    return AtomicString(v8NonStringValueToWebCoreString(object));
-}
-
 static v8::Local<v8::String> makeExternalString(const String& string)
 {
     WebCoreStringResource* stringResource = new WebCoreStringResource(string);

Modified: trunk/Source/WebCore/bindings/v8/V8Binding.h (124565 => 124566)


--- trunk/Source/WebCore/bindings/v8/V8Binding.h	2012-08-03 06:27:38 UTC (rev 124565)
+++ trunk/Source/WebCore/bindings/v8/V8Binding.h	2012-08-03 07:23:45 UTC (rev 124566)
@@ -308,7 +308,6 @@
     {
         return v8StringToWebCoreString<String>(v8String, Externalize);
     }
-    String v8NonStringValueToWebCoreString(v8::Handle<v8::Value>);
     String v8ValueToWebCoreString(v8::Handle<v8::Value> value);
 
     // Convert v8 types to a WTF::AtomicString.
@@ -316,7 +315,6 @@
     {
         return v8StringToWebCoreString<AtomicString>(v8String, Externalize);
     }
-    AtomicString v8NonStringValueToAtomicWebCoreString(v8::Handle<v8::Value>);
     AtomicString v8ValueToAtomicWebCoreString(v8::Handle<v8::Value> value);
 
     // Return a V8 external string that shares the underlying buffer with the given
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to