Changeset 182729 in webkit


Ignore:
Timestamp:
Apr 13, 2015 7:05:37 AM (9 years ago)
Author:
commit-queue@webkit.org
Message:

[Curl] Small improvements to CurlCacheEntry::parseResponseHeaders()
https://bugs.webkit.org/show_bug.cgi?id=143597

Patch by Sungmann Cho <sungmann.cho@navercorp.com> on 2015-04-13
Reviewed by Csaba Osztrogonác.

Most lines of code in CurlCacheEntry::parseResponseHeaders() don't need to be
executed if the response has "no-cache" or "no-store" directive, but we are
checking these conditions in the middle of the method. We can move this to the
beginning of the method for efficiency.

No new tests, no behavior change.

  • platform/network/curl/CurlCacheEntry.cpp:

(WebCore::CurlCacheEntry::parseResponseHeaders):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r182726 r182729  
     12015-04-13  Sungmann Cho  <sungmann.cho@navercorp.com>
     2
     3        [Curl] Small improvements to CurlCacheEntry::parseResponseHeaders()
     4        https://bugs.webkit.org/show_bug.cgi?id=143597
     5
     6        Reviewed by Csaba Osztrogonác.
     7
     8        Most lines of code in CurlCacheEntry::parseResponseHeaders() don't need to be
     9        executed if the response has "no-cache" or "no-store" directive, but we are
     10        checking these conditions in the middle of the method. We can move this to the
     11        beginning of the method for efficiency.
     12
     13        No new tests, no behavior change.
     14
     15        * platform/network/curl/CurlCacheEntry.cpp:
     16        (WebCore::CurlCacheEntry::parseResponseHeaders):
     17
    1182015-04-13  Sergio Villar Senin  <svillar@igalia.com>
    219
  • trunk/Source/WebCore/platform/network/curl/CurlCacheEntry.cpp

    r182571 r182729  
    274274    using namespace std::chrono;
    275275
     276    if (response.cacheControlContainsNoCache() || response.cacheControlContainsNoStore() || !response.hasCacheValidatorFields())
     277        return false;
     278
    276279    double fileTime;
    277280    time_t fileModificationDate;
    278281
    279     if (getFileModificationTime(m_headerFilename, fileModificationDate)) {
    280         fileTime = difftime(fileModificationDate, 0);
    281         fileTime *= 1000.0;
    282     } else
     282    if (getFileModificationTime(m_headerFilename, fileModificationDate))
     283        fileTime = difftime(fileModificationDate, 0) * 1000.0;
     284    else
    283285        fileTime = currentTimeMS(); // GMT
    284 
    285     if (response.cacheControlContainsNoCache() || response.cacheControlContainsNoStore())
    286         return false;
    287 
    288     if (!response.hasCacheValidatorFields())
    289         return false;
    290286
    291287    auto maxAge = response.cacheControlMaxAge();
Note: See TracChangeset for help on using the changeset viewer.