Summary: | Use static AtomicStrings for HTTP header field names | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Yong Li <yong.li.webkit> | ||||||
Component: | Page Loading | Assignee: | Nobody <webkit-unassigned> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | andersca, ap, darin | ||||||
Priority: | P2 | ||||||||
Version: | 528+ (Nightly build) | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Attachments: |
|
Description
Yong Li
2012-08-10 11:38:10 PDT
Created attachment 157772 [details]
Not ready for review yet.
Comment on attachment 157772 [details]
Not ready for review yet.
oops. not this one
Created attachment 157774 [details]
not ready for review
is it worth doing? Comment on attachment 157774 [details] not ready for review View in context: https://bugs.webkit.org/attachment.cgi?id=157774&action=review I don't know. Probably not much harm, and not much good. Note however that the current patch is strictly a regression. These AtomicStrings have a regular hash pre-calculated, but HashMap uses CaseFoldingHash. So, the pre-caclculated hash will not be used. Generally, it's much easier to start with profiler data and optimize that's taking significant time than to figure out whether a random change improves performance. > Source/WebCore/platform/network/ResourceRequestBase.cpp:43 > +AtomicString* ResourceRequestBase::headerNameAccept = new AtomicString("Accept"); This is not OK - we can not have global with initializers. No code should be run when WebKit shared library loads. You'll probably need a new file similar to HTMLNames.h. (In reply to comment #5) > (From update of attachment 157774 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=157774&action=review > > I don't know. Probably not much harm, and not much good. > > Note however that the current patch is strictly a regression. These AtomicStrings have a regular hash pre-calculated, but HashMap uses CaseFoldingHash. So, the pre-caclculated hash will not be used. Bang! I forgot this.. > > > Source/WebCore/platform/network/ResourceRequestBase.cpp:43 > > +AtomicString* ResourceRequestBase::headerNameAccept = new AtomicString("Accept"); > > This is not OK - we can not have global with initializers. No code should be run when WebKit shared library loads. > > You'll probably need a new file similar to HTMLNames.h. Thanks! This has been fixed; we now use an enum for header names. An enum? I wasn't watching these patches carefully, how does that support arbitrary header field names (exposed via XMLHttpRequest)? (In reply to comment #8) > An enum? I wasn't watching these patches carefully, how does that support arbitrary header field names (exposed via XMLHttpRequest)? We use an enum for the common header types and regular strings for other headers. |