Title: [143503] trunk/Source/WebCore
Revision
143503
Author
[email protected]
Date
2013-02-20 13:56:27 -0800 (Wed, 20 Feb 2013)

Log Message

Unreviewed, rolling out r143441.
http://trac.webkit.org/changeset/143441
https://bugs.webkit.org/show_bug.cgi?id=110376

May be causing chromium content_browsertests failures.
(Requested by vollick on #webkit).

Patch by Sheriff Bot <[email protected]> on 2013-02-20

* bindings/v8/ScriptValue.cpp:
(WebCore::ScriptValue::serialize):
(WebCore::ScriptValue::getString):
(WebCore::ScriptValue::toString):
(WebCore::ScriptValue::toInspectorValue):
* bindings/v8/ScriptValue.h:
(WebCore::ScriptValue::ScriptValue):
(WebCore::ScriptValue::operator=):
(WebCore::ScriptValue::operator==):
(WebCore::ScriptValue::isEqual):
(WebCore::ScriptValue::isFunction):
(WebCore::ScriptValue::isNull):
(WebCore::ScriptValue::isUndefined):
(WebCore::ScriptValue::isObject):
(WebCore::ScriptValue::hasNoValue):
(WebCore::ScriptValue::clear):
(WebCore::ScriptValue::v8Value):
(ScriptValue):
* bindings/v8/SharedPersistent.h:
(WebCore):
* bindings/v8/custom/V8InjectedScriptHostCustom.cpp:
(WebCore::InjectedScriptHost::scriptValueAsNode):
* bindings/v8/custom/V8MessageEventCustom.cpp:
(WebCore::V8MessageEvent::dataAttrGetterCustom):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (143502 => 143503)


--- trunk/Source/WebCore/ChangeLog	2013-02-20 21:53:27 UTC (rev 143502)
+++ trunk/Source/WebCore/ChangeLog	2013-02-20 21:56:27 UTC (rev 143503)
@@ -1,3 +1,37 @@
+2013-02-20  Sheriff Bot  <[email protected]>
+
+        Unreviewed, rolling out r143441.
+        http://trac.webkit.org/changeset/143441
+        https://bugs.webkit.org/show_bug.cgi?id=110376
+
+        May be causing chromium content_browsertests failures.
+        (Requested by vollick on #webkit).
+
+        * bindings/v8/ScriptValue.cpp:
+        (WebCore::ScriptValue::serialize):
+        (WebCore::ScriptValue::getString):
+        (WebCore::ScriptValue::toString):
+        (WebCore::ScriptValue::toInspectorValue):
+        * bindings/v8/ScriptValue.h:
+        (WebCore::ScriptValue::ScriptValue):
+        (WebCore::ScriptValue::operator=):
+        (WebCore::ScriptValue::operator==):
+        (WebCore::ScriptValue::isEqual):
+        (WebCore::ScriptValue::isFunction):
+        (WebCore::ScriptValue::isNull):
+        (WebCore::ScriptValue::isUndefined):
+        (WebCore::ScriptValue::isObject):
+        (WebCore::ScriptValue::hasNoValue):
+        (WebCore::ScriptValue::clear):
+        (WebCore::ScriptValue::v8Value):
+        (ScriptValue):
+        * bindings/v8/SharedPersistent.h:
+        (WebCore):
+        * bindings/v8/custom/V8InjectedScriptHostCustom.cpp:
+        (WebCore::InjectedScriptHost::scriptValueAsNode):
+        * bindings/v8/custom/V8MessageEventCustom.cpp:
+        (WebCore::V8MessageEvent::dataAttrGetterCustom):
+
 2013-02-15  Dirk Schulze  <[email protected]>
 
         [Chromium] Add runtime flag for CanvasPath

Modified: trunk/Source/WebCore/bindings/v8/ScriptValue.cpp (143502 => 143503)


--- trunk/Source/WebCore/bindings/v8/ScriptValue.cpp	2013-02-20 21:53:27 UTC (rev 143502)
+++ trunk/Source/WebCore/bindings/v8/ScriptValue.cpp	2013-02-20 21:56:27 UTC (rev 143503)
@@ -47,13 +47,13 @@
 PassRefPtr<SerializedScriptValue> ScriptValue::serialize(ScriptState* scriptState)
 {
     ScriptScope scope(scriptState);
-    return SerializedScriptValue::create(v8ValueRaw());
+    return SerializedScriptValue::create(v8Value());
 }
 
 PassRefPtr<SerializedScriptValue> ScriptValue::serialize(ScriptState* scriptState, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, bool& didThrow)
 {
     ScriptScope scope(scriptState);
-    return SerializedScriptValue::create(v8ValueRaw(), messagePorts, arrayBuffers, didThrow);
+    return SerializedScriptValue::create(v8Value(), messagePorts, arrayBuffers, didThrow);
 }
 
 ScriptValue ScriptValue::deserialize(ScriptState* scriptState, SerializedScriptValue* value)
@@ -64,20 +64,20 @@
 
 bool ScriptValue::getString(String& result) const
 {
-    if (hasNoValue())
+    if (m_value.isEmpty())
         return false;
 
-    if (!v8ValueRaw()->IsString())
+    if (!m_value->IsString())
         return false;
 
-    result = toWebCoreString(v8ValueRaw());
+    result = toWebCoreString(m_value.get());
     return true;
 }
 
 String ScriptValue::toString(ScriptState*) const
 {
     v8::TryCatch block;
-    v8::Handle<v8::String> string = v8ValueRaw()->ToString();
+    v8::Handle<v8::String> string = m_value->ToString();
     if (block.HasCaught())
         return String();
     return v8StringToWebCoreString<String>(string, DoNotExternalize);
@@ -142,7 +142,7 @@
     v8::HandleScope handleScope;
     // v8::Object::GetPropertyNames() expects current context to be not null.
     v8::Context::Scope contextScope(scriptState->context());
-    return v8ToInspectorValue(v8ValueRaw(), InspectorValue::maxDepth);
+    return v8ToInspectorValue(m_value.get(), InspectorValue::maxDepth);
 }
 #endif
 

Modified: trunk/Source/WebCore/bindings/v8/ScriptValue.h (143502 => 143503)


--- trunk/Source/WebCore/bindings/v8/ScriptValue.h	2013-02-20 21:53:27 UTC (rev 143502)
+++ trunk/Source/WebCore/bindings/v8/ScriptValue.h	2013-02-20 21:56:27 UTC (rev 143503)
@@ -31,8 +31,8 @@
 #ifndef ScriptValue_h
 #define ScriptValue_h
 
+#include "ScopedPersistent.h"
 #include "ScriptState.h"
-#include "SharedPersistent.h"
 #include <v8.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
@@ -60,37 +60,47 @@
     ScriptValue() { }
     virtual ~ScriptValue();
 
-    ScriptValue(v8::Handle<v8::Value> value)
-        : m_value(value.IsEmpty() ? 0 : SharedPersistent<v8::Value>::create(value))
+    ScriptValue(v8::Handle<v8::Value> value) 
     {
+        if (value.IsEmpty())
+            return;
+        m_value.set(value);
     }
 
-    ScriptValue(const ScriptValue& value)
-        : m_value(value.m_value)
+    ScriptValue(const ScriptValue& value) 
     {
+        if (value.hasNoValue())
+            return;
+        m_value.set(value.m_value.get());
     }
 
     ScriptValue& operator=(const ScriptValue& value) 
     {
-        if (this != &value)
-            m_value = value.m_value;
+        if (this == &value) 
+            return *this;
+
+        m_value.clear();
+
+        if (value.hasNoValue())
+            return *this;
+
+        m_value.set(value.m_value.get());
         return *this;
     }
 
     bool operator==(const ScriptValue& value) const
     {
-        return v8ValueRaw() == value.v8ValueRaw();
+        return m_value.get() == value.m_value.get();
     }
 
     bool isEqual(ScriptState*, const ScriptValue& value) const
     {
-        return operator==(value);
+        return m_value.get() == value.m_value.get();
     }
 
     bool isFunction() const
     {
-        ASSERT(!hasNoValue());
-        return v8ValueRaw()->IsFunction();
+        return m_value->IsFunction();
     }
 
     bool operator!=(const ScriptValue& value) const
@@ -100,25 +110,22 @@
 
     bool isNull() const
     {
-        ASSERT(!hasNoValue());
-        return v8ValueRaw()->IsNull();
+        return m_value->IsNull();
     }
 
     bool isUndefined() const
     {
-        ASSERT(!hasNoValue());
-        return v8ValueRaw()->IsUndefined();
+        return m_value->IsUndefined();
     }
 
     bool isObject() const
     {
-        ASSERT(!hasNoValue());
-        return v8ValueRaw()->IsObject();
+        return m_value->IsObject();
     }
 
     bool hasNoValue() const
     {
-        return !m_value.get() || m_value->get().IsEmpty();
+        return m_value.isEmpty();
     }
 
     PassRefPtr<SerializedScriptValue> serialize(ScriptState*);
@@ -127,20 +134,11 @@
 
     void clear()
     {
-        m_value = 0;
+        m_value.clear();
     }
 
-    v8::Handle<v8::Value> v8Value() const
-    {
-        return v8::Local<v8::Value>::New(v8ValueRaw());
-    }
+    v8::Handle<v8::Value> v8Value() const { return m_value.get(); }
 
-    // FIXME: This function should be private. 
-    v8::Handle<v8::Value> v8ValueRaw() const
-    {
-        return m_value.get() ? m_value->get() : v8::Handle<v8::Value>();
-    }
-
     bool getString(ScriptState*, String& result) const { return getString(result); }
     bool getString(String& result) const;
     String toString(ScriptState*) const;
@@ -148,7 +146,7 @@
     PassRefPtr<InspectorValue> toInspectorValue(ScriptState*) const;
 
 private:
-    RefPtr<SharedPersistent<v8::Value> > m_value;
+    ScopedPersistent<v8::Value> m_value;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/bindings/v8/SharedPersistent.h (143502 => 143503)


--- trunk/Source/WebCore/bindings/v8/SharedPersistent.h	2013-02-20 21:53:27 UTC (rev 143502)
+++ trunk/Source/WebCore/bindings/v8/SharedPersistent.h	2013-02-20 21:56:27 UTC (rev 143503)
@@ -38,6 +38,7 @@
 
 namespace WebCore {
 
+    // FIXME: Remove this class.
     template <typename T>
     class SharedPersistent : public RefCounted<SharedPersistent<T> > {
     public:

Modified: trunk/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp (143502 => 143503)


--- trunk/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp	2013-02-20 21:53:27 UTC (rev 143502)
+++ trunk/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp	2013-02-20 21:56:27 UTC (rev 143503)
@@ -65,7 +65,7 @@
 {
     if (!value.isObject() || value.isNull())
         return 0;
-    return V8Node::toNative(v8::Handle<v8::Object>::Cast(value.v8ValueRaw()));
+    return V8Node::toNative(v8::Handle<v8::Object>::Cast(value.v8Value()));
 }
 
 ScriptValue InjectedScriptHost::nodeAsScriptValue(ScriptState* state, Node* node)

Modified: trunk/Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp (143502 => 143503)


--- trunk/Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp	2013-02-20 21:53:27 UTC (rev 143502)
+++ trunk/Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp	2013-02-20 21:56:27 UTC (rev 143503)
@@ -53,7 +53,7 @@
         if (scriptValue.hasNoValue())
             result = v8Null(info.GetIsolate());
         else
-            result = scriptValue.v8Value();
+            result = v8::Local<v8::Value>::New(scriptValue.v8Value());
         break;
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to