Title: [190398] trunk/Source/WebCore
Revision
190398
Author
[email protected]
Date
2015-10-01 01:12:40 -0700 (Thu, 01 Oct 2015)

Log Message

Binding generator should make mutable CachedAttribute member fields
https://bugs.webkit.org/show_bug.cgi?id=148056

Reviewed by Chris Dumez.

Making mutable CachedAttribute member fields.
Removing const_cast from custom binding code.
Rebased bindings tests.

No change in behavior.

* bindings/js/JSHistoryCustom.cpp:
(WebCore::JSHistory::state):
* bindings/js/JSMessageEventCustom.cpp:
(WebCore::JSMessageEvent::data):
* bindings/js/JSPopStateEventCustom.cpp:
(WebCore::cacheState):
(WebCore::JSPopStateEvent::state):
* bindings/js/JSReadableStreamReaderEventCustom.cpp:
(WebCore::JSReadableStreamReader::closed):
* bindings/js/JSXMLHttpRequestCustom.cpp:
(WebCore::JSXMLHttpRequest::response):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader):
* bindings/scripts/test/JS/JSTestObj.h:
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (190397 => 190398)


--- trunk/Source/WebCore/ChangeLog	2015-10-01 08:00:14 UTC (rev 190397)
+++ trunk/Source/WebCore/ChangeLog	2015-10-01 08:12:40 UTC (rev 190398)
@@ -1,3 +1,32 @@
+2015-10-01  Youenn Fablet  <[email protected]>
+
+        Binding generator should make mutable CachedAttribute member fields
+        https://bugs.webkit.org/show_bug.cgi?id=148056
+
+        Reviewed by Chris Dumez.
+
+        Making mutable CachedAttribute member fields.
+        Removing const_cast from custom binding code.
+        Rebased bindings tests.
+
+        No change in behavior.
+
+        * bindings/js/JSHistoryCustom.cpp:
+        (WebCore::JSHistory::state):
+        * bindings/js/JSMessageEventCustom.cpp:
+        (WebCore::JSMessageEvent::data):
+        * bindings/js/JSPopStateEventCustom.cpp:
+        (WebCore::cacheState):
+        (WebCore::JSPopStateEvent::state):
+        * bindings/js/JSReadableStreamReaderEventCustom.cpp:
+        (WebCore::JSReadableStreamReader::closed):
+        * bindings/js/JSXMLHttpRequestCustom.cpp:
+        (WebCore::JSXMLHttpRequest::response):
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateHeader):
+        * bindings/scripts/test/JS/JSTestObj.h:
+        * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
+
 2015-10-01  Xabier Rodriguez Calvar  <[email protected]>
 
         [Streams API] Create ByteLengthQueuingStrategy object as per spec

Modified: trunk/Source/WebCore/bindings/js/JSHistoryCustom.cpp (190397 => 190398)


--- trunk/Source/WebCore/bindings/js/JSHistoryCustom.cpp	2015-10-01 08:00:14 UTC (rev 190397)
+++ trunk/Source/WebCore/bindings/js/JSHistoryCustom.cpp	2015-10-01 08:12:40 UTC (rev 190398)
@@ -115,7 +115,7 @@
 
     RefPtr<SerializedScriptValue> serialized = history.state();
     JSValue result = serialized ? serialized->deserialize(&state, globalObject(), 0) : jsNull();
-    const_cast<JSHistory*>(this)->m_state.set(state.vm(), this, result);
+    m_state.set(state.vm(), this, result);
     return result;
 }
 

Modified: trunk/Source/WebCore/bindings/js/JSMessageEventCustom.cpp (190397 => 190398)


--- trunk/Source/WebCore/bindings/js/JSMessageEventCustom.cpp	2015-10-01 08:00:14 UTC (rev 190397)
+++ trunk/Source/WebCore/bindings/js/JSMessageEventCustom.cpp	2015-10-01 08:12:40 UTC (rev 190398)
@@ -99,7 +99,7 @@
     }
 
     // Save the result so we don't have to deserialize the value again.
-    const_cast<JSMessageEvent*>(this)->m_data.set(state.vm(), this, result);
+    m_data.set(state.vm(), this, result);
     return result;
 }
 

Modified: trunk/Source/WebCore/bindings/js/JSPopStateEventCustom.cpp (190397 => 190398)


--- trunk/Source/WebCore/bindings/js/JSPopStateEventCustom.cpp	2015-10-01 08:00:14 UTC (rev 190397)
+++ trunk/Source/WebCore/bindings/js/JSPopStateEventCustom.cpp	2015-10-01 08:12:40 UTC (rev 190398)
@@ -40,7 +40,7 @@
 namespace WebCore {
 
 // Save the state value to the m_state member of a JSPopStateEvent, and return it, for convenience.
-static const JSValue& cacheState(ExecState& state, JSPopStateEvent* event, const JSValue& eventState)
+static const JSValue& cacheState(ExecState& state, const JSPopStateEvent* event, const JSValue& eventState)
 {
     event->m_state.set(state.vm(), event, eventState);
     return eventState;
@@ -69,12 +69,12 @@
                 eventState = jsNull();
         }
         
-        return cacheState(state, const_cast<JSPopStateEvent*>(this), eventState);
+        return cacheState(state, this, eventState);
     }
     
     History* history = event.history();
     if (!history || !event.serializedState())
-        return cacheState(state, const_cast<JSPopStateEvent*>(this), jsNull());
+        return cacheState(state, this, jsNull());
 
     // There's no cached value from a previous invocation, nor a state value was provided by the
     // event, but there is a history object, so first we need to see if the state object has been
@@ -91,7 +91,7 @@
     } else
         result = event.serializedState()->deserialize(&state, globalObject(), 0);
 
-    return cacheState(state, const_cast<JSPopStateEvent*>(this), result);
+    return cacheState(state, this, result);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/bindings/js/JSReadableStreamReaderCustom.cpp (190397 => 190398)


--- trunk/Source/WebCore/bindings/js/JSReadableStreamReaderCustom.cpp	2015-10-01 08:00:14 UTC (rev 190397)
+++ trunk/Source/WebCore/bindings/js/JSReadableStreamReaderCustom.cpp	2015-10-01 08:12:40 UTC (rev 190398)
@@ -48,7 +48,7 @@
 {
     if (!m_closed) {
         JSPromiseDeferred* closedPromise = JSPromiseDeferred::create(&state, globalObject());
-        const_cast<JSReadableStreamReader*>(this)->m_closed.set(state.vm(), this, closedPromise->promise());
+        m_closed.set(state.vm(), this, closedPromise->promise());
         impl().closed(DeferredWrapper(&state, globalObject(), closedPromise));
     }
     return m_closed.get();

Modified: trunk/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp (190397 => 190398)


--- trunk/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp	2015-10-01 08:00:14 UTC (rev 190397)
+++ trunk/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp	2015-10-01 08:12:40 UTC (rev 190398)
@@ -196,8 +196,7 @@
             JSValue value = JSONParse(&state, impl().responseTextIgnoringResponseType());
             if (!value)
                 value = jsNull();
-            JSXMLHttpRequest* jsRequest = const_cast<JSXMLHttpRequest*>(this);
-            jsRequest->m_response.set(state.vm(), jsRequest, value);
+            m_response.set(state.vm(), this, value);
 
             impl().didCacheResponseJSON();
 

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (190397 => 190398)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2015-10-01 08:00:14 UTC (rev 190397)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2015-10-01 08:12:40 UTC (rev 190398)
@@ -1114,7 +1114,7 @@
             if ($attribute->signature->extendedAttributes->{"CachedAttribute"}) {
                 my $conditionalString = $codeGenerator->GenerateConditionalString($attribute->signature);
                 push(@headerContent, "#if ${conditionalString}\n") if $conditionalString;
-                push(@headerContent, "    JSC::WriteBarrier<JSC::Unknown> m_" . $attribute->signature->name . ";\n");
+                push(@headerContent, "    mutable JSC::WriteBarrier<JSC::Unknown> m_" . $attribute->signature->name . ";\n");
                 $numCachedAttributes++;
                 $needsVisitChildren = 1;
                 push(@headerContent, "#endif\n") if $conditionalString;

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h (190397 => 190398)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h	2015-10-01 08:00:14 UTC (rev 190397)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h	2015-10-01 08:12:40 UTC (rev 190398)
@@ -52,8 +52,8 @@
     }
 
     static JSC::JSValue getConstructor(JSC::VM&, JSC::JSGlobalObject*);
-    JSC::WriteBarrier<JSC::Unknown> m_cachedAttribute1;
-    JSC::WriteBarrier<JSC::Unknown> m_cachedAttribute2;
+    mutable JSC::WriteBarrier<JSC::Unknown> m_cachedAttribute1;
+    mutable JSC::WriteBarrier<JSC::Unknown> m_cachedAttribute2;
     static void visitChildren(JSCell*, JSC::SlotVisitor&);
 
 

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h (190397 => 190398)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h	2015-10-01 08:00:14 UTC (rev 190397)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h	2015-10-01 08:12:40 UTC (rev 190398)
@@ -53,8 +53,8 @@
     }
 
     static JSC::JSValue getConstructor(JSC::VM&, JSC::JSGlobalObject*);
-    JSC::WriteBarrier<JSC::Unknown> m_cachedValue;
-    JSC::WriteBarrier<JSC::Unknown> m_cachedReadonlyValue;
+    mutable JSC::WriteBarrier<JSC::Unknown> m_cachedValue;
+    mutable JSC::WriteBarrier<JSC::Unknown> m_cachedReadonlyValue;
     static void visitChildren(JSCell*, JSC::SlotVisitor&);
 
     TestSerializedScriptValueInterface& impl() const { return *m_impl; }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to