⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 175949 in webkit


Ignore:
Timestamp:
Nov 11, 2014, 9:40:07 AM (12 years ago)
Author:
Carlos Garcia Campos
Message:

Merge r175602 - Avoid double hash table lookup in SpaceSplitStringData::create()
https://bugs.webkit.org/show_bug.cgi?id=138396

Reviewed by Ryosuke Niwa.

Avoid double hash table lookup in SpaceSplitStringData::create() by
calling HashMap::add() and using the AddResult, instead of calling
HashMap::get() then HashMap::add().

No new tests, no behavior change.

  • dom/SpaceSplitString.cpp:

(WebCore::SpaceSplitStringData::create):

Location:
releases/WebKitGTK/webkit-2.6/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog

    r175948 r175949  
     12014-11-04  Chris Dumez  <cdumez@apple.com>
     2
     3        Avoid double hash table lookup in SpaceSplitStringData::create()
     4        https://bugs.webkit.org/show_bug.cgi?id=138396
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Avoid double hash table lookup in SpaceSplitStringData::create() by
     9        calling HashMap::add() and using the AddResult, instead of calling
     10        HashMap::get() then HashMap::add().
     11
     12        No new tests, no behavior change.
     13
     14        * dom/SpaceSplitString.cpp:
     15        (WebCore::SpaceSplitStringData::create):
     16
    1172014-11-04  Andreas Kling  <akling@apple.com>
    218
  • releases/WebKitGTK/webkit-2.6/Source/WebCore/dom/SpaceSplitString.cpp

    r169358 r175949  
    193193    ASSERT(!keyString.isNull());
    194194
    195     auto& table = spaceSplitStringTable();
    196     if (SpaceSplitStringData* data = table.get(keyString))
    197         return data;
     195    auto addResult = spaceSplitStringTable().add(keyString, nullptr);
     196    if (!addResult.isNewEntry)
     197        return addResult.iterator->value;
    198198
    199199    // Nothing in the cache? Let's create a new SpaceSplitStringData if the input has something useful.
     
    207207
    208208    RefPtr<SpaceSplitStringData> spaceSplitStringData = create(keyString, tokenCount);
    209     table.add(keyString, spaceSplitStringData.get());
     209    addResult.iterator->value = spaceSplitStringData.get();
    210210    return spaceSplitStringData.release();
    211211}
Note: See TracChangeset for help on using the changeset viewer.