WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
137797
ResourceRequest deserialization unnecessarily calls partitionName() on encoded cache partition
https://bugs.webkit.org/show_bug.cgi?id=137797
Summary
ResourceRequest deserialization unnecessarily calls partitionName() on encode...
Chris Dumez
Reported
2014-10-16 16:45:47 PDT
ResourceRequest deserialization unnecessarily calls partitionName() on encoded cache partition. In the deserialization case, we already know the cache partition is a valid partition name so we should bypass the call to partitionName() for performance. This is likely a regression from <
http://trac.webkit.org/changeset/145161
>.
Attachments
Patch
(4.37 KB, patch)
2014-10-16 17:02 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(4.36 KB, patch)
2014-10-17 14:26 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(16.77 KB, patch)
2014-10-20 17:08 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Chris Dumez
Comment 1
2014-10-16 17:02:18 PDT
Created
attachment 239984
[details]
Patch
Vicki Pfau
Comment 2
2014-10-17 14:15:25 PDT
Not exactly a regression. The deserialization of the cache partition was added in <
http://trac.webkit.org/changeset/146544
>, after that commit. I'm a little leery of adding an argument to setCachePartition, but it doesn't look like there's much way around that. Also, isn't there a better place in the class to place the enum definition than between two function definitions? Other than that minor nitpick, this looks good.
Chris Dumez
Comment 3
2014-10-17 14:22:35 PDT
(In reply to
comment #2
)
> Not exactly a regression. The deserialization of the cache partition was > added in <
http://trac.webkit.org/changeset/146544
>, after that commit.
Right, sorry about that. I did not look much further, just saw that the patch made the argument processing mandatory by moving it from the callers to the method implementation.
> > I'm a little leery of adding an argument to setCachePartition, but it > doesn't look like there's much way around that. Also, isn't there a better > place in the class to place the enum definition than between two function > definitions?
I see 3 possibilities: 1. Add an enum / bool argument as I did 2. Add a new setter without the argument processing. I initially wanted to do this but did not know how to call it. 3. Move the partitionName() to calls sites but I assumed we did not want to do that since it was this way and we changed it. I am honestly OK with 1 or 2 if someone has a good name for the new setter.
Chris Dumez
Comment 4
2014-10-17 14:22:35 PDT
(In reply to
comment #2
)
> Not exactly a regression. The deserialization of the cache partition was > added in <
http://trac.webkit.org/changeset/146544
>, after that commit.
Right, sorry about that. I did not look much further, just saw that the patch made the argument processing mandatory by moving it from the callers to the method implementation.
> > I'm a little leery of adding an argument to setCachePartition, but it > doesn't look like there's much way around that. Also, isn't there a better > place in the class to place the enum definition than between two function > definitions?
I see 3 possibilities: 1. Add an enum / bool argument as I did 2. Add a new setter without the argument processing. I initially wanted to do this but did not know how to call it. 3. Move the partitionName() to calls sites but I assumed we did not want to do that since it was this way and we changed it. I am honestly OK with 1 or 2 if someone has a good name for the new setter.
Chris Dumez
Comment 5
2014-10-17 14:26:25 PDT
Created
attachment 240039
[details]
Patch
Alexey Proskuryakov
Comment 6
2014-10-20 10:19:02 PDT
Comment on
attachment 240039
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=240039&action=review
> Source/WebCore/platform/network/cf/ResourceRequest.h:-102 > + enum CachePartitionNeedsValidationOrNot { CachePartitionDoesNotNeedValidation, CachePartitionNeedsValidation }; > + void setCachePartition(const String& cachePartition, CachePartitionNeedsValidationOrNot needsValidation = CachePartitionNeedsValidation) > + { > + m_cachePartition = needsValidation ? partitionName(cachePartition) : cachePartition; > + } > const String& cachePartition() const { return m_cachePartition.isNull() ? emptyString() : m_cachePartition; } > - void setCachePartition(const String& cachePartition) { m_cachePartition = partitionName(cachePartition); }
The existing code is semantically wrong. This function doesn't take a partition name, it takes a domain name. Both happen to be String objects and to follow a domain name format, but this is accidental, and only confuses matters. Domains and partition names are different things, and should never be confused. So it's not about validation, it's about making a partition name from a domain name. Talking about a better design on IRC now - I think that we should have setCachePartition be a simple setter (perhaps with as ASSERT), and callers would create a partition name from domain name.
Chris Dumez
Comment 7
2014-10-20 17:08:34 PDT
Created
attachment 240157
[details]
Patch
Chris Dumez
Comment 8
2014-10-20 17:09:24 PDT
New proposal including refactoring of the existing code, after discussing this over with Alexey and Jeffrey.
WebKit Commit Bot
Comment 9
2014-10-20 19:10:47 PDT
Comment on
attachment 240157
[details]
Patch Clearing flags on attachment: 240157 Committed
r174921
: <
http://trac.webkit.org/changeset/174921
>
WebKit Commit Bot
Comment 10
2014-10-20 19:10:54 PDT
All reviewed patches have been landed. Closing bug.
Jer Noble
Comment 11
2014-10-21 14:05:14 PDT
(In reply to
comment #10
)
> All reviewed patches have been landed. Closing bug.
This caused a link failure due to the renaming of cachePartition. WebCore.exp.in needs to be updated to match the new name.
Chris Dumez
Comment 12
2014-10-21 14:07:57 PDT
(In reply to
comment #11
)
> (In reply to
comment #10
) > > All reviewed patches have been landed. Closing bug. > > This caused a link failure due to the renaming of cachePartition. > WebCore.exp.in needs to be updated to match the new name.
I fixed that a while ago:
https://trac.webkit.org/r174994
https://trac.webkit.org/r174995
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug