[webkit-reviews] review granted: [Bug 183065] Introduce ITP debug logging as an opt-in developer feature : [Attachment 334548] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Feb 23 14:51:47 PST 2018


Brent Fulgham <bfulgham at webkit.org> has granted John Wilander
<wilander at apple.com>'s request for review:
Bug 183065: Introduce ITP debug logging as an opt-in developer feature
https://bugs.webkit.org/show_bug.cgi?id=183065

Attachment 334548: Patch

https://bugs.webkit.org/attachment.cgi?id=334548&action=review




--- Comment #7 from Brent Fulgham <bfulgham at webkit.org> ---
Comment on attachment 334548
  --> https://bugs.webkit.org/attachment.cgi?id=334548
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=334548&action=review

Looks good, but please reduce the duplicated code as I suggested.

> Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp:43
>  #include <wtf/NeverDestroyed.h>

You could #if !RELEASE_LOG_DISABLED this header include, which might help build
perf for non-logging builds.

> Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp:219
> +	       domainsToRemoveDataRecordsForBuilder.append(domain);

You repeat this pattern a bunch of times. I suggest making it a static
function:

static void appendWithDelimiter(StringBuilder& builder, const String& domain,
bool firstItem)
{
    if (!firstItem)
	builder.appendLiteral(", ");
    builder.append(domain);
}

Then this code would be:

StringBuilder domainsToRemoveDataRecordsForBuilder;
bool firstDomain = true;
for (auto& domain : prevalentResourceDomains) {
    appendWithDelimiter(domainsToRemoveDataRecordsForBuilder, domain,
firstDomain);
    firstDomain = false;
}


More information about the webkit-reviews mailing list