<!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>[246623] trunk</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/246623">246623</a></dd>
<dt>Author</dt> <dd>Hironori.Fujii@sony.com</dd>
<dt>Date</dt> <dd>2019-06-19 17:51:30 -0700 (Wed, 19 Jun 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add WTF::crossThreadCopy(T&&) to utilize String::isolatedCopy() &&
https://bugs.webkit.org/show_bug.cgi?id=198957

Reviewed by Alex Christensen.

Source/WTF:

&&-qualified String::isolatedCopy() has a optimization path which
does just WTFMove if it isSafeToSendToAnotherThread which means
the object hasOneRef.

However, WTF::crossThreadCopy was using only &-qualified
isolatedCopy. To use the optimization, added
WTF::crossThreadCopy(T&&) overloading.

* wtf/CrossThreadCopier.h:
(WTF::crossThreadCopy): Added a overload of (T&&).
* wtf/CrossThreadTask.h:
(WTF::createCrossThreadTask): Removed explicit template arguments of crossThreadCopy.

Tools:

* TestWebKitAPI/CMakeLists.txt:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WTF/CrossThreadCopier.cpp: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfCrossThreadCopierh">trunk/Source/WTF/wtf/CrossThreadCopier.h</a></li>
<li><a href="#trunkSourceWTFwtfCrossThreadTaskh">trunk/Source/WTF/wtf/CrossThreadTask.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPICMakeListstxt">trunk/Tools/TestWebKitAPI/CMakeLists.txt</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsTestWebKitAPITestsWTFCrossThreadCopiercpp">trunk/Tools/TestWebKitAPI/Tests/WTF/CrossThreadCopier.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (246622 => 246623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog       2019-06-20 00:50:30 UTC (rev 246622)
+++ trunk/Source/WTF/ChangeLog  2019-06-20 00:51:30 UTC (rev 246623)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2019-06-19  Fujii Hironori  <Hironori.Fujii@sony.com>
+
+        Add WTF::crossThreadCopy(T&&) to utilize String::isolatedCopy() &&
+        https://bugs.webkit.org/show_bug.cgi?id=198957
+
+        Reviewed by Alex Christensen.
+
+        &&-qualified String::isolatedCopy() has a optimization path which
+        does just WTFMove if it isSafeToSendToAnotherThread which means
+        the object hasOneRef.
+
+        However, WTF::crossThreadCopy was using only &-qualified
+        isolatedCopy. To use the optimization, added
+        WTF::crossThreadCopy(T&&) overloading.
+
+        * wtf/CrossThreadCopier.h:
+        (WTF::crossThreadCopy): Added a overload of (T&&).
+        * wtf/CrossThreadTask.h:
+        (WTF::createCrossThreadTask): Removed explicit template arguments of crossThreadCopy.
+
</ins><span class="cx"> 2019-06-19  Devin Rousso  <drousso@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Network: replace CFNetwork SPI with new API where able
</span></span></pre></div>
<a id="trunkSourceWTFwtfCrossThreadCopierh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/CrossThreadCopier.h (246622 => 246623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/CrossThreadCopier.h 2019-06-20 00:50:30 UTC (rev 246622)
+++ trunk/Source/WTF/wtf/CrossThreadCopier.h    2019-06-20 00:51:30 UTC (rev 246623)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> 
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><ins>+#include <type_traits>
</ins><span class="cx"> #include <wtf/Assertions.h>
</span><span class="cx"> #include <wtf/Forward.h>
</span><span class="cx"> #include <wtf/HashSet.h>
</span><span class="lines">@@ -77,9 +78,9 @@
</span><span class="cx"> 
</span><span class="cx"> // Classes that have an isolatedCopy() method get a default specialization.
</span><span class="cx"> template<class T> struct CrossThreadCopierBase<false, false, T> {
</span><del>-    static T copy(const T& value)
</del><ins>+    template<typename U> static auto copy(U&& value)
</ins><span class="cx">     {
</span><del>-        return value.isolatedCopy();
</del><ins>+        return std::forward<U>(value).isolatedCopy();
</ins><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -146,18 +147,17 @@
</span><span class="cx"> 
</span><span class="cx"> // Default specialization for Optional of CrossThreadCopyable class.
</span><span class="cx"> template<typename T> struct CrossThreadCopierBase<false, false, Optional<T>> {
</span><del>-    typedef Optional<T> Type;
-    static Type copy(const Type& source)
</del><ins>+    template<typename U> static Optional<T> copy(U&& source)
</ins><span class="cx">     {
</span><span class="cx">         if (!source)
</span><span class="cx">             return WTF::nullopt;
</span><del>-        return CrossThreadCopier<T>::copy(*source);
</del><ins>+        return CrossThreadCopier<T>::copy(std::forward<U>(source).value());
</ins><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-template<typename T> T crossThreadCopy(const T& source)
</del><ins>+template<typename T> auto crossThreadCopy(T&& source)
</ins><span class="cx"> {
</span><del>-    return CrossThreadCopier<T>::copy(source);
</del><ins>+    return CrossThreadCopier<std::remove_cv_t<std::remove_reference_t<T>>>::copy(std::forward<T>(source));
</ins><span class="cx"> }
</span><span class="cx">     
</span><span class="cx"> } // namespace WTF
</span></span></pre></div>
<a id="trunkSourceWTFwtfCrossThreadTaskh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/CrossThreadTask.h (246622 => 246623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/CrossThreadTask.h   2019-06-20 00:50:30 UTC (rev 246622)
+++ trunk/Source/WTF/wtf/CrossThreadTask.h      2019-06-20 00:51:30 UTC (rev 246623)
</span><span class="lines">@@ -67,7 +67,7 @@
</span><span class="cx"> template<typename... Parameters, typename... Arguments>
</span><span class="cx"> CrossThreadTask createCrossThreadTask(void (*method)(Parameters...), const Arguments&... arguments)
</span><span class="cx"> {
</span><del>-    return CrossThreadTask([method, arguments = std::make_tuple(crossThreadCopy<Arguments>(arguments)...)]() mutable {
</del><ins>+    return CrossThreadTask([method, arguments = std::make_tuple(crossThreadCopy(arguments)...)]() mutable {
</ins><span class="cx">         callFunctionForCrossThreadTask(method, WTFMove(arguments));
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="lines">@@ -87,7 +87,7 @@
</span><span class="cx"> template<typename T, typename std::enable_if<std::is_base_of<ThreadSafeRefCounted<T>, T>::value, int>::type = 0, typename... Parameters, typename... Arguments>
</span><span class="cx"> CrossThreadTask createCrossThreadTask(T& callee, void (T::*method)(Parameters...), const Arguments&... arguments)
</span><span class="cx"> {
</span><del>-    return CrossThreadTask([callee = makeRefPtr(&callee), method, arguments = std::make_tuple(crossThreadCopy<Arguments>(arguments)...)]() mutable {
</del><ins>+    return CrossThreadTask([callee = makeRefPtr(&callee), method, arguments = std::make_tuple(crossThreadCopy(arguments)...)]() mutable {
</ins><span class="cx">         callMemberFunctionForCrossThreadTask(callee.get(), method, WTFMove(arguments));
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="lines">@@ -95,7 +95,7 @@
</span><span class="cx"> template<typename T, typename std::enable_if<!std::is_base_of<ThreadSafeRefCounted<T>, T>::value, int>::type = 0, typename... Parameters, typename... Arguments>
</span><span class="cx"> CrossThreadTask createCrossThreadTask(T& callee, void (T::*method)(Parameters...), const Arguments&... arguments)
</span><span class="cx"> {
</span><del>-    return CrossThreadTask([callee = &callee, method, arguments = std::make_tuple(crossThreadCopy<Arguments>(arguments)...)]() mutable {
</del><ins>+    return CrossThreadTask([callee = &callee, method, arguments = std::make_tuple(crossThreadCopy(arguments)...)]() mutable {
</ins><span class="cx">         callMemberFunctionForCrossThreadTask(callee, method, WTFMove(arguments));
</span><span class="cx">     });
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (246622 => 246623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog    2019-06-20 00:50:30 UTC (rev 246622)
+++ trunk/Tools/ChangeLog       2019-06-20 00:51:30 UTC (rev 246623)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2019-06-19  Fujii Hironori  <Hironori.Fujii@sony.com>
+
+        Add WTF::crossThreadCopy(T&&) to utilize String::isolatedCopy() &&
+        https://bugs.webkit.org/show_bug.cgi?id=198957
+
+        Reviewed by Alex Christensen.
+
+        * TestWebKitAPI/CMakeLists.txt:
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WTF/CrossThreadCopier.cpp: Added.
+
</ins><span class="cx"> 2019-06-19  Keith Rollin  <krollin@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Relocate some test tools in non-mac builds
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPICMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/CMakeLists.txt (246622 => 246623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/CMakeLists.txt 2019-06-20 00:50:30 UTC (rev 246622)
+++ trunk/Tools/TestWebKitAPI/CMakeLists.txt    2019-06-20 00:51:30 UTC (rev 246623)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx">     Tests/WTF/CheckedArithmeticOperations.cpp
</span><span class="cx">     Tests/WTF/ConcurrentPtrHashSet.cpp
</span><span class="cx">     Tests/WTF/Condition.cpp
</span><ins>+    Tests/WTF/CrossThreadCopier.cpp
</ins><span class="cx">     Tests/WTF/CrossThreadTask.cpp
</span><span class="cx">     Tests/WTF/DateMath.cpp
</span><span class="cx">     Tests/WTF/Deque.cpp
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (246622 => 246623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2019-06-20 00:50:30 UTC (rev 246622)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj   2019-06-20 00:51:30 UTC (rev 246623)
</span><span class="lines">@@ -1470,6 +1470,7 @@
</span><span class="cx">          26F52EB018288F0F0023D412 /* geolocationWatchPosition.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = geolocationWatchPosition.html; sourceTree = "<group>"; };
</span><span class="cx">          26F52EB118288F0F0023D412 /* geolocationWatchPositionWithHighAccuracy.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = geolocationWatchPositionWithHighAccuracy.html; sourceTree = "<group>"; };
</span><span class="cx">          26F6E1EF1ADC749B00DE696B /* DFAMinimizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DFAMinimizer.cpp; sourceTree = "<group>"; };
</span><ins>+               278DE64B22B8D611004E0E7A /* CrossThreadCopier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CrossThreadCopier.cpp; sourceTree = "<group>"; };
</ins><span class="cx">           290A9BB51735DE8A00D71BBC /* CloseNewWindowInNavigationPolicyDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CloseNewWindowInNavigationPolicyDelegate.mm; sourceTree = "<group>"; };
</span><span class="cx">          290A9BB81735F42300D71BBC /* OpenNewWindow.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = OpenNewWindow.html; sourceTree = "<group>"; };
</span><span class="cx">          290F4274172A1FDE00939FF0 /* custom-protocol-sync-xhr.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "custom-protocol-sync-xhr.html"; sourceTree = "<group>"; };
</span><span class="lines">@@ -3399,6 +3400,7 @@
</span><span class="cx">                          A7A966DA140ECCC8005EF9B4 /* CheckedArithmeticOperations.cpp */,
</span><span class="cx">                          0F30CB5B1FCE1792004B5323 /* ConcurrentPtrHashSet.cpp */,
</span><span class="cx">                          0FEAE3671B7D19CB00CE17F2 /* Condition.cpp */,
</span><ins>+                               278DE64B22B8D611004E0E7A /* CrossThreadCopier.cpp */,
</ins><span class="cx">                           51714EB91D087416004723C4 /* CrossThreadTask.cpp */,
</span><span class="cx">                          26A2C72E15E2E73C005B1A14 /* CString.cpp */,
</span><span class="cx">                          7AA021BA1AB09EA70052953F /* DateMath.cpp */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWTFCrossThreadCopiercpp"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WTF/CrossThreadCopier.cpp (0 => 246623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WTF/CrossThreadCopier.cpp                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/CrossThreadCopier.cpp   2019-06-20 00:51:30 UTC (rev 246623)
</span><span class="lines">@@ -0,0 +1,89 @@
</span><ins>+/*
+ * Copyright (C) 2019 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include <wtf/CrossThreadCopier.h>
+
+#include "Test.h"
+#include <wtf/Optional.h>
+#include <wtf/text/WTFString.h>
+
+namespace TestWebKitAPI {
+
+TEST(WTF_CrossThreadCopier, CopyLVString)
+{
+    String original { "1234" };
+    auto copy = crossThreadCopy(original);
+    EXPECT_TRUE(original.impl()->hasOneRef());
+    EXPECT_TRUE(copy.impl()->hasOneRef());
+    EXPECT_FALSE(original.impl() == copy.impl());
+}
+
+TEST(WTF_CrossThreadCopier, MoveRVString)
+{
+    String original { "1234" };
+    auto copy = crossThreadCopy(WTFMove(original));
+    EXPECT_TRUE(copy.impl()->hasOneRef());
+    EXPECT_NULL(original.impl());
+}
+
+TEST(WTF_CrossThreadCopier, CopyRVStringHavingTwoRef)
+{
+    String original { "1234" };
+    String original2 { original };
+    auto copy = crossThreadCopy(WTFMove(original));
+    EXPECT_EQ(original.impl()->refCount(), 2);
+    EXPECT_FALSE(original.impl() == copy.impl());
+    EXPECT_TRUE(copy.impl()->hasOneRef());
+}
+
+TEST(WTF_CrossThreadCopier, CopyLVOptionalString)
+{
+    Optional<String> original { "1234" };
+    auto copy = crossThreadCopy(original);
+    EXPECT_TRUE(original->impl()->hasOneRef());
+    EXPECT_TRUE(copy->impl()->hasOneRef());
+    EXPECT_FALSE(original->impl() == copy->impl());
+}
+
+TEST(WTF_CrossThreadCopier, MoveRVOptionalString)
+{
+    Optional<String> original { "1234" };
+    auto copy = crossThreadCopy(WTFMove(original));
+    EXPECT_TRUE(copy->impl()->hasOneRef());
+    EXPECT_NULL(original->impl());
+}
+
+TEST(WTF_CrossThreadCopier, CopyRVOptionalStringHavingTwoRef)
+{
+    String string { "1234" };
+    Optional<String> original { string };
+    auto copy = crossThreadCopy(original);
+    EXPECT_EQ(original->impl()->refCount(), 2);
+    EXPECT_FALSE(original->impl() == copy->impl());
+    EXPECT_TRUE(copy->impl()->hasOneRef());
+}
+
+} // namespace TestWebKitAPI
</ins></span></pre>
</div>
</div>

</body>
</html>