WebKit Bugzilla
Attachment 339636 Details for
Bug 185344
: Cleanup XMLHttpRequestUpload a little
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185344-20180504224817.patch (text/plain), 6.90 KB, created by
Sam Weinig
on 2018-05-04 22:48:18 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Sam Weinig
Created:
2018-05-04 22:48:18 PDT
Size:
6.90 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 231396) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,26 @@ >+2018-05-04 Sam Weinig <sam@webkit.org> >+ >+ Cleanup XMLHttpRequestUpload a little >+ https://bugs.webkit.org/show_bug.cgi?id=185344 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * bindings/js/JSXMLHttpRequestCustom.cpp: >+ (WebCore::JSXMLHttpRequest::visitAdditionalChildren): >+ Use auto to reduce redundancy. >+ >+ * xml/XMLHttpRequest.cpp: >+ (WebCore::XMLHttpRequest::upload): >+ * xml/XMLHttpRequest.h: >+ Switch upload() to return a reference. >+ >+ * xml/XMLHttpRequestUpload.cpp: >+ (WebCore::XMLHttpRequestUpload::XMLHttpRequestUpload): >+ (WebCore::XMLHttpRequestUpload::dispatchProgressEvent): >+ * xml/XMLHttpRequestUpload.h: >+ Cleanup formatting, modernize and switch XMLHttpRequest member from a pointer >+ to a reference. >+ > 2018-05-04 Wenson Hsieh <wenson_hsieh@apple.com> > > [iOS] Multiple links in Mail are dropped in a single line, and are difficult to tell apart >Index: Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp >=================================================================== >--- Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp (revision 231351) >+++ Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp (working copy) >@@ -43,10 +43,10 @@ using namespace JSC; > > void JSXMLHttpRequest::visitAdditionalChildren(SlotVisitor& visitor) > { >- if (XMLHttpRequestUpload* upload = wrapped().optionalUpload()) >+ if (auto* upload = wrapped().optionalUpload()) > visitor.addOpaqueRoot(upload); > >- if (Document* responseDocument = wrapped().optionalResponseXML()) >+ if (auto* responseDocument = wrapped().optionalResponseXML()) > visitor.addOpaqueRoot(responseDocument); > } > >Index: Source/WebCore/xml/XMLHttpRequest.cpp >=================================================================== >--- Source/WebCore/xml/XMLHttpRequest.cpp (revision 231351) >+++ Source/WebCore/xml/XMLHttpRequest.cpp (working copy) >@@ -59,7 +59,6 @@ > #include <JavaScriptCore/ArrayBufferView.h> > #include <JavaScriptCore/JSCInlines.h> > #include <JavaScriptCore/JSLock.h> >-#include <mutex> > #include <wtf/RefCountedLeakCounter.h> > #include <wtf/StdLibExtras.h> > #include <wtf/text/CString.h> >@@ -280,11 +279,11 @@ String XMLHttpRequest::responseURL() con > return responseURL.string(); > } > >-XMLHttpRequestUpload* XMLHttpRequest::upload() >+XMLHttpRequestUpload& XMLHttpRequest::upload() > { > if (!m_upload) >- m_upload = std::make_unique<XMLHttpRequestUpload>(this); >- return m_upload.get(); >+ m_upload = std::make_unique<XMLHttpRequestUpload>(*this); >+ return *m_upload; > } > > void XMLHttpRequest::changeState(State newState) >Index: Source/WebCore/xml/XMLHttpRequest.h >=================================================================== >--- Source/WebCore/xml/XMLHttpRequest.h (revision 231351) >+++ Source/WebCore/xml/XMLHttpRequest.h (working copy) >@@ -108,7 +108,7 @@ public: > > String responseURL() const; > >- XMLHttpRequestUpload* upload(); >+ XMLHttpRequestUpload& upload(); > XMLHttpRequestUpload* optionalUpload() const { return m_upload.get(); } > > const ResourceResponse& resourceResponse() const { return m_response; } >Index: Source/WebCore/xml/XMLHttpRequestUpload.cpp >=================================================================== >--- Source/WebCore/xml/XMLHttpRequestUpload.cpp (revision 231351) >+++ Source/WebCore/xml/XMLHttpRequestUpload.cpp (working copy) >@@ -34,11 +34,8 @@ > > namespace WebCore { > >-XMLHttpRequestUpload::XMLHttpRequestUpload(XMLHttpRequest* xmlHttpRequest) >+XMLHttpRequestUpload::XMLHttpRequestUpload(XMLHttpRequest& xmlHttpRequest) > : m_xmlHttpRequest(xmlHttpRequest) >- , m_lengthComputable(false) >- , m_loaded(0) >- , m_total(0) > { > } > >@@ -51,7 +48,7 @@ void XMLHttpRequestUpload::dispatchThrot > dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, lengthComputable, loaded, total)); > } > >-void XMLHttpRequestUpload::dispatchProgressEvent(const AtomicString &type) >+void XMLHttpRequestUpload::dispatchProgressEvent(const AtomicString& type) > { > ASSERT(type == eventNames().loadstartEvent || type == eventNames().progressEvent || type == eventNames().loadEvent || type == eventNames().loadendEvent || type == eventNames().abortEvent || type == eventNames().errorEvent || type == eventNames().timeoutEvent); > >Index: Source/WebCore/xml/XMLHttpRequestUpload.h >=================================================================== >--- Source/WebCore/xml/XMLHttpRequestUpload.h (revision 231351) >+++ Source/WebCore/xml/XMLHttpRequestUpload.h (working copy) >@@ -32,32 +32,29 @@ > > namespace WebCore { > >- class ScriptExecutionContext; >- class XMLHttpRequest; >- >- class XMLHttpRequestUpload final : public XMLHttpRequestEventTarget { >- WTF_MAKE_FAST_ALLOCATED; >- public: >- explicit XMLHttpRequestUpload(XMLHttpRequest*); >- >- void ref() { m_xmlHttpRequest->ref(); } >- void deref() { m_xmlHttpRequest->deref(); } >- XMLHttpRequest* xmlHttpRequest() const { return m_xmlHttpRequest; } >- >- EventTargetInterface eventTargetInterface() const override { return XMLHttpRequestUploadEventTargetInterfaceType; } >- ScriptExecutionContext* scriptExecutionContext() const override { return m_xmlHttpRequest->scriptExecutionContext(); } >- >- void dispatchThrottledProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total); >- void dispatchProgressEvent(const AtomicString &type); >- >- private: >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >- >- XMLHttpRequest* m_xmlHttpRequest; >- bool m_lengthComputable; >- unsigned long long m_loaded; >- unsigned long long m_total; >- }; >+class XMLHttpRequestUpload final : public XMLHttpRequestEventTarget { >+ WTF_MAKE_FAST_ALLOCATED; >+public: >+ explicit XMLHttpRequestUpload(XMLHttpRequest&); >+ >+ void ref() { m_xmlHttpRequest.ref(); } >+ void deref() { m_xmlHttpRequest.deref(); } >+ XMLHttpRequest& xmlHttpRequest() const { return m_xmlHttpRequest; } >+ >+ EventTargetInterface eventTargetInterface() const override { return XMLHttpRequestUploadEventTargetInterfaceType; } >+ ScriptExecutionContext* scriptExecutionContext() const override { return m_xmlHttpRequest.scriptExecutionContext(); } >+ >+ void dispatchThrottledProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total); >+ void dispatchProgressEvent(const AtomicString& type); >+ >+private: >+ void refEventTarget() final { ref(); } >+ void derefEventTarget() final { deref(); } >+ >+ XMLHttpRequest& m_xmlHttpRequest; >+ bool m_lengthComputable { false }; >+ unsigned long long m_loaded { 0 }; >+ unsigned long long m_total { 0 }; >+}; > > } // namespace WebCore
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185344
: 339636