Title: [232267] trunk/Source/WebCore
- Revision
- 232267
- Author
- [email protected]
- Date
- 2018-05-29 11:24:52 -0700 (Tue, 29 May 2018)
Log Message
Do even fewer allocations in URL host operations
https://bugs.webkit.org/show_bug.cgi?id=186003
Patch by Alex Christensen <[email protected]> on 2018-05-29
Reviewed by Geoffrey Garen.
* loader/ResourceLoadStatistics.cpp:
(WebCore::ResourceLoadStatistics::primaryDomain):
* loader/ResourceLoadStatistics.h:
* platform/URL.cpp:
(WebCore::URL::hostIsIPAddress):
* platform/URL.h:
* platform/mac/URLMac.mm:
(WebCore::URL::hostIsIPAddress):
* platform/soup/URLSoup.cpp:
(WebCore::URL::hostIsIPAddress):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (232266 => 232267)
--- trunk/Source/WebCore/ChangeLog 2018-05-29 18:10:55 UTC (rev 232266)
+++ trunk/Source/WebCore/ChangeLog 2018-05-29 18:24:52 UTC (rev 232267)
@@ -1,3 +1,21 @@
+2018-05-29 Alex Christensen <[email protected]>
+
+ Do even fewer allocations in URL host operations
+ https://bugs.webkit.org/show_bug.cgi?id=186003
+
+ Reviewed by Geoffrey Garen.
+
+ * loader/ResourceLoadStatistics.cpp:
+ (WebCore::ResourceLoadStatistics::primaryDomain):
+ * loader/ResourceLoadStatistics.h:
+ * platform/URL.cpp:
+ (WebCore::URL::hostIsIPAddress):
+ * platform/URL.h:
+ * platform/mac/URLMac.mm:
+ (WebCore::URL::hostIsIPAddress):
+ * platform/soup/URLSoup.cpp:
+ (WebCore::URL::hostIsIPAddress):
+
2018-05-29 Tadeu Zagallo <[email protected]>
Don't assert on m_actionsStart when setting actions on DFA nodes
Modified: trunk/Source/WebCore/loader/ResourceLoadStatistics.cpp (232266 => 232267)
--- trunk/Source/WebCore/loader/ResourceLoadStatistics.cpp 2018-05-29 18:10:55 UTC (rev 232266)
+++ trunk/Source/WebCore/loader/ResourceLoadStatistics.cpp 2018-05-29 18:24:52 UTC (rev 232267)
@@ -333,22 +333,23 @@
String ResourceLoadStatistics::primaryDomain(const URL& url)
{
- return primaryDomain(url.host().toString());
+ return primaryDomain(url.host());
}
-String ResourceLoadStatistics::primaryDomain(const String& host)
+String ResourceLoadStatistics::primaryDomain(StringView host)
{
if (host.isNull() || host.isEmpty())
return ASCIILiteral("nullOrigin");
+ String hostString = host.toString();
#if ENABLE(PUBLIC_SUFFIX_LIST)
- String primaryDomain = topPrivatelyControlledDomain(host);
+ String primaryDomain = topPrivatelyControlledDomain(hostString);
// We will have an empty string here if there is no TLD. Use the host as a fallback.
if (!primaryDomain.isEmpty())
return primaryDomain;
#endif
- return host;
+ return hostString;
}
}
Modified: trunk/Source/WebCore/loader/ResourceLoadStatistics.h (232266 => 232267)
--- trunk/Source/WebCore/loader/ResourceLoadStatistics.h 2018-05-29 18:10:55 UTC (rev 232266)
+++ trunk/Source/WebCore/loader/ResourceLoadStatistics.h 2018-05-29 18:24:52 UTC (rev 232267)
@@ -51,7 +51,7 @@
ResourceLoadStatistics& operator=(ResourceLoadStatistics&&) = default;
WEBCORE_EXPORT static String primaryDomain(const URL&);
- WEBCORE_EXPORT static String primaryDomain(const String& host);
+ WEBCORE_EXPORT static String primaryDomain(StringView host);
WEBCORE_EXPORT void encode(KeyedEncoder&) const;
WEBCORE_EXPORT bool decode(KeyedDecoder&, unsigned modelVersion);
Modified: trunk/Source/WebCore/platform/URL.cpp (232266 => 232267)
--- trunk/Source/WebCore/platform/URL.cpp 2018-05-29 18:10:55 UTC (rev 232266)
+++ trunk/Source/WebCore/platform/URL.cpp 2018-05-29 18:24:52 UTC (rev 232267)
@@ -1060,7 +1060,7 @@
}
#if !PLATFORM(COCOA) && !USE(SOUP)
-bool URL::hostIsIPAddress(const String& host)
+bool URL::hostIsIPAddress(StringView host)
{
// Assume that any host that ends with a digit is trying to be an IP address.
return !host.isEmpty() && isASCIIDigit(host[host.length() - 1]);
Modified: trunk/Source/WebCore/platform/URL.h (232266 => 232267)
--- trunk/Source/WebCore/platform/URL.h 2018-05-29 18:10:55 UTC (rev 232266)
+++ trunk/Source/WebCore/platform/URL.h 2018-05-29 18:24:52 UTC (rev 232267)
@@ -176,7 +176,7 @@
unsigned hostStart() const;
unsigned hostEnd() const;
- WEBCORE_EXPORT static bool hostIsIPAddress(const String&);
+ WEBCORE_EXPORT static bool hostIsIPAddress(StringView);
unsigned pathStart() const;
unsigned pathEnd() const;
Modified: trunk/Source/WebCore/platform/mac/URLMac.mm (232266 => 232267)
--- trunk/Source/WebCore/platform/mac/URLMac.mm 2018-05-29 18:10:55 UTC (rev 232266)
+++ trunk/Source/WebCore/platform/mac/URLMac.mm 2018-05-29 18:24:52 UTC (rev 232267)
@@ -79,9 +79,9 @@
return createCFURLFromBuffer(buffer.data(), buffer.size());
}
-bool URL::hostIsIPAddress(const String& host)
+bool URL::hostIsIPAddress(StringView host)
{
- return [host _web_looksLikeIPAddress];
+ return [host.createNSStringWithoutCopying().get() _web_looksLikeIPAddress];
}
}
Modified: trunk/Source/WebCore/platform/soup/URLSoup.cpp (232266 => 232267)
--- trunk/Source/WebCore/platform/soup/URLSoup.cpp 2018-05-29 18:10:55 UTC (rev 232266)
+++ trunk/Source/WebCore/platform/soup/URLSoup.cpp 2018-05-29 18:24:52 UTC (rev 232267)
@@ -66,7 +66,7 @@
return GUniquePtr<SoupURI>(soup_uri_new(string().utf8().data()));
}
-bool URL::hostIsIPAddress(const String& host)
+bool URL::hostIsIPAddress(StringView host)
{
return !host.isEmpty() && g_hostname_is_ip_address(host.utf8().data());
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes