WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
119390
Remove dependency on CoreFoundation from WebURLResponse
https://bugs.webkit.org/show_bug.cgi?id=119390
Summary
Remove dependency on CoreFoundation from WebURLResponse
Patrick R. Gansterer
Reported
2013-08-01 04:59:01 PDT
Remove dependency on CoreFoundation from WebURLResponse
Attachments
Patch
(1.54 KB, patch)
2013-08-01 05:00 PDT
,
Patrick R. Gansterer
no flags
Details
Formatted Diff
Diff
Patch
(1.68 KB, patch)
2013-08-05 14:41 PDT
,
Patrick R. Gansterer
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Patrick R. Gansterer
Comment 1
2013-08-01 05:00:10 PDT
Created
attachment 207913
[details]
Patch
Brent Fulgham
Comment 2
2013-08-02 08:53:54 PDT
Comment on
attachment 207913
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=207913&action=review
This is really more a renaming than actually removing a dependency (I guess the CFIndex type definition might have forced a CoreFoundation reference). Looks fine to me. Was there a CoreFoundation include that could be removed here as well?
> Source/WebKit/win/WebURLResponse.cpp:375 > + String statusText = localizedShortDescriptionForStatusCode(statusCode);
Seems like this could be "const String& statusText" = ...; might allow return-value-optimization.
Patrick R. Gansterer
Comment 3
2013-08-02 09:53:00 PDT
Comment on
attachment 207913
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=207913&action=review
>> Source/WebKit/win/WebURLResponse.cpp:375 >> + String statusText = localizedShortDescriptionForStatusCode(statusCode); > > Seems like this could be "const String& statusText" = ...; might allow return-value-optimization.
but then i need to change the whole function implementation, do you think it makes sense for this function? imho it's not called so often...
Brent Fulgham
Comment 4
2013-08-02 10:27:35 PDT
Comment on
attachment 207913
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=207913&action=review
>>> Source/WebKit/win/WebURLResponse.cpp:375 >>> + String statusText = localizedShortDescriptionForStatusCode(statusCode); >> >> Seems like this could be "const String& statusText" = ...; might allow return-value-optimization. > > but then i need to change the whole function implementation, do you think it makes sense for this function? imho it's not called so often...
What? Why? Does the BString constructor want a non-const String argument?
Patrick R. Gansterer
Comment 5
2013-08-02 11:53:11 PDT
(In reply to
comment #4
)
> (From update of
attachment 207913
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=207913&action=review
> > >>> Source/WebKit/win/WebURLResponse.cpp:375 > >>> + String statusText = localizedShortDescriptionForStatusCode(statusCode); > >> > >> Seems like this could be "const String& statusText" = ...; might allow return-value-optimization. > > > > but then i need to change the whole function implementation, do you think it makes sense for this function? imho it's not called so often... > > What? Why? Does the BString constructor want a non-const String argument?
AFAIK WEB_UI_STRING returns String by value and not as a const reference (
http://trac.webkit.org/browser/trunk/Source/WebCore/platform/LocalizedStrings.h?rev=152117#L263
), so we must return String by value. Maybe it's already too late for me today and I can't find my C++ knowledge about return values and object lifetime. :-) BString is good with a const reference.
Brent Fulgham
Comment 6
2013-08-02 13:17:58 PDT
Comment on
attachment 207913
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=207913&action=review
>>>>> Source/WebKit/win/WebURLResponse.cpp:375 >>>>> + String statusText = localizedShortDescriptionForStatusCode(statusCode); >>>> >>>> Seems like this could be "const String& statusText" = ...; might allow return-value-optimization. >>> >>> but then i need to change the whole function implementation, do you think it makes sense for this function? imho it's not called so often... >> >> What? Why? Does the BString constructor want a non-const String argument? > > AFAIK WEB_UI_STRING returns String by value and not as a const reference (
http://trac.webkit.org/browser/trunk/Source/WebCore/platform/LocalizedStrings.h?rev=152117#L263
), so we must return String by value. > Maybe it's already too late for me today and I can't find my C++ knowledge about return values and object lifetime. :-) > BString is good with a const reference.
Right. But under C++03 and newer, when you bind a temporary return value to a const reference, the compiler extends the lifetime of the return value to the lifetime of the const reference. See
http://herbsutter.com/2008/01/01/gotw-88-a-candidate-for-the-most-important-const/
for a brief overview.
Patrick R. Gansterer
Comment 7
2013-08-05 14:41:32 PDT
Created
attachment 208149
[details]
Patch
Patrick R. Gansterer
Comment 8
2013-08-05 14:48:26 PDT
(In reply to
comment #6
)
> (From update of
attachment 207913
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=207913&action=review
> > >>>>> Source/WebKit/win/WebURLResponse.cpp:375 > >>>>> + String statusText = localizedShortDescriptionForStatusCode(statusCode); > >>>> > >>>> Seems like this could be "const String& statusText" = ...; might allow return-value-optimization. > >>> > >>> but then i need to change the whole function implementation, do you think it makes sense for this function? imho it's not called so often... > >> > >> What? Why? Does the BString constructor want a non-const String argument? > > > > AFAIK WEB_UI_STRING returns String by value and not as a const reference (
http://trac.webkit.org/browser/trunk/Source/WebCore/platform/LocalizedStrings.h?rev=152117#L263
), so we must return String by value. > > Maybe it's already too late for me today and I can't find my C++ knowledge about return values and object lifetime. :-) > > BString is good with a const reference. > > Right. But under C++03 and newer, when you bind a temporary return value to a const reference, the compiler extends the lifetime of the return value to the lifetime of the const reference. See
http://herbsutter.com/2008/01/01/gotw-88-a-candidate-for-the-most-important-const/
for a brief overview.
Sorry, I though about changing the return value to const ref... My fault!
WebKit Commit Bot
Comment 9
2013-08-07 00:18:38 PDT
Comment on
attachment 208149
[details]
Patch Clearing flags on attachment: 208149 Committed
r153779
: <
http://trac.webkit.org/changeset/153779
>
WebKit Commit Bot
Comment 10
2013-08-07 00:18:39 PDT
All reviewed patches have been landed. Closing bug.
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