WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
153229
Remove PassRefPtr from ResourceRequest and FormData
https://bugs.webkit.org/show_bug.cgi?id=153229
Summary
Remove PassRefPtr from ResourceRequest and FormData
youenn fablet
Reported
2016-01-19 02:39:07 PST
Remove PassRefPtr from ResourceRequest and FormData
Attachments
Patch
(26.08 KB, patch)
2016-01-19 03:01 PST
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Removing clearHTTPBody
(25.21 KB, patch)
2016-01-21 04:45 PST
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Updated according review
(28.06 KB, patch)
2016-01-21 06:50 PST
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch for landing
(28.13 KB, patch)
2016-01-22 01:42 PST
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch for landing
(28.04 KB, patch)
2016-01-22 01:57 PST
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch for landing with mac build fix
(28.05 KB, patch)
2016-01-22 05:52 PST
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Show Obsolete
(5)
View All
Add attachment
proposed patch, testcase, etc.
youenn fablet
Comment 1
2016-01-19 03:01:45 PST
Created
attachment 269264
[details]
Patch
Alex Christensen
Comment 2
2016-01-19 18:34:08 PST
Comment on
attachment 269264
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=269264&action=review
> Source/WebCore/platform/network/ResourceRequestBase.h:126 > + void clearHTTPBody() { setHTTPBody(nullptr); }
This seems unnecessary.
Darin Adler
Comment 3
2016-01-19 22:55:57 PST
Comment on
attachment 269264
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=269264&action=review
> Source/WebCore/loader/FormSubmission.cpp:261 > + frameRequest.resourceRequest().setHTTPBody(m_formData.copyRef());
Seems a shame we can’t move here. Worth investigating if we can; do we ever have to use m_formData again?
> Source/WebCore/platform/network/FormData.cpp:73 > +RefPtr<FormData> FormData::create()
Should return Ref, not RefPtr.
> Source/WebCore/platform/network/FormData.cpp:78 > +RefPtr<FormData> FormData::create(const void* data, size_t size)
Should return Ref, not RefPtr.
> Source/WebCore/platform/network/FormData.cpp:92 > +RefPtr<FormData> FormData::create(const Vector<char>& vector)
Should return Ref, not RefPtr.
> Source/WebCore/platform/network/FormData.cpp:99 > +RefPtr<FormData> FormData::create(const FormDataList& list, const TextEncoding& encoding, EncodingType encodingType)
Should return Ref, not RefPtr.
> Source/WebCore/platform/network/FormData.cpp:106 > +RefPtr<FormData> FormData::createMultiPart(const FormDataList& list, const TextEncoding& encoding, Document* document)
Should return Ref, not RefPtr.
> Source/WebCore/platform/network/FormData.cpp:113 > +RefPtr<FormData> FormData::copy() const
Should return Ref, not RefPtr.
> Source/WebCore/platform/network/FormData.cpp:118 > +RefPtr<FormData> FormData::deepCopy() const
Should return Ref, not RefPtr.
> Source/WebCore/platform/network/FormData.cpp:305 > +RefPtr<FormData> FormData::resolveBlobReferences()
Should return Ref, not RefPtr.
> Source/WebCore/platform/network/FormData.h:294 > RefPtr<FormData> data = FormData::create();
This function uses release() below, and should not.
>> Source/WebCore/platform/network/ResourceRequestBase.h:126 >> + WEBCORE_EXPORT void setHTTPBody(RefPtr<FormData>&&); >> + WEBCORE_EXPORT void setHTTPBody(FormData* httpBody) { setHTTPBody(RefPtr<FormData>(httpBody)); } >> + void clearHTTPBody() { setHTTPBody(nullptr); } > > This seems unnecessary.
The overloading of setHTTPBody seems pretty messy. Can we avoid it? And, as Alex says, I think setHTTPBody(nullptr) is clear enough by itself; don’t think we need to add a named clearHTTPBody.
> Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp:353 > RefPtr<FormData> formData = prpFormData;
This seems peculiar. The "prp" here stands for PassRefPtr, and so it should not have that name any more. I don’t think we need a RefPtr local variable at all now that this is not using PassRefPtr.
> Source/WebCore/platform/network/mac/FormDataStreamMac.mm:43 > +void setHTTPBody(NSMutableURLRequest *request, FormData* prpFormData)
Again, in "prpFormData" the "prp" is PassRefPtr and so we should get rid of it.
youenn fablet
Comment 4
2016-01-21 04:45:35 PST
Created
attachment 269446
[details]
Removing clearHTTPBody
youenn fablet
Comment 5
2016-01-21 06:50:08 PST
Created
attachment 269452
[details]
Updated according review
youenn fablet
Comment 6
2016-01-21 06:55:07 PST
Thanks for the reviews. (In reply to
comment #2
)
> Comment on
attachment 269264
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=269264&action=review
> > > Source/WebCore/platform/network/ResourceRequestBase.h:126 > > + void clearHTTPBody() { setHTTPBody(nullptr); } > > This seems unnecessary.
I removed it.
> > Source/WebCore/loader/FormSubmission.cpp:261 > > + frameRequest.resourceRequest().setHTTPBody(m_formData.copyRef()); > > Seems a shame we can’t move here. Worth investigating if we can; do we ever > have to use m_formData again?
I think we can remove the copyRef, as the code is now. But this could be broken very easily, so I kept it. Some refactoring would probably help to remove the copyRef. Maybe a FIXME in the code would be good to keep track of this?
Chris Dumez
Comment 7
2016-01-21 09:22:08 PST
Comment on
attachment 269452
[details]
Updated according review View in context:
https://bugs.webkit.org/attachment.cgi?id=269452&action=review
r=me
> Source/WebCore/platform/network/FormData.h:308 > + return WTFMove(data);
I don't think we need the WTFMove() here.
> Source/WebCore/platform/network/ResourceRequestBase.cpp:79 > + request->setHTTPBody(WTFMove(data->httpBody));
It seems risky to alter data before passing it to doPlatformAdopt(). Personally, I would copyRef() here as it seems more robust.
> Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp:-394 > - FormCreationContext formContext = { formData.release(), length };
Can't we keep this on one line to avoid calling the default constructor unnecessarily? There has to be a way.
Michael Catanzaro
Comment 8
2016-01-21 09:34:51 PST
(In reply to
comment #7
)
> > Source/WebCore/platform/network/FormData.h:308 > > + return WTFMove(data); > > I don't think we need the WTFMove() here.
Calling WTFMove with a return value is going to trigger clang's -Wpessimizing-move warning, so please remove this.
youenn fablet
Comment 9
2016-01-22 01:42:26 PST
Created
attachment 269558
[details]
Patch for landing
youenn fablet
Comment 10
2016-01-22 01:57:05 PST
Created
attachment 269560
[details]
Patch for landing
youenn fablet
Comment 11
2016-01-22 02:00:26 PST
> r=me
Thanks
> > Source/WebCore/platform/network/FormData.h:308 > > + return WTFMove(data); > > I don't think we need the WTFMove() here.
I removed it. Is there a good way to return a RefPtr<> from a Ref<>?
> > Source/WebCore/platform/network/ResourceRequestBase.cpp:79 > > + request->setHTTPBody(WTFMove(data->httpBody)); > > It seems risky to alter data before passing it to doPlatformAdopt(). > Personally, I would copyRef() here as it seems more robust.
OK
> > Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp:-394 > > - FormCreationContext formContext = { formData.release(), length }; > > Can't we keep this on one line to avoid calling the default constructor > unnecessarily? There has to be a way.
I changed it back, code is better this way. I guess formData will get its counter ++/--.
WebKit Commit Bot
Comment 12
2016-01-22 02:50:08 PST
Comment on
attachment 269560
[details]
Patch for landing Rejecting
attachment 269560
[details]
from commit-queue. Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-03', 'build', '--no-clean', '--no-update', '--build-style=release', '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit Last 500 characters of output: /x86_64/FormState.dia -c /Volumes/Data/EWS/WebKit/Source/WebCore/loader/FormState.cpp -o /Volumes/Data/EWS/WebKit/WebKitBuild/WebCore.build/Release/WebCore.build/Objects-normal/x86_64/FormState.o ** BUILD FAILED ** The following build commands failed: CompileC /Volumes/Data/EWS/WebKit/WebKitBuild/WebCore.build/Release/WebCore.build/Objects-normal/x86_64/FormDataStreamCFNet.o platform/network/cf/FormDataStreamCFNet.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler (1 failure) Full output:
http://webkit-queues.webkit.org/results/724895
youenn fablet
Comment 13
2016-01-22 05:52:59 PST
Created
attachment 269571
[details]
Patch for landing with mac build fix
WebKit Commit Bot
Comment 14
2016-01-22 06:51:27 PST
Comment on
attachment 269571
[details]
Patch for landing with mac build fix Clearing flags on attachment: 269571 Committed
r195450
: <
http://trac.webkit.org/changeset/195450
>
WebKit Commit Bot
Comment 15
2016-01-22 06:51:33 PST
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