[webkit-reviews] review granted: [Bug 107807] Make the existing HTMLPreloadScanner threading-aware : [Attachment 184904] should build on Mac and win now

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Jan 27 11:11:14 PST 2013


Adam Barth <abarth at webkit.org> has granted Eric Seidel <eric at webkit.org>'s
request for review:
Bug 107807: Make the existing HTMLPreloadScanner threading-aware
https://bugs.webkit.org/show_bug.cgi?id=107807

Attachment 184904: should build on Mac and win now
https://bugs.webkit.org/attachment.cgi?id=184904&action=review

------- Additional Comments from Adam Barth <abarth at webkit.org>
View in context: https://bugs.webkit.org/attachment.cgi?id=184904&action=review


This looks great.

> Source/WebCore/html/parser/CSSPreloadScanner.cpp:201
> +		   cachedResourceRequestInitiators().css, url, baseElementURL,
CachedResource::CSSStyleSheet);

Is cachedResourceRequestInitiators().css safe to call on a background thread?

> Source/WebCore/html/parser/HTMLPreloadScanner.cpp:56
> +static bool threadSafeEqual(StringImpl* a, StringImpl* b)
> +{
> +    if (a->hash() != b->hash())
> +	   return false;
> +    return StringHash::equal(a, b);
> +}
> +
> +static bool threadSafeMatch(const String& localName, const QualifiedName&
qName)
> +{
> +    return threadSafeEqual(localName.impl(), qName.localName().impl());
> +}

We should share this code instead of duplicating it.

> Source/WebCore/html/parser/HTMLPreloadScanner.cpp:183
> +    void issuePreloadRequest(WeakPtr<HTMLResourcePreloader>& preloader,
const KURL& predictedBaseURL)

const reference?

> Source/WebCore/html/parser/HTMLPreloadScanner.cpp:310
> +    AtomicString tagName(token.name().data(), token.name().size());

We might want to use a regular string here.  It's not clear to me whether we
want to boot up an atomic string table on the background thread, especially in
the world where we're using a threadpool.

> Source/WebCore/html/parser/HTMLResourcePreloader.cpp:44
> +static bool isStringSafeToSendToAnotherThread(const String& string)
> +{
> +    StringImpl* impl = string.impl();
> +    if (!impl)
> +	   return true;
> +    if (impl->hasOneRef())
> +	   return true;
> +    if (string.isEmpty())
> +	   return true;
> +    return false;
> +}

We should share this code instead of duplicating it.

> Source/WebCore/html/parser/HTMLResourcePreloader.h:40
> +    bool isSafeToSendToAnotherThread() const;

Should this be #ifndef NDEBUG?


More information about the webkit-reviews mailing list