<!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>[173356] 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/173356">173356</a></dd>
<dt>Author</dt> <dd>antti@apple.com</dd>
<dt>Date</dt> <dd>2014-09-06 08:33:06 -0700 (Sat, 06 Sep 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Serialize ResourceResponses using WebKit types
https://bugs.webkit.org/show_bug.cgi?id=136545
Reviewed by Alexey Proskuryakov.
Source/WebCore:
Serialization is faster and we can mostly avoid having NSURLResponses in web process.
* WebCore.exp.in:
* platform/network/ResourceLoadTiming.h:
(WebCore::ResourceLoadTiming::encode):
(WebCore::ResourceLoadTiming::decode):
* platform/network/ResourceResponseBase.h:
(WebCore::ResourceResponseBase::encode):
(WebCore::ResourceResponseBase::decode):
Serialize from the WebCore data instead of serializing NSURLResponse.
* platform/network/cf/ResourceResponseCFNet.cpp:
(WebCore::ResourceResponse::cfURLResponse):
Synthesize CFURLResponse by creating NSURLResponse on Cocoa platforms so we don't need copy code.
This has negligible performance impact, NSURLResponse is just a wrapper around CFURLResponse.
* platform/network/mac/ResourceResponseMac.mm:
(WebCore::ResourceResponse::nsURLResponse):
(WebCore::ResourceResponse::setCertificateChain):
Avoid unnecessary NSURLRequest instantiation in debug builds.
Source/WebKit2:
Remove the WK2 serialization code for responses. It moves to the types itself in WebCore where it is
close to the data being serialized and less likely to get out of sync.
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<ResourceResponse>::encode): Deleted.
(IPC::ArgumentCoder<ResourceResponse>::decode): Deleted.
* Shared/WebCoreArgumentCoders.h:
* Shared/mac/WebCoreArgumentCodersMac.mm:
(IPC::ArgumentCoder<ResourceResponse>::encodePlatformData): Deleted.
(IPC::ArgumentCoder<ResourceResponse>::decodePlatformData): Deleted.
LayoutTests:
Remove failure expectations for tests fixed by this patch.
http/tests/xmlhttprequest/web-apps/012.html
http/tests/xmlhttprequest/web-apps/013.html
* platform/mac-wk2/TestExpectations:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk2TestExpectations">trunk/LayoutTests/platform/mac-wk2/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceLoadTimingh">trunk/Source/WebCore/platform/network/ResourceLoadTiming.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceResponseBaseh">trunk/Source/WebCore/platform/network/ResourceResponseBase.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfResourceResponseCFNetcpp">trunk/Source/WebCore/platform/network/cf/ResourceResponseCFNet.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkmacResourceResponseMacmm">trunk/Source/WebCore/platform/network/mac/ResourceResponseMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworksoupResourceResponseh">trunk/Source/WebCore/platform/network/soup/ResourceResponse.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedWebCoreArgumentCoderscpp">trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedWebCoreArgumentCodersh">trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h</a></li>
<li><a href="#trunkSourceWebKit2SharedmacWebCoreArgumentCodersMacmm">trunk/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm</a></li>
<li><a href="#trunkSourceWebKit2SharedsoupWebCoreArgumentCodersSoupcpp">trunk/Source/WebKit2/Shared/soup/WebCoreArgumentCodersSoup.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (173355 => 173356)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-09-06 15:02:58 UTC (rev 173355)
+++ trunk/LayoutTests/ChangeLog        2014-09-06 15:33:06 UTC (rev 173356)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-09-06 Antti Koivisto <antti@apple.com>
+
+ Serialize ResourceResponses using WebKit types
+ https://bugs.webkit.org/show_bug.cgi?id=136545
+
+ Reviewed by Alexey Proskuryakov.
+
+ Remove failure expectations for tests fixed by this patch.
+
+ http/tests/xmlhttprequest/web-apps/012.html
+ http/tests/xmlhttprequest/web-apps/013.html
+
+ * platform/mac-wk2/TestExpectations:
+
</ins><span class="cx"> 2014-09-06 Commit Queue <commit-queue@webkit.org>
</span><span class="cx">
</span><span class="cx"> Unreviewed, rolling out r173335.
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (173355 => 173356)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/TestExpectations        2014-09-06 15:02:58 UTC (rev 173355)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations        2014-09-06 15:33:06 UTC (rev 173356)
</span><span class="lines">@@ -639,10 +639,6 @@
</span><span class="cx"> # PPT: PingLoader is still in WebProcess. As a result, this test fails and also fails to delete its cookie, breaking many other cookie tests.
</span><span class="cx"> [ Mavericks ] http/tests/navigation/ping-cookie.html [ Skip ]
</span><span class="cx">
</span><del>-# <rdar://problem/13751647> PPT: Status text not passed over IPC
-[ Mavericks ] http/tests/xmlhttprequest/web-apps/012.html [ Failure ]
-[ Mavericks ] http/tests/xmlhttprequest/web-apps/013.html [ Failure ]
-
</del><span class="cx"> # https://bugs.webkit.org/show_bug.cgi?id=133227
</span><span class="cx"> plugins/snapshotting/set-plugin-size-to-tiny.html
</span><span class="cx"> plugins/snapshotting/simple.html
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (173355 => 173356)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-09-06 15:02:58 UTC (rev 173355)
+++ trunk/Source/WebCore/ChangeLog        2014-09-06 15:33:06 UTC (rev 173356)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2014-09-06 Antti Koivisto <antti@apple.com>
+
+ Serialize ResourceResponses using WebKit types
+ https://bugs.webkit.org/show_bug.cgi?id=136545
+
+ Reviewed by Alexey Proskuryakov.
+
+ Serialization is faster and we can mostly avoid having NSURLResponses in web process.
+
+ * WebCore.exp.in:
+ * platform/network/ResourceLoadTiming.h:
+ (WebCore::ResourceLoadTiming::encode):
+ (WebCore::ResourceLoadTiming::decode):
+ * platform/network/ResourceResponseBase.h:
+ (WebCore::ResourceResponseBase::encode):
+ (WebCore::ResourceResponseBase::decode):
+
+ Serialize from the WebCore data instead of serializing NSURLResponse.
+
+ * platform/network/cf/ResourceResponseCFNet.cpp:
+ (WebCore::ResourceResponse::cfURLResponse):
+
+ Synthesize CFURLResponse by creating NSURLResponse on Cocoa platforms so we don't need copy code.
+ This has negligible performance impact, NSURLResponse is just a wrapper around CFURLResponse.
+
+ * platform/network/mac/ResourceResponseMac.mm:
+ (WebCore::ResourceResponse::nsURLResponse):
+ (WebCore::ResourceResponse::setCertificateChain):
+
+ Avoid unnecessary NSURLRequest instantiation in debug builds.
+
</ins><span class="cx"> 2014-09-06 David Kilzer <ddkilzer@apple.com>
</span><span class="cx">
</span><span class="cx"> HTMLElement.cpp does not compile with new clang
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (173355 => 173356)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-09-06 15:02:58 UTC (rev 173355)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-09-06 15:33:06 UTC (rev 173356)
</span><span class="lines">@@ -1837,6 +1837,7 @@
</span><span class="cx"> __ZNK7WebCore20ResourceResponseBase21expectedContentLengthEv
</span><span class="cx"> __ZNK7WebCore20ResourceResponseBase3urlEv
</span><span class="cx"> __ZNK7WebCore20ResourceResponseBase6isHTTPEv
</span><ins>+__ZNK7WebCore20ResourceResponseBase8lazyInitENS0_9InitLevelE
</ins><span class="cx"> __ZNK7WebCore20ResourceResponseBase8mimeTypeEv
</span><span class="cx"> __ZNK7WebCore20TransformationMatrix7inverseEv
</span><span class="cx"> __ZNK7WebCore20TransformationMatrix7mapRectERKNS_7IntRectE
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceLoadTimingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceLoadTiming.h (173355 => 173356)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceLoadTiming.h        2014-09-06 15:02:58 UTC (rev 173355)
+++ trunk/Source/WebCore/platform/network/ResourceLoadTiming.h        2014-09-06 15:33:06 UTC (rev 173356)
</span><span class="lines">@@ -80,7 +80,10 @@
</span><span class="cx"> {
</span><span class="cx"> return !(*this == other);
</span><span class="cx"> }
</span><del>-
</del><ins>+
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static bool decode(Decoder&, ResourceLoadTiming&);
+
</ins><span class="cx"> // These are millisecond deltas from the navigation start.
</span><span class="cx"> int domainLookupStart;
</span><span class="cx"> int domainLookupEnd;
</span><span class="lines">@@ -91,6 +94,30 @@
</span><span class="cx"> int secureConnectionStart;
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+template<class Encoder>
+void ResourceLoadTiming::encode(Encoder& encoder) const
+{
+ encoder << domainLookupStart;
+ encoder << domainLookupEnd;
+ encoder << connectStart;
+ encoder << connectEnd;
+ encoder << requestStart;
+ encoder << responseStart;
+ encoder << secureConnectionStart;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+template<class Decoder>
+bool ResourceLoadTiming::decode(Decoder& decoder, ResourceLoadTiming& timing)
+{
+ return decoder.decode(timing.domainLookupStart)
+ && decoder.decode(timing.domainLookupEnd)
+ && decoder.decode(timing.connectStart)
+ && decoder.decode(timing.connectEnd)
+ && decoder.decode(timing.requestStart)
+ && decoder.decode(timing.responseStart)
+ && decoder.decode(timing.secureConnectionStart);
+}
+
+}
+
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceResponseBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceResponseBase.h (173355 => 173356)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceResponseBase.h        2014-09-06 15:02:58 UTC (rev 173355)
+++ trunk/Source/WebCore/platform/network/ResourceResponseBase.h        2014-09-06 15:33:06 UTC (rev 173356)
</span><span class="lines">@@ -124,6 +124,9 @@
</span><span class="cx">
</span><span class="cx"> static bool compare(const ResourceResponse&, const ResourceResponse&);
</span><span class="cx">
</span><ins>+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static bool decode(Decoder&, ResourceResponseBase&);
+
</ins><span class="cx"> protected:
</span><span class="cx"> enum InitLevel {
</span><span class="cx"> Uninitialized,
</span><span class="lines">@@ -186,6 +189,62 @@
</span><span class="cx"> inline bool operator==(const ResourceResponse& a, const ResourceResponse& b) { return ResourceResponseBase::compare(a, b); }
</span><span class="cx"> inline bool operator!=(const ResourceResponse& a, const ResourceResponse& b) { return !(a == b); }
</span><span class="cx">
</span><ins>+template<class Encoder>
+void ResourceResponseBase::encode(Encoder& encoder) const
+{
+ encoder << m_isNull;
+ if (m_isNull)
+ return;
+ lazyInit(AllFields);
+
+ encoder << m_url.string();
+ encoder << m_mimeType;
+ encoder << static_cast<int64_t>(m_expectedContentLength);
+ encoder << m_textEncodingName;
+ encoder << m_httpStatusText;
+ encoder << m_httpHeaderFields;
+ encoder << m_resourceLoadTiming;
+ encoder << m_httpStatusCode;
+ encoder << m_connectionID;
+}
+
+template<class Decoder>
+bool ResourceResponseBase::decode(Decoder& decoder, ResourceResponseBase& response)
+{
+ ASSERT(response.m_isNull);
+ bool responseIsNull;
+ if (!decoder.decode(responseIsNull))
+ return false;
+ if (responseIsNull)
+ return true;
+
+ String url;
+ if (!decoder.decode(url))
+ return false;
+ response.m_url = URL(URL(), url);
+ if (!decoder.decode(response.m_mimeType))
+ return false;
+ int64_t expectedContentLength;
+ if (!decoder.decode(expectedContentLength))
+ return false;
+ response.m_expectedContentLength = expectedContentLength;
+ if (!decoder.decode(response.m_textEncodingName))
+ return false;
+ if (!decoder.decode(response.m_httpStatusText))
+ return false;
+ if (!decoder.decode(response.m_httpHeaderFields))
+ return false;
+ if (!decoder.decode(response.m_resourceLoadTiming))
+ return false;
+ if (!decoder.decode(response.m_httpStatusCode))
+ return false;
+ if (!decoder.decode(response.m_connectionID))
+ return false;
+ response.m_isNull = false;
+
+ return true;
+}
+
</ins><span class="cx"> struct CrossThreadResourceResponseDataBase {
</span><span class="cx"> WTF_MAKE_NONCOPYABLE(CrossThreadResourceResponseDataBase); WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfResourceResponseCFNetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/ResourceResponseCFNet.cpp (173355 => 173356)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/ResourceResponseCFNet.cpp        2014-09-06 15:02:58 UTC (rev 173355)
+++ trunk/Source/WebCore/platform/network/cf/ResourceResponseCFNet.cpp        2014-09-06 15:33:06 UTC (rev 173356)
</span><span class="lines">@@ -48,11 +48,13 @@
</span><span class="cx"> CFURLResponseRef ResourceResponse::cfURLResponse() const
</span><span class="cx"> {
</span><span class="cx"> if (!m_cfResponse && !m_isNull) {
</span><ins>+#if PLATFORM(COCOA)
+ nsURLResponse();
+#else
</ins><span class="cx"> RetainPtr<CFURLRef> url = m_url.createCFURL();
</span><del>-
</del><span class="cx"> // FIXME: This creates a very incomplete CFURLResponse, which does not even have a status code.
</span><del>-
</del><span class="cx"> m_cfResponse = adoptCF(CFURLResponseCreate(0, url.get(), m_mimeType.string().createCFString().get(), m_expectedContentLength, m_textEncodingName.string().createCFString().get(), kCFURLCacheStorageAllowed));
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return m_cfResponse.get();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkmacResourceResponseMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/mac/ResourceResponseMac.mm (173355 => 173356)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/mac/ResourceResponseMac.mm        2014-09-06 15:02:58 UTC (rev 173355)
+++ trunk/Source/WebCore/platform/network/mac/ResourceResponseMac.mm        2014-09-06 15:33:06 UTC (rev 173356)
</span><span class="lines">@@ -58,6 +58,8 @@
</span><span class="cx"> m_nsResponse = adoptNS([[NSURLResponse alloc] initWithURL:m_url MIMEType:m_mimeType expectedContentLength:expectedContentLength textEncodingName:m_textEncodingName]);
</span><span class="cx"> return;
</span><span class="cx"> }
</span><ins>+
+ // FIXME: We lose the status text and the HTTP version here.
</ins><span class="cx"> NSMutableDictionary* headerDictionary = [NSMutableDictionary dictionary];
</span><span class="cx"> for (auto& header : m_httpHeaderFields)
</span><span class="cx"> [headerDictionary setObject:(NSString *)header.value forKey:(NSString *)header.key];
</span><span class="lines">@@ -185,7 +187,7 @@
</span><span class="cx">
</span><span class="cx"> void ResourceResponse::setCertificateChain(CFArrayRef certificateChain)
</span><span class="cx"> {
</span><del>- ASSERT(!wkCopyNSURLResponseCertificateChain(nsURLResponse()));
</del><ins>+ ASSERT(!m_nsResponse || !wkCopyNSURLResponseCertificateChain(m_nsResponse.get()));
</ins><span class="cx"> m_externalCertificateChain = certificateChain;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworksoupResourceResponseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/soup/ResourceResponse.h (173355 => 173356)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/soup/ResourceResponse.h        2014-09-06 15:02:58 UTC (rev 173355)
+++ trunk/Source/WebCore/platform/network/soup/ResourceResponse.h        2014-09-06 15:33:06 UTC (rev 173356)
</span><span class="lines">@@ -76,6 +76,9 @@
</span><span class="cx">
</span><span class="cx"> bool platformResponseIsUpToDate() const { return false; }
</span><span class="cx">
</span><ins>+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static bool decode(Decoder&, ResourceResponse&);
+
</ins><span class="cx"> private:
</span><span class="cx"> friend class ResourceResponseBase;
</span><span class="cx">
</span><span class="lines">@@ -91,6 +94,23 @@
</span><span class="cx"> void doPlatformAdopt(PassOwnPtr<CrossThreadResourceResponseData>) { }
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+template<class Encoder>
+void ResourceResponse::encode(Encoder& encoder) const
+{
+ ResourceResponseBase::encode(encoder);
+ encoder.encodeEnum(m_soupFlags);
+}
+
+template<class Decoder>
+bool ResourceResponse::decode(Decoder& decoder, ResourceResponse& response)
+{
+ if (!ResourceResponseBase::decode(decoder, response))
+ return false;
+ if (!decoder.decodeEnum(response.m_soupFlags))
+ return false;
+ return true;
+}
+
</ins><span class="cx"> struct CrossThreadResourceResponseData : public CrossThreadResourceResponseDataBase {
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (173355 => 173356)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-09-06 15:02:58 UTC (rev 173355)
+++ trunk/Source/WebKit2/ChangeLog        2014-09-06 15:33:06 UTC (rev 173356)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2014-09-06 Antti Koivisto <antti@apple.com>
+
+ Serialize ResourceResponses using WebKit types
+ https://bugs.webkit.org/show_bug.cgi?id=136545
+
+ Reviewed by Alexey Proskuryakov.
+
+ Remove the WK2 serialization code for responses. It moves to the types itself in WebCore where it is
+ close to the data being serialized and less likely to get out of sync.
+
+ * Shared/WebCoreArgumentCoders.cpp:
+ (IPC::ArgumentCoder<ResourceResponse>::encode): Deleted.
+ (IPC::ArgumentCoder<ResourceResponse>::decode): Deleted.
+ * Shared/WebCoreArgumentCoders.h:
+ * Shared/mac/WebCoreArgumentCodersMac.mm:
+ (IPC::ArgumentCoder<ResourceResponse>::encodePlatformData): Deleted.
+ (IPC::ArgumentCoder<ResourceResponse>::decodePlatformData): Deleted.
+
</ins><span class="cx"> 2014-09-06 Ryuan Choi <ryuan.choi@gmail.com>
</span><span class="cx">
</span><span class="cx"> [EFL] Drop evas object cursor support
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebCoreArgumentCoderscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp (173355 => 173356)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp        2014-09-06 15:02:58 UTC (rev 173355)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp        2014-09-06 15:33:06 UTC (rev 173356)
</span><span class="lines">@@ -674,123 +674,6 @@
</span><span class="cx"> return resourceRequest.decodeWithoutPlatformData(decoder);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void ArgumentCoder<ResourceResponse>::encode(ArgumentEncoder& encoder, const ResourceResponse& resourceResponse)
-{
-#if PLATFORM(COCOA)
- bool shouldSerializeWebCoreData = !resourceResponse.platformResponseIsUpToDate();
- encoder << shouldSerializeWebCoreData;
-#else
- bool shouldSerializeWebCoreData = true;
-#endif
-
- encodePlatformData(encoder, resourceResponse);
-
- if (shouldSerializeWebCoreData) {
- bool responseIsNull = resourceResponse.isNull();
- encoder << responseIsNull;
- if (responseIsNull)
- return;
-
- encoder << resourceResponse.url().string();
- encoder << static_cast<int32_t>(resourceResponse.httpStatusCode());
- encoder << resourceResponse.httpHeaderFields();
-
- encoder << resourceResponse.mimeType();
- encoder << resourceResponse.textEncodingName();
- encoder << static_cast<int64_t>(resourceResponse.expectedContentLength());
- encoder << resourceResponse.httpStatusText();
- }
-
-#if ENABLE(WEB_TIMING)
- const ResourceLoadTiming& timing = resourceResponse.resourceLoadTiming();
- encoder << timing.domainLookupStart;
- encoder << timing.domainLookupEnd;
- encoder << timing.connectStart;
- encoder << timing.connectEnd;
- encoder << timing.requestStart;
- encoder << timing.responseStart;
- encoder << timing.secureConnectionStart;
-#endif
-}
-
-bool ArgumentCoder<ResourceResponse>::decode(ArgumentDecoder& decoder, ResourceResponse& resourceResponse)
-{
-#if PLATFORM(COCOA)
- bool hasSerializedWebCoreData;
- if (!decoder.decode(hasSerializedWebCoreData))
- return false;
-#else
- bool hasSerializedWebCoreData = true;
-#endif
-
- ResourceResponse response;
-
- if (!decodePlatformData(decoder, response))
- return false;
-
- if (hasSerializedWebCoreData) {
- bool responseIsNull;
- if (!decoder.decode(responseIsNull))
- return false;
- if (responseIsNull) {
- resourceResponse = ResourceResponse();
- return true;
- }
-
- String url;
- if (!decoder.decode(url))
- return false;
- response.setURL(URL(URL(), url));
-
- int32_t httpStatusCode;
- if (!decoder.decode(httpStatusCode))
- return false;
- response.setHTTPStatusCode(httpStatusCode);
-
- HTTPHeaderMap headers;
- if (!decoder.decode(headers))
- return false;
- for (HTTPHeaderMap::const_iterator it = headers.begin(), end = headers.end(); it != end; ++it)
- response.setHTTPHeaderField(it->key, it->value);
-
- String mimeType;
- if (!decoder.decode(mimeType))
- return false;
- response.setMimeType(mimeType);
-
- String textEncodingName;
- if (!decoder.decode(textEncodingName))
- return false;
- response.setTextEncodingName(textEncodingName);
-
- int64_t contentLength;
- if (!decoder.decode(contentLength))
- return false;
- response.setExpectedContentLength(contentLength);
-
- String httpStatusText;
- if (!decoder.decode(httpStatusText))
- return false;
- response.setHTTPStatusText(httpStatusText);
- }
-
-#if ENABLE(WEB_TIMING)
- ResourceLoadTiming& timing = response.resourceLoadTiming();
- if (!decoder.decode(timing.domainLookupStart)
- || !decoder.decode(timing.domainLookupEnd)
- || !decoder.decode(timing.connectStart)
- || !decoder.decode(timing.connectEnd)
- || !decoder.decode(timing.requestStart)
- || !decoder.decode(timing.responseStart)
- || !decoder.decode(timing.secureConnectionStart))
- return false;
-#endif
-
- resourceResponse = response;
-
- return true;
-}
-
</del><span class="cx"> void ArgumentCoder<ResourceError>::encode(ArgumentEncoder& encoder, const ResourceError& resourceError)
</span><span class="cx"> {
</span><span class="cx"> encodePlatformData(encoder, resourceError);
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebCoreArgumentCodersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h (173355 => 173356)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h        2014-09-06 15:02:58 UTC (rev 173355)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h        2014-09-06 15:33:06 UTC (rev 173356)
</span><span class="lines">@@ -251,13 +251,6 @@
</span><span class="cx"> static bool decodePlatformData(ArgumentDecoder&, WebCore::ResourceRequest&);
</span><span class="cx"> };
</span><span class="cx">
</span><del>-template<> struct ArgumentCoder<WebCore::ResourceResponse> {
- static void encode(ArgumentEncoder&, const WebCore::ResourceResponse&);
- static bool decode(ArgumentDecoder&, WebCore::ResourceResponse&);
- static void encodePlatformData(ArgumentEncoder&, const WebCore::ResourceResponse&);
- static bool decodePlatformData(ArgumentDecoder&, WebCore::ResourceResponse&);
-};
-
</del><span class="cx"> template<> struct ArgumentCoder<WebCore::ResourceError> {
</span><span class="cx"> static void encode(ArgumentEncoder&, const WebCore::ResourceError&);
</span><span class="cx"> static bool decode(ArgumentDecoder&, WebCore::ResourceError&);
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacWebCoreArgumentCodersMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm (173355 => 173356)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm        2014-09-06 15:02:58 UTC (rev 173355)
+++ trunk/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm        2014-09-06 15:33:06 UTC (rev 173356)
</span><span class="lines">@@ -143,42 +143,6 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void ArgumentCoder<ResourceResponse>::encodePlatformData(ArgumentEncoder& encoder, const ResourceResponse& resourceResponse)
-{
- bool responseIsPresent = resourceResponse.platformResponseIsUpToDate() && resourceResponse.nsURLResponse();
- encoder << responseIsPresent;
-
- if (!responseIsPresent)
- return;
-
- RetainPtr<CFDictionaryRef> dictionary = adoptCF(WKNSURLResponseCreateSerializableRepresentation(resourceResponse.nsURLResponse(), IPC::tokenNullTypeRef()));
- IPC::encode(encoder, dictionary.get());
-}
-
-bool ArgumentCoder<ResourceResponse>::decodePlatformData(ArgumentDecoder& decoder, ResourceResponse& resourceResponse)
-{
- bool responseIsPresent;
- if (!decoder.decode(responseIsPresent))
- return false;
-
- if (!responseIsPresent) {
- resourceResponse = ResourceResponse();
- return true;
- }
-
- RetainPtr<CFDictionaryRef> dictionary;
- if (!IPC::decode(decoder, dictionary))
- return false;
-
- RetainPtr<NSURLResponse> nsURLResponse = WKNSURLResponseFromSerializableRepresentation(dictionary.get(), IPC::tokenNullTypeRef());
-
- if (!nsURLResponse)
- return false;
-
- resourceResponse = ResourceResponse(nsURLResponse.get());
- return true;
-}
-
</del><span class="cx"> void ArgumentCoder<CertificateInfo>::encode(ArgumentEncoder& encoder, const CertificateInfo& certificateInfo)
</span><span class="cx"> {
</span><span class="cx"> CFArrayRef certificateChain = certificateInfo.certificateChain();
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedsoupWebCoreArgumentCodersSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/soup/WebCoreArgumentCodersSoup.cpp (173355 => 173356)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/soup/WebCoreArgumentCodersSoup.cpp        2014-09-06 15:02:58 UTC (rev 173355)
+++ trunk/Source/WebKit2/Shared/soup/WebCoreArgumentCodersSoup.cpp        2014-09-06 15:33:06 UTC (rev 173356)
</span><span class="lines">@@ -104,20 +104,6 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void ArgumentCoder<ResourceResponse>::encodePlatformData(ArgumentEncoder& encoder, const ResourceResponse& resourceResponse)
-{
- encoder << static_cast<uint32_t>(resourceResponse.soupMessageFlags());
-}
-
-bool ArgumentCoder<ResourceResponse>::decodePlatformData(ArgumentDecoder& decoder, ResourceResponse& resourceResponse)
-{
- uint32_t soupMessageFlags;
- if (!decoder.decode(soupMessageFlags))
- return false;
- resourceResponse.setSoupMessageFlags(static_cast<SoupMessageFlags>(soupMessageFlags));
- return true;
-}
-
</del><span class="cx"> void ArgumentCoder<CertificateInfo>::encode(ArgumentEncoder& encoder, const CertificateInfo& certificateInfo)
</span><span class="cx"> {
</span><span class="cx"> if (!certificateInfo.certificate()) {
</span></span></pre>
</div>
</div>
</body>
</html>