[Curl] Implement didSendData client callback.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Jan 2018 04:12:55 +0000 (04:12 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Jan 2018 04:12:55 +0000 (04:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=182063

Patch by Basuke Suzuki <Basuke.Suzuki@sony.com> on 2018-01-24
Reviewed by Alex Christensen.

No new tests (covered by existing tests).

* platform/network/curl/CurlDownload.h:
* platform/network/curl/CurlRequest.cpp:
(WebCore::CurlRequest::willSendData):
* platform/network/curl/CurlRequestClient.h:
* platform/network/curl/ResourceHandleCurlDelegate.cpp:
(WebCore::ResourceHandleCurlDelegate::curlDidSendData):
* platform/network/curl/ResourceHandleCurlDelegate.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227591 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/network/curl/CurlDownload.h
Source/WebCore/platform/network/curl/CurlRequest.cpp
Source/WebCore/platform/network/curl/CurlRequestClient.h
Source/WebCore/platform/network/curl/ResourceHandleCurlDelegate.cpp
Source/WebCore/platform/network/curl/ResourceHandleCurlDelegate.h

index bac6f6a..e9aeb9b 100644 (file)
@@ -1,3 +1,20 @@
+2018-01-24  Basuke Suzuki  <Basuke.Suzuki@sony.com>
+
+        [Curl] Implement didSendData client callback.
+        https://bugs.webkit.org/show_bug.cgi?id=182063
+
+        Reviewed by Alex Christensen.
+
+        No new tests (covered by existing tests).
+
+        * platform/network/curl/CurlDownload.h:
+        * platform/network/curl/CurlRequest.cpp:
+        (WebCore::CurlRequest::willSendData):
+        * platform/network/curl/CurlRequestClient.h:
+        * platform/network/curl/ResourceHandleCurlDelegate.cpp:
+        (WebCore::ResourceHandleCurlDelegate::curlDidSendData):
+        * platform/network/curl/ResourceHandleCurlDelegate.h:
+
 2018-01-24  Jiewen Tan  <jiewen_tan@apple.com>
 
         [WebAuthN] Implement PublicKeyCredential’s [[DiscoverFromExternalSource]] with a dummy authenticator
index d8534a8..8aaf70f 100644 (file)
@@ -70,6 +70,7 @@ public:
 
 private:
     Ref<CurlRequest> createCurlRequest(ResourceRequest&);
+    void curlDidSendData(unsigned long long, unsigned long long) override { }
     void curlDidReceiveResponse(const CurlResponse&) override;
     void curlDidReceiveBuffer(Ref<SharedBuffer>&&) override;
     void curlDidComplete() override;
index d536332..e0a80f4 100644 (file)
@@ -260,6 +260,10 @@ size_t CurlRequest::willSendData(char* buffer, size_t blockSize, size_t numberOf
         return CURL_READFUNC_ABORT;
     }
 
+    callClient([this, totalReadSize = m_formDataStream.totalReadSize(), totalSize = m_formDataStream.totalSize()](CurlRequestClient& client) {
+        client.curlDidSendData(totalReadSize, totalSize);
+    });
+
     return *sendBytes;
 }
 
index fc3eff5..39c2022 100644 (file)
@@ -38,6 +38,7 @@ public:
     virtual void ref() = 0;
     virtual void deref() = 0;
 
+    virtual void curlDidSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent) = 0;
     virtual void curlDidReceiveResponse(const CurlResponse&) = 0;
     virtual void curlDidReceiveBuffer(Ref<SharedBuffer>&&) = 0;
     virtual void curlDidComplete() = 0;
index 36e2501..5149316 100644 (file)
@@ -180,6 +180,16 @@ bool ResourceHandleCurlDelegate::cancelledOrClientless()
     return !m_handle->client();
 }
 
+void ResourceHandleCurlDelegate::curlDidSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent)
+{
+    ASSERT(isMainThread());
+
+    if (cancelledOrClientless())
+        return;
+
+    m_handle->client()->didSendData(m_handle, bytesSent, totalBytesToBeSent);
+}
+
 void ResourceHandleCurlDelegate::curlDidReceiveResponse(const CurlResponse& receivedResponse)
 {
     ASSERT(isMainThread());
index 77cc5ec..fbffa53 100644 (file)
@@ -71,6 +71,7 @@ private:
     bool cancelledOrClientless();
 
     Ref<CurlRequest> createCurlRequest(ResourceRequest&);
+    void curlDidSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override;
     void curlDidReceiveResponse(const CurlResponse&) override;
     void curlDidReceiveBuffer(Ref<SharedBuffer>&&) override;
     void curlDidComplete() override;