Bug 143619 - Stop referring to outdated RFC2616 in CacheValidation.cpp
Summary: Stop referring to outdated RFC2616 in CacheValidation.cpp
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-10 14:28 PDT by Chris Dumez
Modified: 2015-04-11 11:26 PDT (History)
4 users (show)

See Also:


Attachments
Patch (7.36 KB, patch)
2015-04-10 14:30 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (6.06 KB, patch)
2015-04-11 10:37 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2015-04-10 14:28:06 PDT
Stop referring to outdated RFC2616 in CacheValidation.cpp and refer to the newer RFC7230 & RFC7234.
Comment 1 Chris Dumez 2015-04-10 14:30:39 PDT
Created attachment 250535 [details]
Patch
Comment 2 Darin Adler 2015-04-11 08:44:52 PDT
Comment on attachment 250535 [details]
Patch

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

> Source/WebCore/platform/network/CacheValidation.h:51
> +WEBCORE_EXPORT std::chrono::microseconds computeCurrentAge(const ResourceResponse&, const std::chrono::system_clock::time_point& responseTimestamp);
> +WEBCORE_EXPORT std::chrono::microseconds computeFreshnessLifetimeForHTTPFamily(const ResourceResponse&, const std::chrono::system_clock::time_point& responseTimestamp);

Do we really want to change to const time_point&? Anders has pushed me to actually pass objects rather than references for modest-sized structures in the recent past, so maybe that applies here.
Comment 3 Chris Dumez 2015-04-11 10:34:52 PDT
Comment on attachment 250535 [details]
Patch

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

>> Source/WebCore/platform/network/CacheValidation.h:51
>> +WEBCORE_EXPORT std::chrono::microseconds computeFreshnessLifetimeForHTTPFamily(const ResourceResponse&, const std::chrono::system_clock::time_point& responseTimestamp);
> 
> Do we really want to change to const time_point&? Anders has pushed me to actually pass objects rather than references for modest-sized structures in the recent past, so maybe that applies here.

I have just verified that std::chrono::system_clock::time_point is only 8 bytes on my machine, so you are likely right. I'll revert this change.
Comment 4 Chris Dumez 2015-04-11 10:37:26 PDT
Created attachment 250574 [details]
Patch
Comment 5 Chris Dumez 2015-04-11 11:04:32 PDT
FYI, I confirmed locally that passing by value here seems slightly faster on my MacBook Pro (lower is better):

size: 8 bytes
by_ref: 348884550
by_value: 341103395 (~2.2% faster)

Benchmark: http://pastebin.com/UNmezmER
// clang++ -std=c++11 -O3 test.cpp
Comment 6 WebKit Commit Bot 2015-04-11 11:26:48 PDT
Comment on attachment 250574 [details]
Patch

Clearing flags on attachment: 250574

Committed r182659: <http://trac.webkit.org/changeset/182659>
Comment 7 WebKit Commit Bot 2015-04-11 11:26:54 PDT
All reviewed patches have been landed.  Closing bug.