Title: [164198] trunk/Source/WebCore
Revision
164198
Author
akl...@apple.com
Date
2014-02-16 14:59:55 -0800 (Sun, 16 Feb 2014)

Log Message

Atomicize frequently identical ResourceResponse string members.
<https://webkit.org/b/128887>

Store the mime type, text encoding and HTTP response status text in
AtomicStrings instead of Strings to deduplicate frequently occurring
values (e.g "text/html", "utf-8" and "OK".)

Reviewed by Geoffrey Garen.

* platform/network/ResourceResponseBase.h:
* platform/network/cf/ResourceResponseCFNet.cpp:
(WebCore::ResourceResponse::cfURLResponse):
(WebCore::ResourceResponse::platformLazyInit):
* platform/network/mac/ResourceResponseMac.mm:
(WebCore::ResourceResponse::platformLazyInit):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (164197 => 164198)


--- trunk/Source/WebCore/ChangeLog	2014-02-16 22:45:13 UTC (rev 164197)
+++ trunk/Source/WebCore/ChangeLog	2014-02-16 22:59:55 UTC (rev 164198)
@@ -1,3 +1,21 @@
+2014-02-16  Andreas Kling  <akl...@apple.com>
+
+        Atomicize frequently identical ResourceResponse string members.
+        <https://webkit.org/b/128887>
+
+        Store the mime type, text encoding and HTTP response status text in
+        AtomicStrings instead of Strings to deduplicate frequently occurring
+        values (e.g "text/html", "utf-8" and "OK".)
+
+        Reviewed by Geoffrey Garen.
+
+        * platform/network/ResourceResponseBase.h:
+        * platform/network/cf/ResourceResponseCFNet.cpp:
+        (WebCore::ResourceResponse::cfURLResponse):
+        (WebCore::ResourceResponse::platformLazyInit):
+        * platform/network/mac/ResourceResponseMac.mm:
+        (WebCore::ResourceResponse::platformLazyInit):
+
 2014-02-16  Dan Bernstein  <m...@apple.com>
 
         Speculative iOS build fix.

Modified: trunk/Source/WebCore/platform/network/ResourceResponseBase.h (164197 => 164198)


--- trunk/Source/WebCore/platform/network/ResourceResponseBase.h	2014-02-16 22:45:13 UTC (rev 164197)
+++ trunk/Source/WebCore/platform/network/ResourceResponseBase.h	2014-02-16 22:59:55 UTC (rev 164198)
@@ -141,11 +141,11 @@
     static bool platformCompare(const ResourceResponse&, const ResourceResponse&) { return true; }
 
     URL m_url;
-    String m_mimeType;
+    AtomicString m_mimeType;
     long long m_expectedContentLength;
-    String m_textEncodingName;
+    AtomicString m_textEncodingName;
     String m_suggestedFilename;
-    String m_httpStatusText;
+    AtomicString m_httpStatusText;
     HTTPHeaderMap m_httpHeaderFields;
     RefPtr<ResourceLoadTiming> m_resourceLoadTiming;
 

Modified: trunk/Source/WebCore/platform/network/cf/ResourceResponseCFNet.cpp (164197 => 164198)


--- trunk/Source/WebCore/platform/network/cf/ResourceResponseCFNet.cpp	2014-02-16 22:45:13 UTC (rev 164197)
+++ trunk/Source/WebCore/platform/network/cf/ResourceResponseCFNet.cpp	2014-02-16 22:59:55 UTC (rev 164198)
@@ -52,7 +52,7 @@
 
         // FIXME: This creates a very incomplete CFURLResponse, which does not even have a status code.
 
-        m_cfResponse = adoptCF(CFURLResponseCreate(0, url.get(), m_mimeType.createCFString().get(), m_expectedContentLength, m_textEncodingName.createCFString().get(), kCFURLCacheStorageAllowed));
+        m_cfResponse = adoptCF(CFURLResponseCreate(0, url.get(), m_mimeType.string().createCFString().get(), m_expectedContentLength, m_textEncodingName.string().createCFString().get(), kCFURLCacheStorageAllowed));
     }
 
     return m_cfResponse.get();
@@ -75,7 +75,7 @@
         // Workaround for <rdar://problem/8757088>, can be removed once that is fixed.
         unsigned textEncodingNameLength = m_textEncodingName.length();
         if (textEncodingNameLength >= 2 && m_textEncodingName[0U] == '"' && m_textEncodingName[textEncodingNameLength - 1] == '"')
-            m_textEncodingName = m_textEncodingName.substring(1, textEncodingNameLength - 2);
+            m_textEncodingName = m_textEncodingName.string().substring(1, textEncodingNameLength - 2);
 
         CFHTTPMessageRef httpResponse = CFURLResponseGetHTTPResponse(m_cfResponse.get());
         if (httpResponse) {

Modified: trunk/Source/WebCore/platform/network/mac/ResourceResponseMac.mm (164197 => 164198)


--- trunk/Source/WebCore/platform/network/mac/ResourceResponseMac.mm	2014-02-16 22:45:13 UTC (rev 164197)
+++ trunk/Source/WebCore/platform/network/mac/ResourceResponseMac.mm	2014-02-16 22:59:55 UTC (rev 164198)
@@ -120,7 +120,7 @@
         // Workaround for <rdar://problem/8757088>, can be removed once that is fixed.
         unsigned textEncodingNameLength = m_textEncodingName.length();
         if (textEncodingNameLength >= 2 && m_textEncodingName[0U] == '"' && m_textEncodingName[textEncodingNameLength - 1] == '"')
-            m_textEncodingName = m_textEncodingName.substring(1, textEncodingNameLength - 2);
+            m_textEncodingName = m_textEncodingName.string().substring(1, textEncodingNameLength - 2);
 
         if ([m_nsResponse.get() isKindOfClass:[NSHTTPURLResponse class]]) {
             NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)m_nsResponse.get();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to