Diff
Modified: trunk/Source/WTF/ChangeLog (205846 => 205847)
--- trunk/Source/WTF/ChangeLog 2016-09-13 01:25:08 UTC (rev 205846)
+++ trunk/Source/WTF/ChangeLog 2016-09-13 02:12:51 UTC (rev 205847)
@@ -1,3 +1,18 @@
+2016-09-12 Chris Dumez <[email protected]>
+
+ Fix post-landing review comments after r205787
+ https://bugs.webkit.org/show_bug.cgi?id=161885
+
+ Reviewed by Darin Adler.
+
+ Add new StringBuilder::append(CFStringRef) / append(NSString*)
+ overloads to avoid an extra string copy when possible.
+
+ * wtf/text/StringBuilder.cpp:
+ (WTF::StringBuilder::append):
+ * wtf/text/StringBuilder.h:
+ (WTF::StringBuilder::append):
+
2016-09-12 Yusuke Suzuki <[email protected]>
[WTF] HashTable's rehash is not compatible to Ref<T> and ASan
Modified: trunk/Source/WTF/wtf/text/StringBuilder.cpp (205846 => 205847)
--- trunk/Source/WTF/wtf/text/StringBuilder.cpp 2016-09-13 01:25:08 UTC (rev 205846)
+++ trunk/Source/WTF/wtf/text/StringBuilder.cpp 2016-09-13 02:12:51 UTC (rev 205847)
@@ -306,6 +306,20 @@
}
}
+#if USE(CF)
+
+void StringBuilder::append(CFStringRef string)
+{
+ // Fast path: avoid constructing a temporary String when possible.
+ if (auto* characters = CFStringGetCStringPtr(string, kCFStringEncodingISOLatin1)) {
+ append(reinterpret_cast<const LChar*>(characters), CFStringGetLength(string));
+ return;
+ }
+ append(String(string));
+}
+
+#endif
+
void StringBuilder::appendNumber(int number)
{
numberToStringSigned<StringBuilder>(number, this);
Modified: trunk/Source/WTF/wtf/text/StringBuilder.h (205846 => 205847)
--- trunk/Source/WTF/wtf/text/StringBuilder.h 2016-09-13 01:25:08 UTC (rev 205846)
+++ trunk/Source/WTF/wtf/text/StringBuilder.h 2016-09-13 02:12:51 UTC (rev 205847)
@@ -101,6 +101,13 @@
else
append(stringView.characters16(), stringView.length());
}
+
+#if USE(CF)
+ WTF_EXPORT_PRIVATE void append(CFStringRef);
+#endif
+#if USE(CF) && defined(__OBJC__)
+ void append(NSString *string) { append((__bridge CFStringRef)string); }
+#endif
void append(const String& string, unsigned offset, unsigned length)
{
Modified: trunk/Source/WebCore/ChangeLog (205846 => 205847)
--- trunk/Source/WebCore/ChangeLog 2016-09-13 01:25:08 UTC (rev 205846)
+++ trunk/Source/WebCore/ChangeLog 2016-09-13 02:12:51 UTC (rev 205847)
@@ -1,3 +1,26 @@
+2016-09-12 Chris Dumez <[email protected]>
+
+ Fix post-landing review comments after r205787
+ https://bugs.webkit.org/show_bug.cgi?id=161885
+
+ Reviewed by Darin Adler.
+
+ Leverage new StringBuilder::append(CFStringRef) overload.
+
+ * html/parser/HTMLParserIdioms.cpp:
+ (WebCore::parseHTTPRefreshInternal):
+ * page/CaptionUserPreferencesMediaAF.cpp:
+ (WebCore::CaptionUserPreferencesMediaAF::captionsDefaultFontCSS):
+ (WebCore::buildDisplayStringForTrackBase):
+ * platform/network/mac/CookieJarMac.mm:
+ (WebCore::cookiesForSession):
+ * rendering/RenderThemeIOS.mm:
+ (WebCore::RenderThemeIOS::mediaControlsStyleSheet):
+ (WebCore::RenderThemeIOS::mediaControlsScript):
+ * rendering/RenderThemeMac.mm:
+ (WebCore::RenderThemeMac::mediaControlsStyleSheet):
+ (WebCore::RenderThemeMac::mediaControlsScript):
+
2016-09-12 Alex Christensen <[email protected]>
URLParser: Correctly ignore spaces before relative URLs with no scheme
Modified: trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp (205846 => 205847)
--- trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp 2016-09-13 01:25:08 UTC (rev 205846)
+++ trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp 2016-09-13 02:12:51 UTC (rev 205847)
@@ -432,7 +432,7 @@
builder.append(getPropertyNameString(CSSPropertyFontFamily));
builder.appendLiteral(": \"");
- builder.append(String(static_cast<CFStringRef>(name.get())));
+ builder.append(static_cast<CFStringRef>(name.get()));
builder.append('"');
if (behavior == kMACaptionAppearanceBehaviorUseValue)
builder.appendLiteral(" !important");
@@ -642,7 +642,7 @@
else if (!language.isEmpty())
displayName.append(language);
else
- displayName.append(String(localeIdentifier.get()));
+ displayName.append(localeIdentifier.get());
}
}
Modified: trunk/Source/WebCore/platform/network/mac/CookieJarMac.mm (205846 => 205847)
--- trunk/Source/WebCore/platform/network/mac/CookieJarMac.mm 2016-09-13 01:25:08 UTC (rev 205846)
+++ trunk/Source/WebCore/platform/network/mac/CookieJarMac.mm 2016-09-13 02:12:51 UTC (rev 205847)
@@ -155,9 +155,9 @@
if (!cookiesBuilder.isEmpty())
cookiesBuilder.appendLiteral("; ");
- cookiesBuilder.append(String([cookie name]));
+ cookiesBuilder.append([cookie name]);
cookiesBuilder.append('=');
- cookiesBuilder.append(String([cookie value]));
+ cookiesBuilder.append([cookie value]);
}
return cookiesBuilder.toString();
Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (205846 => 205847)
--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2016-09-13 01:25:08 UTC (rev 205846)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2016-09-13 02:12:51 UTC (rev 205847)
@@ -1290,11 +1290,8 @@
String RenderThemeIOS::mediaControlsStyleSheet()
{
#if ENABLE(MEDIA_CONTROLS_SCRIPT)
- if (m_mediaControlsStyleSheet.isEmpty()) {
- StringBuilder builder;
- builder.append(String([NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:@"mediaControlsiOS" ofType:@"css"] encoding:NSUTF8StringEncoding error:nil]));
- m_mediaControlsStyleSheet = builder.toString();
- }
+ if (m_mediaControlsStyleSheet.isEmpty())
+ m_mediaControlsStyleSheet = [NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:@"mediaControlsiOS" ofType:@"css"] encoding:NSUTF8StringEncoding error:nil];
return m_mediaControlsStyleSheet;
#else
return emptyString();
@@ -1306,9 +1303,10 @@
#if ENABLE(MEDIA_CONTROLS_SCRIPT)
if (m_mediaControlsScript.isEmpty()) {
StringBuilder scriptBuilder;
- scriptBuilder.append(String([NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:@"mediaControlsLocalizedStrings" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil]));
- scriptBuilder.append(String([NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:@"mediaControlsApple" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil]));
- scriptBuilder.append(String([NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:@"mediaControlsiOS" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil]));
+ NSBundle* bundle = [NSBundle bundleForClass:[WebCoreRenderThemeBundle class]];
+ scriptBuilder.append([NSString stringWithContentsOfFile:[bundle pathForResource:@"mediaControlsLocalizedStrings" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil]);
+ scriptBuilder.append([NSString stringWithContentsOfFile:[bundle pathForResource:@"mediaControlsApple" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil]);
+ scriptBuilder.append([NSString stringWithContentsOfFile:[bundle pathForResource:@"mediaControlsiOS" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil]);
m_mediaControlsScript = scriptBuilder.toString();
}
return m_mediaControlsScript;
Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (205846 => 205847)
--- trunk/Source/WebCore/rendering/RenderThemeMac.mm 2016-09-13 01:25:08 UTC (rev 205846)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm 2016-09-13 02:12:51 UTC (rev 205847)
@@ -235,7 +235,7 @@
#if ENABLE(MEDIA_CONTROLS_SCRIPT)
if (m_mediaControlsStyleSheet.isEmpty()) {
StringBuilder styleSheetBuilder;
- styleSheetBuilder.append(String([NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:@"mediaControlsApple" ofType:@"css"] encoding:NSUTF8StringEncoding error:nil]));
+ styleSheetBuilder.append([NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:@"mediaControlsApple" ofType:@"css"] encoding:NSUTF8StringEncoding error:nil]);
m_mediaControlsStyleSheet = styleSheetBuilder.toString();
}
return m_mediaControlsStyleSheet;
@@ -249,8 +249,9 @@
#if ENABLE(MEDIA_CONTROLS_SCRIPT)
if (m_mediaControlsScript.isEmpty()) {
StringBuilder scriptBuilder;
- scriptBuilder.append(String([NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:@"mediaControlsLocalizedStrings" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil]));
- scriptBuilder.append(String([NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:@"mediaControlsApple" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil]));
+ NSBundle* bundle = [NSBundle bundleForClass:[WebCoreRenderThemeBundle class]];
+ scriptBuilder.append([NSString stringWithContentsOfFile:[bundle pathForResource:@"mediaControlsLocalizedStrings" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil]);
+ scriptBuilder.append([NSString stringWithContentsOfFile:[bundle pathForResource:@"mediaControlsApple" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil]);
m_mediaControlsScript = scriptBuilder.toString();
}
return m_mediaControlsScript;
Modified: trunk/Tools/ChangeLog (205846 => 205847)
--- trunk/Tools/ChangeLog 2016-09-13 01:25:08 UTC (rev 205846)
+++ trunk/Tools/ChangeLog 2016-09-13 02:12:51 UTC (rev 205847)
@@ -1,3 +1,15 @@
+2016-09-12 Chris Dumez <[email protected]>
+
+ Fix post-landing review comments after r205787
+ https://bugs.webkit.org/show_bug.cgi?id=161885
+
+ Reviewed by Darin Adler.
+
+ Leverage new StringBuilder::append(CFStringRef) overload.
+
+ * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+ (WTR::InjectedBundlePage::dumpDOMAsWebArchive):
+
2016-09-12 Alex Christensen <[email protected]>
URLParser: Correctly ignore spaces before relative URLs with no scheme
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (205846 => 205847)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp 2016-09-13 01:25:08 UTC (rev 205846)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp 2016-09-13 02:12:51 UTC (rev 205847)
@@ -843,7 +843,7 @@
WKRetainPtr<WKDataRef> wkData = adoptWK(WKBundleFrameCopyWebArchive(frame));
RetainPtr<CFDataRef> cfData = adoptCF(CFDataCreate(0, WKDataGetBytes(wkData.get()), WKDataGetSize(wkData.get())));
RetainPtr<CFStringRef> cfString = adoptCF(createXMLStringFromWebArchiveData(cfData.get()));
- stringBuilder.append(String(cfString.get()));
+ stringBuilder.append(cfString.get());
#endif
}