<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[195235] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/195235">195235</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-01-18 12:26:42 -0800 (Mon, 18 Jan 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Sink the Vector&lt;uint8_t&gt; buffer into the SerializedScriptValue constructor
https://bugs.webkit.org/show_bug.cgi?id=142634

Patch by Zan Dobersek &lt;zdobersek@igalia.com&gt; on 2016-01-18
Reviewed by Darin Adler.

Source/WebCore:

Have the SerializedScriptValue constructor take in the Vector&lt;uint8_t&gt; buffer
through an rvalue reference, avoiding the copying into the m_data member. The
three-parameter constructor now takes in the Vector&lt;String&gt; blob URL object
via const reference, and the std::unique_ptr&lt;&gt; object via a rvalue reference.

Adjust all the call sites and affected code to now either move or copy a
non-movable object into the SerializedScriptValue constructor or the helper
methods.

No new tests -- no change in behavior.

* bindings/js/IDBBindingUtilities.cpp:
(WebCore::deserializeIDBValueDataToJSValue):
(WebCore::deserializeIDBValueBuffer):
(WebCore::idbValueDataToJSValue):
* bindings/js/IDBBindingUtilities.h:
* bindings/js/SerializedScriptValue.cpp:
(WebCore::SerializedScriptValue::SerializedScriptValue):
(WebCore::SerializedScriptValue::create):
(WebCore::SerializedScriptValue::numberValue):
(WebCore::SerializedScriptValue::undefinedValue):
(WebCore::SerializedScriptValue::nullValue):
* bindings/js/SerializedScriptValue.h:
* testing/Internals.cpp:
(WebCore::Internals::deserializeBuffer):

Source/WebKit2:

Update API::SerializedScriptValue::adopt() to take in a Vector&lt;uint8_t&gt;
rvalue, moving it into the WebCore::SerializedScriptValue::adopt() call.

Update other places that are affected by the SerializedScriptValue changes.

* DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp:
(WebKit::UniqueIDBDatabaseBackingStoreSQLite::createIndex):
* Shared/API/APISerializedScriptValue.h:
(API::SerializedScriptValue::adopt):
* Shared/UserData.cpp:
(WebKit::UserData::decode):
* UIProcess/UserContent/WebUserContentControllerProxy.cpp:
(WebKit::WebUserContentControllerProxy::didPostMessage):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::scriptValueCallback):
* WebProcess/WebCoreSupport/SessionStateConversion.cpp:
(WebKit::applyFrameState):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsIDBBindingUtilitiescpp">trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsIDBBindingUtilitiesh">trunk/Source/WebCore/bindings/js/IDBBindingUtilities.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsSerializedScriptValuecpp">trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsSerializedScriptValueh">trunk/Source/WebCore/bindings/js/SerializedScriptValue.h</a></li>
<li><a href="#trunkSourceWebCoretestingInternalscpp">trunk/Source/WebCore/testing/Internals.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2DatabaseProcessIndexedDBsqliteUniqueIDBDatabaseBackingStoreSQLitecpp">trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedAPIAPISerializedScriptValueh">trunk/Source/WebKit2/Shared/API/APISerializedScriptValue.h</a></li>
<li><a href="#trunkSourceWebKit2SharedUserDatacpp">trunk/Source/WebKit2/Shared/UserData.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessUserContentWebUserContentControllerProxycpp">trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportSessionStateConversioncpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/SessionStateConversion.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (195234 => 195235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-01-18 19:22:07 UTC (rev 195234)
+++ trunk/Source/WebCore/ChangeLog        2016-01-18 20:26:42 UTC (rev 195235)
</span><span class="lines">@@ -1,3 +1,36 @@
</span><ins>+2016-01-18  Zan Dobersek  &lt;zdobersek@igalia.com&gt;
+
+        Sink the Vector&lt;uint8_t&gt; buffer into the SerializedScriptValue constructor
+        https://bugs.webkit.org/show_bug.cgi?id=142634
+
+        Reviewed by Darin Adler.
+
+        Have the SerializedScriptValue constructor take in the Vector&lt;uint8_t&gt; buffer
+        through an rvalue reference, avoiding the copying into the m_data member. The
+        three-parameter constructor now takes in the Vector&lt;String&gt; blob URL object
+        via const reference, and the std::unique_ptr&lt;&gt; object via a rvalue reference.
+
+        Adjust all the call sites and affected code to now either move or copy a
+        non-movable object into the SerializedScriptValue constructor or the helper
+        methods.
+
+        No new tests -- no change in behavior.
+
+        * bindings/js/IDBBindingUtilities.cpp:
+        (WebCore::deserializeIDBValueDataToJSValue):
+        (WebCore::deserializeIDBValueBuffer):
+        (WebCore::idbValueDataToJSValue):
+        * bindings/js/IDBBindingUtilities.h:
+        * bindings/js/SerializedScriptValue.cpp:
+        (WebCore::SerializedScriptValue::SerializedScriptValue):
+        (WebCore::SerializedScriptValue::create):
+        (WebCore::SerializedScriptValue::numberValue):
+        (WebCore::SerializedScriptValue::undefinedValue):
+        (WebCore::SerializedScriptValue::nullValue):
+        * bindings/js/SerializedScriptValue.h:
+        * testing/Internals.cpp:
+        (WebCore::Internals::deserializeBuffer):
+
</ins><span class="cx"> 2016-01-18  Olivier Blin  &lt;olivier.blin@softathome.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GStreamer] Remove unused m_endTime
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsIDBBindingUtilitiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp (195234 => 195235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp        2016-01-18 19:22:07 UTC (rev 195234)
+++ trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp        2016-01-18 20:26:42 UTC (rev 195235)
</span><span class="lines">@@ -448,7 +448,7 @@
</span><span class="cx">     const Vector&lt;uint8_t&gt;&amp; data = *valueData.data();
</span><span class="cx">     JSValue result;
</span><span class="cx">     if (data.size()) {
</span><del>-        RefPtr&lt;SerializedScriptValue&gt; serializedValue = SerializedScriptValue::createFromWireBytes(data);
</del><ins>+        RefPtr&lt;SerializedScriptValue&gt; serializedValue = SerializedScriptValue::createFromWireBytes(Vector&lt;uint8_t&gt;(data));
</ins><span class="cx"> 
</span><span class="cx">         exec.vm().apiLock().lock();
</span><span class="cx">         result = serializedValue-&gt;deserialize(&amp;exec, exec.lexicalGlobalObject(), 0, NonThrowing);
</span><span class="lines">@@ -464,22 +464,22 @@
</span><span class="cx">     if (prpBuffer) {
</span><span class="cx">         Vector&lt;uint8_t&gt; value;
</span><span class="cx">         value.append(prpBuffer-&gt;data(), prpBuffer-&gt;size());
</span><del>-        return deserializeIDBValueBuffer(requestState-&gt;exec(), value, keyIsDefined);
</del><ins>+        return deserializeIDBValueBuffer(requestState-&gt;exec(), WTFMove(value), keyIsDefined);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return Deprecated::ScriptValue(requestState-&gt;exec()-&gt;vm(), jsNull());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static JSValue idbValueDataToJSValue(JSC::ExecState&amp; exec, const Vector&lt;uint8_t&gt;&amp; buffer)
</del><ins>+static JSValue idbValueDataToJSValue(JSC::ExecState&amp; exec, Vector&lt;uint8_t&gt;&amp;&amp; buffer)
</ins><span class="cx"> {
</span><span class="cx">     if (buffer.isEmpty())
</span><span class="cx">         return jsNull();
</span><span class="cx"> 
</span><del>-    RefPtr&lt;SerializedScriptValue&gt; serializedValue = SerializedScriptValue::createFromWireBytes(buffer);
</del><ins>+    RefPtr&lt;SerializedScriptValue&gt; serializedValue = SerializedScriptValue::createFromWireBytes(WTFMove(buffer));
</ins><span class="cx">     return serializedValue-&gt;deserialize(&amp;exec, exec.lexicalGlobalObject(), 0, NonThrowing);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Deprecated::ScriptValue deserializeIDBValueBuffer(JSC::ExecState* exec, const Vector&lt;uint8_t&gt;&amp; buffer, bool keyIsDefined)
</del><ins>+Deprecated::ScriptValue deserializeIDBValueBuffer(JSC::ExecState* exec, Vector&lt;uint8_t&gt;&amp;&amp; buffer, bool keyIsDefined)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(exec);
</span><span class="cx"> 
</span><span class="lines">@@ -490,7 +490,7 @@
</span><span class="cx">         return Deprecated::ScriptValue(exec-&gt;vm(), jsUndefined());
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    JSValue result = idbValueDataToJSValue(*exec, buffer);
</del><ins>+    JSValue result = idbValueDataToJSValue(*exec, WTFMove(buffer));
</ins><span class="cx">     return Deprecated::ScriptValue(exec-&gt;vm(), result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -499,7 +499,7 @@
</span><span class="cx">     if (!valueData.data())
</span><span class="cx">         return jsUndefined();
</span><span class="cx"> 
</span><del>-    return idbValueDataToJSValue(exec, *valueData.data());
</del><ins>+    return idbValueDataToJSValue(exec, Vector&lt;uint8_t&gt;(*valueData.data()));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Deprecated::ScriptValue idbKeyToScriptValue(DOMRequestState* requestState, PassRefPtr&lt;IDBKey&gt; key)
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsIDBBindingUtilitiesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/IDBBindingUtilities.h (195234 => 195235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/IDBBindingUtilities.h        2016-01-18 19:22:07 UTC (rev 195234)
+++ trunk/Source/WebCore/bindings/js/IDBBindingUtilities.h        2016-01-18 20:26:42 UTC (rev 195235)
</span><span class="lines">@@ -60,7 +60,7 @@
</span><span class="cx"> Deprecated::ScriptValue deserializeIDBValue(DOMRequestState*, PassRefPtr&lt;SerializedScriptValue&gt;);
</span><span class="cx"> Deprecated::ScriptValue deserializeIDBValueData(ScriptExecutionContext&amp;, const ThreadSafeDataBuffer&amp; valueData);
</span><span class="cx"> Deprecated::ScriptValue deserializeIDBValueBuffer(DOMRequestState*, PassRefPtr&lt;SharedBuffer&gt;, bool keyIsDefined);
</span><del>-WEBCORE_EXPORT Deprecated::ScriptValue deserializeIDBValueBuffer(JSC::ExecState*, const Vector&lt;uint8_t&gt;&amp;, bool keyIsDefined);
</del><ins>+WEBCORE_EXPORT Deprecated::ScriptValue deserializeIDBValueBuffer(JSC::ExecState*, Vector&lt;uint8_t&gt;&amp;&amp;, bool keyIsDefined);
</ins><span class="cx"> 
</span><span class="cx"> JSC::JSValue deserializeIDBValueDataToJSValue(JSC::ExecState&amp;, const ThreadSafeDataBuffer&amp; valueData);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsSerializedScriptValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp (195234 => 195235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp        2016-01-18 19:22:07 UTC (rev 195234)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp        2016-01-18 20:26:42 UTC (rev 195235)
</span><span class="lines">@@ -2595,27 +2595,22 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-SerializedScriptValue::SerializedScriptValue(const Vector&lt;uint8_t&gt;&amp; buffer)
-    : m_data(buffer)
</del><ins>+SerializedScriptValue::SerializedScriptValue(Vector&lt;uint8_t&gt;&amp;&amp; buffer)
+    : m_data(WTFMove(buffer))
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-SerializedScriptValue::SerializedScriptValue(Vector&lt;uint8_t&gt;&amp; buffer)
</del><ins>+SerializedScriptValue::SerializedScriptValue(Vector&lt;uint8_t&gt;&amp;&amp; buffer, const Vector&lt;String&gt;&amp; blobURLs)
+    : m_data(WTFMove(buffer))
</ins><span class="cx"> {
</span><del>-    m_data.swap(buffer);
-}
-
-SerializedScriptValue::SerializedScriptValue(Vector&lt;uint8_t&gt;&amp; buffer, Vector&lt;String&gt;&amp; blobURLs)
-{
-    m_data.swap(buffer);
</del><span class="cx">     for (auto&amp; string : blobURLs)
</span><span class="cx">         addBlobURL(string);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-SerializedScriptValue::SerializedScriptValue(Vector&lt;uint8_t&gt;&amp; buffer, Vector&lt;String&gt;&amp; blobURLs, std::unique_ptr&lt;ArrayBufferContentsArray&gt; arrayBufferContentsArray)
-    : m_arrayBufferContentsArray(WTFMove(arrayBufferContentsArray))
</del><ins>+SerializedScriptValue::SerializedScriptValue(Vector&lt;uint8_t&gt;&amp;&amp; buffer, const Vector&lt;String&gt;&amp; blobURLs, std::unique_ptr&lt;ArrayBufferContentsArray&gt;&amp;&amp; arrayBufferContentsArray)
+    : m_data(WTFMove(buffer))
+    , m_arrayBufferContentsArray(WTFMove(arrayBufferContentsArray))
</ins><span class="cx"> {
</span><del>-    m_data.swap(buffer);
</del><span class="cx">     for (auto&amp; string : blobURLs)
</span><span class="cx">         addBlobURL(string);
</span><span class="cx"> }
</span><span class="lines">@@ -2666,7 +2661,7 @@
</span><span class="cx">     if (!serializationDidCompleteSuccessfully(code))
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><del>-    return adoptRef(*new SerializedScriptValue(buffer, blobURLs, WTFMove(arrayBufferContentsArray)));
</del><ins>+    return adoptRef(*new SerializedScriptValue(WTFMove(buffer), blobURLs, WTFMove(arrayBufferContentsArray)));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RefPtr&lt;SerializedScriptValue&gt; SerializedScriptValue::create(const String&amp; string)
</span><span class="lines">@@ -2674,7 +2669,7 @@
</span><span class="cx">     Vector&lt;uint8_t&gt; buffer;
</span><span class="cx">     if (!CloneSerializer::serialize(string, buffer))
</span><span class="cx">         return nullptr;
</span><del>-    return adoptRef(*new SerializedScriptValue(buffer));
</del><ins>+    return adoptRef(*new SerializedScriptValue(WTFMove(buffer)));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="lines">@@ -2682,14 +2677,14 @@
</span><span class="cx"> {
</span><span class="cx">     Vector&lt;uint8_t&gt; buffer;
</span><span class="cx">     CloneSerializer::serializeNumber(value, buffer);
</span><del>-    return adoptRef(*new SerializedScriptValue(buffer));
</del><ins>+    return adoptRef(*new SerializedScriptValue(WTFMove(buffer)));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Ref&lt;SerializedScriptValue&gt; SerializedScriptValue::undefinedValue()
</span><span class="cx"> {
</span><span class="cx">     Vector&lt;uint8_t&gt; buffer;
</span><span class="cx">     CloneSerializer::serializeUndefined(buffer);
</span><del>-    return adoptRef(*new SerializedScriptValue(buffer));
</del><ins>+    return adoptRef(*new SerializedScriptValue(WTFMove(buffer)));
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -2741,8 +2736,7 @@
</span><span class="cx"> 
</span><span class="cx"> Ref&lt;SerializedScriptValue&gt; SerializedScriptValue::nullValue()
</span><span class="cx"> {
</span><del>-    Vector&lt;uint8_t&gt; buffer;
-    return adoptRef(*new SerializedScriptValue(buffer));
</del><ins>+    return adoptRef(*new SerializedScriptValue(Vector&lt;uint8_t&gt;()));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SerializedScriptValue::maybeThrowExceptionIfSerializationFailed(ExecState* exec, SerializationReturnCode code)
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsSerializedScriptValueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.h (195234 => 195235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.h        2016-01-18 19:22:07 UTC (rev 195234)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.h        2016-01-18 20:26:42 UTC (rev 195235)
</span><span class="lines">@@ -69,9 +69,9 @@
</span><span class="cx">     WEBCORE_EXPORT static RefPtr&lt;SerializedScriptValue&gt; create(JSC::ExecState*, JSC::JSValue, MessagePortArray*, ArrayBufferArray*, SerializationErrorMode = Throwing);
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT static RefPtr&lt;SerializedScriptValue&gt; create(const String&amp;);
</span><del>-    static Ref&lt;SerializedScriptValue&gt; adopt(Vector&lt;uint8_t&gt;&amp; buffer)
</del><ins>+    static Ref&lt;SerializedScriptValue&gt; adopt(Vector&lt;uint8_t&gt;&amp;&amp; buffer)
</ins><span class="cx">     {
</span><del>-        return adoptRef(*new SerializedScriptValue(buffer));
</del><ins>+        return adoptRef(*new SerializedScriptValue(WTFMove(buffer)));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     static Ref&lt;SerializedScriptValue&gt; nullValue();
</span><span class="lines">@@ -96,9 +96,9 @@
</span><span class="cx">     static Ref&lt;SerializedScriptValue&gt; undefinedValue();
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    static Ref&lt;SerializedScriptValue&gt; createFromWireBytes(const Vector&lt;uint8_t&gt;&amp; data)
</del><ins>+    static Ref&lt;SerializedScriptValue&gt; createFromWireBytes(Vector&lt;uint8_t&gt;&amp;&amp; data)
</ins><span class="cx">     {
</span><del>-        return adoptRef(*new SerializedScriptValue(data));
</del><ins>+        return adoptRef(*new SerializedScriptValue(WTFMove(data)));
</ins><span class="cx">     }
</span><span class="cx">     const Vector&lt;uint8_t&gt;&amp; toWireBytes() const { return m_data; }
</span><span class="cx"> 
</span><span class="lines">@@ -111,10 +111,9 @@
</span><span class="cx">     static std::unique_ptr&lt;ArrayBufferContentsArray&gt; transferArrayBuffers(JSC::ExecState*, ArrayBufferArray&amp;, SerializationReturnCode&amp;);
</span><span class="cx">     void addBlobURL(const String&amp;);
</span><span class="cx"> 
</span><del>-    SerializedScriptValue(const Vector&lt;unsigned char&gt;&amp;);
-    WEBCORE_EXPORT SerializedScriptValue(Vector&lt;unsigned char&gt;&amp;);
-    SerializedScriptValue(Vector&lt;unsigned char&gt;&amp;, Vector&lt;String&gt;&amp; blobURLs);
-    SerializedScriptValue(Vector&lt;unsigned char&gt;&amp;, Vector&lt;String&gt;&amp; blobURLs, std::unique_ptr&lt;ArrayBufferContentsArray&gt;);
</del><ins>+    WEBCORE_EXPORT SerializedScriptValue(Vector&lt;unsigned char&gt;&amp;&amp;);
+    SerializedScriptValue(Vector&lt;unsigned char&gt;&amp;&amp;, const Vector&lt;String&gt;&amp; blobURLs);
+    SerializedScriptValue(Vector&lt;unsigned char&gt;&amp;&amp;, const Vector&lt;String&gt;&amp; blobURLs, std::unique_ptr&lt;ArrayBufferContentsArray&gt;&amp;&amp;);
</ins><span class="cx"> 
</span><span class="cx">     Vector&lt;unsigned char&gt; m_data;
</span><span class="cx">     std::unique_ptr&lt;ArrayBufferContentsArray&gt; m_arrayBufferContentsArray;
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.cpp (195234 => 195235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.cpp        2016-01-18 19:22:07 UTC (rev 195234)
+++ trunk/Source/WebCore/testing/Internals.cpp        2016-01-18 20:26:42 UTC (rev 195235)
</span><span class="lines">@@ -2502,7 +2502,7 @@
</span><span class="cx"> {
</span><span class="cx">     Vector&lt;uint8_t&gt; bytes;
</span><span class="cx">     bytes.append(static_cast&lt;const uint8_t*&gt;(buffer-&gt;data()), buffer-&gt;byteLength());
</span><del>-    return SerializedScriptValue::adopt(bytes);
</del><ins>+    return SerializedScriptValue::adopt(WTFMove(bytes));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool Internals::isFromCurrentWorld(Deprecated::ScriptValue value) const
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (195234 => 195235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-01-18 19:22:07 UTC (rev 195234)
+++ trunk/Source/WebKit2/ChangeLog        2016-01-18 20:26:42 UTC (rev 195235)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2016-01-18  Zan Dobersek  &lt;zdobersek@igalia.com&gt;
+
+        Sink the Vector&lt;uint8_t&gt; buffer into the SerializedScriptValue constructor
+        https://bugs.webkit.org/show_bug.cgi?id=142634
+
+        Reviewed by Darin Adler.
+
+        Update API::SerializedScriptValue::adopt() to take in a Vector&lt;uint8_t&gt;
+        rvalue, moving it into the WebCore::SerializedScriptValue::adopt() call.
+
+        Update other places that are affected by the SerializedScriptValue changes.
+
+        * DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp:
+        (WebKit::UniqueIDBDatabaseBackingStoreSQLite::createIndex):
+        * Shared/API/APISerializedScriptValue.h:
+        (API::SerializedScriptValue::adopt):
+        * Shared/UserData.cpp:
+        (WebKit::UserData::decode):
+        * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
+        (WebKit::WebUserContentControllerProxy::didPostMessage):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::scriptValueCallback):
+        * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
+        (WebKit::applyFrameState):
+
</ins><span class="cx"> 2016-01-18  Olivier Blin  &lt;olivier.blin@softathome.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [EFL][GTK][WK2] Fix UIProcess build with GStreamer and without VIDEO
</span></span></pre></div>
<a id="trunkSourceWebKit2DatabaseProcessIndexedDBsqliteUniqueIDBDatabaseBackingStoreSQLitecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp (195234 => 195235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp        2016-01-18 19:22:07 UTC (rev 195234)
+++ trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp        2016-01-18 20:26:42 UTC (rev 195235)
</span><span class="lines">@@ -776,7 +776,7 @@
</span><span class="cx">         if (!locker)
</span><span class="cx">             locker = std::make_unique&lt;JSLockHolder&gt;(m_vm.get());
</span><span class="cx"> 
</span><del>-        Deprecated::ScriptValue value = deserializeIDBValueBuffer(m_globalObject-&gt;globalExec(), valueBuffer, true);
</del><ins>+        Deprecated::ScriptValue value = deserializeIDBValueBuffer(m_globalObject-&gt;globalExec(), Vector&lt;uint8_t&gt;(valueBuffer), true);
</ins><span class="cx">         Vector&lt;IDBKeyData&gt; indexKeys;
</span><span class="cx">         generateIndexKeysForValue(m_globalObject-&gt;globalExec(), metadata, value, indexKeys);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedAPIAPISerializedScriptValueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/API/APISerializedScriptValue.h (195234 => 195235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/API/APISerializedScriptValue.h        2016-01-18 19:22:07 UTC (rev 195234)
+++ trunk/Source/WebKit2/Shared/API/APISerializedScriptValue.h        2016-01-18 20:26:42 UTC (rev 195235)
</span><span class="lines">@@ -49,9 +49,9 @@
</span><span class="cx">         return adoptRef(*new SerializedScriptValue(serializedValue.get()));
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    static Ref&lt;SerializedScriptValue&gt; adopt(Vector&lt;uint8_t&gt;&amp; buffer)
</del><ins>+    static Ref&lt;SerializedScriptValue&gt; adopt(Vector&lt;uint8_t&gt;&amp;&amp; buffer)
</ins><span class="cx">     {
</span><del>-        return adoptRef(*new SerializedScriptValue(WebCore::SerializedScriptValue::adopt(buffer)));
</del><ins>+        return adoptRef(*new SerializedScriptValue(WebCore::SerializedScriptValue::adopt(WTFMove(buffer))));
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     JSValueRef deserialize(JSContextRef context, JSValueRef* exception)
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedUserDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/UserData.cpp (195234 => 195235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/UserData.cpp        2016-01-18 19:22:07 UTC (rev 195234)
+++ trunk/Source/WebKit2/Shared/UserData.cpp        2016-01-18 20:26:42 UTC (rev 195235)
</span><span class="lines">@@ -530,8 +530,7 @@
</span><span class="cx">         if (!decoder.decode(dataReference))
</span><span class="cx">             return false;
</span><span class="cx"> 
</span><del>-        auto vector = dataReference.vector();
-        result = API::SerializedScriptValue::adopt(vector);
</del><ins>+        result = API::SerializedScriptValue::adopt(dataReference.vector());
</ins><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessUserContentWebUserContentControllerProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.cpp (195234 => 195235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.cpp        2016-01-18 19:22:07 UTC (rev 195234)
+++ trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.cpp        2016-01-18 20:26:42 UTC (rev 195235)
</span><span class="lines">@@ -177,10 +177,8 @@
</span><span class="cx">     if (!handler)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    auto buffer = dataReference.vector();
-    RefPtr&lt;WebCore::SerializedScriptValue&gt; value = WebCore::SerializedScriptValue::adopt(buffer);
-
-    handler-&gt;client().didPostMessage(*page, *frame, securityOrigin, *value);
</del><ins>+    handler-&gt;client().didPostMessage(*page, *frame, securityOrigin,
+        WebCore::SerializedScriptValue::adopt(dataReference.vector()));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CONTENT_EXTENSIONS)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (195234 => 195235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2016-01-18 19:22:07 UTC (rev 195234)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2016-01-18 20:26:42 UTC (rev 195235)
</span><span class="lines">@@ -4703,11 +4703,16 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (dataReference.isEmpty()) {
+        callback-&gt;performCallbackWithReturnValue(nullptr, hadException, details);
+        return;
+    }
+
</ins><span class="cx">     Vector&lt;uint8_t&gt; data;
</span><span class="cx">     data.reserveInitialCapacity(dataReference.size());
</span><span class="cx">     data.append(dataReference.data(), dataReference.size());
</span><span class="cx"> 
</span><del>-    callback-&gt;performCallbackWithReturnValue(data.size() ? API::SerializedScriptValue::adopt(data).ptr() : nullptr, hadException, details);
</del><ins>+    callback-&gt;performCallbackWithReturnValue(API::SerializedScriptValue::adopt(WTFMove(data)).ptr(), hadException, details);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageProxy::computedPagesCallback(const Vector&lt;IntRect&gt;&amp; pageRects, double totalScaleFactorForPrinting, uint64_t callbackID)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportSessionStateConversioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/SessionStateConversion.cpp (195234 => 195235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/SessionStateConversion.cpp        2016-01-18 19:22:07 UTC (rev 195234)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/SessionStateConversion.cpp        2016-01-18 20:26:42 UTC (rev 195235)
</span><span class="lines">@@ -154,7 +154,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (frameState.stateObjectData) {
</span><span class="cx">         Vector&lt;uint8_t&gt; stateObjectData = frameState.stateObjectData.value();
</span><del>-        historyItem.setStateObject(SerializedScriptValue::adopt(stateObjectData));
</del><ins>+        historyItem.setStateObject(SerializedScriptValue::adopt(WTFMove(stateObjectData)));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     historyItem.setDocumentSequenceNumber(frameState.documentSequenceNumber);
</span></span></pre>
</div>
</div>

</body>
</html>