Changeset 146899 in webkit


Ignore:
Timestamp:
Mar 26, 2013 10:04:52 AM (11 years ago)
Author:
Christophe Dumez
Message:

HTTPHeaderMap::copyData() could call uncheckedAppend()
https://bugs.webkit.org/show_bug.cgi?id=113279

Reviewed by Alexey Proskuryakov.

HTTPHeaderMap::copyData() calls reserveInitialCapacity() on the Vector
but then appends items using append() function. Since we already know
the capacity is sufficient, it is more efficient to call uncheckedAppend()
instead to bypass capacity checks.

No new tests, no behavior change for layout tests.

  • platform/network/HTTPHeaderMap.cpp:

(WebCore::HTTPHeaderMap::copyData):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r146898 r146899  
     12013-03-26  Christophe Dumez  <ch.dumez@sisa.samsung.com>
     2
     3        HTTPHeaderMap::copyData() could call uncheckedAppend()
     4        https://bugs.webkit.org/show_bug.cgi?id=113279
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        HTTPHeaderMap::copyData() calls reserveInitialCapacity() on the Vector
     9        but then appends items using append() function. Since we already know
     10        the capacity is sufficient, it is more efficient to call uncheckedAppend()
     11        instead to bypass capacity checks.
     12
     13        No new tests, no behavior change for layout tests.
     14
     15        * platform/network/HTTPHeaderMap.cpp:
     16        (WebCore::HTTPHeaderMap::copyData):
     17
    1182013-03-26  Vsevolod Vlasov  <vsevik@chromium.org>
    219
  • trunk/Source/WebCore/platform/network/HTTPHeaderMap.cpp

    r130612 r146899  
    5252
    5353    HTTPHeaderMap::const_iterator end_it = end();
    54     for (HTTPHeaderMap::const_iterator it = begin(); it != end_it; ++it) {
    55         data->append(make_pair(it->key.string().isolatedCopy(), it->value.isolatedCopy()));
    56     }
     54    for (HTTPHeaderMap::const_iterator it = begin(); it != end_it; ++it)
     55        data->uncheckedAppend(make_pair(it->key.string().isolatedCopy(), it->value.isolatedCopy()));
     56
    5757    return data.release();
    5858}
Note: See TracChangeset for help on using the changeset viewer.