<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):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@164198
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2014-02-16 Andreas Kling <akling@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 <mitz@apple.com>
Speculative iOS build fix.
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;
// 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();
// 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) {
// 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();