[webkit-reviews] review denied: [Bug 75323] Use HashMap<OwnPtr> for UserScriptMap and UserStyleSheetMap : [Attachment 120692] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Dec 28 12:56:58 PST 2011
Darin Adler <darin at apple.com> has denied Caio Marcelo de Oliveira Filho
<cmarcelo at webkit.org>'s request for review:
Bug 75323: Use HashMap<OwnPtr> for UserScriptMap and UserStyleSheetMap
https://bugs.webkit.org/show_bug.cgi?id=75323
Attachment 120692: Patch
https://bugs.webkit.org/attachment.cgi?id=120692&action=review
------- Additional Comments from Darin Adler <darin at apple.com>
View in context: https://bugs.webkit.org/attachment.cgi?id=120692&action=review
Great to do this! A couple things to fix.
> Source/WebCore/page/PageGroup.cpp:288
> - UserScriptVector*& scriptsInWorld = m_userScripts->add(world,
0).first->second;
> - if (!scriptsInWorld)
> + UserScriptVector* scriptsInWorld = m_userScripts->get(world);
> + if (!scriptsInWorld) {
> scriptsInWorld = new UserScriptVector;
> + m_userScripts->add(world, adoptPtr(scriptsInWorld));
> + }
This adds unnecessary complexity and additional hash table lookups. You can
make a smaller change like this:
OwnPtr<UserScriptVector>& scriptsInWorld = m_userScripts->add(world,
nullptr).first->second;
if (!scriptsInWorld)
scriptsInWorld = adoptPtr(new UserScriptVector);
> Source/WebCore/page/PageGroup.cpp:307
> - UserStyleSheetVector*& styleSheetsInWorld =
m_userStyleSheets->add(world, 0).first->second;
> - if (!styleSheetsInWorld)
> + UserStyleSheetVector* styleSheetsInWorld =
m_userStyleSheets->get(world);
> + if (!styleSheetsInWorld) {
> styleSheetsInWorld = new UserStyleSheetVector;
> + m_userStyleSheets->add(world, adoptPtr(styleSheetsInWorld));
> + }
Same thing here. Just change the type to OwnPtr.
> Source/WebCore/page/PageGroup.cpp:397
> + if (m_userScripts)
> m_userScripts.clear();
No need for the if here. It’s fine to just unconditionally call clear.
More information about the webkit-reviews
mailing list