Bug 122368

Summary: Use more references instead of pointers in DocumentOrderedMap
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: New BugsAssignee: Ryosuke Niwa <rniwa>
Status: RESOLVED FIXED    
Severity: Normal CC: cmarcelo, commit-queue, esprehn+autocc, gyuyoung.kim, kangil.han
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Cleanup kling: review+

Description Ryosuke Niwa 2013-10-04 19:05:59 PDT
Use more references instead of pointers in DocumentOrderedMap
Comment 1 Ryosuke Niwa 2013-10-04 19:07:00 PDT
Created attachment 213431 [details]
Cleanup
Comment 2 Andreas Kling 2013-10-04 19:21:43 PDT
Comment on attachment 213431 [details]
Cleanup

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

Super neato! r=me

> Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp:76
> +    Node* node = document->documentNamedItem(*atomicPropertyName);

This should be an Element*. That'll remove a branch from hasTagName() below.

> Source/WebCore/dom/DocumentOrderedMap.cpp:109
> +    Map::iterator it = m_map.find(&key);

I'd use auto for this.

> Source/WebCore/dom/DocumentOrderedMap.cpp:130
> +    Map::iterator it = m_map.find(&key);

Ditto.

> Source/WebCore/dom/DocumentOrderedMap.cpp:194
> +    Map::iterator it = m_map.find(&key);

Ditto.

> Source/WebCore/dom/DocumentOrderedMap.h:96
> +    Map::const_iterator it = m_map.find(&id);

Ditto.

> Source/WebCore/dom/DocumentOrderedMap.h:107
> +    Map::const_iterator it = m_map.find(&id);

Ditto.
Comment 3 Ryosuke Niwa 2013-10-04 19:22:24 PDT
Comment on attachment 213431 [details]
Cleanup

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

> Source/WebCore/dom/IdTargetObserverRegistry.h:67
>      ASSERT(!m_notifyingObserversInSet);

Oops, I need to assert that id is not empty here.

> Source/WebCore/dom/TreeScope.cpp:244
> +        return m_imageMapsByName->getElementByLowercasedMapName(*AtomicString(name.lower()).impl(), *this);
> +    return m_imageMapsByName->getElementByMapName(*AtomicString(name).impl(), *this);

We should store AtomicString in a local variable here.
Comment 4 Ryosuke Niwa 2013-10-04 19:58:22 PDT
Committed r156940: <http://trac.webkit.org/changeset/156940>