Title: [195526] trunk/Source/WebKit2
Revision
195526
Author
[email protected]
Date
2016-01-24 23:45:39 -0800 (Sun, 24 Jan 2016)

Log Message

Report upload progress to NetworkLoadClient when using NetworkSession
https://bugs.webkit.org/show_bug.cgi?id=153388

Patch by Alex Christensen <[email protected]> on 2016-01-24
Reviewed by Darin Adler.

This fixes http/tests/xmlhttprequest/upload-onload-event.html and a few other tests.

* NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::didBecomeDownload):
(WebKit::NetworkLoad::didSendData):
(WebKit::NetworkLoad::didReceiveResponseAsync):
* NetworkProcess/NetworkLoad.h:
* NetworkProcess/NetworkSession.h:
(WebKit::NetworkSessionTaskClient::~NetworkSessionTaskClient):
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate initWithNetworkSession:]):
(-[WKNetworkSessionDelegate URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:]):
(-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (195525 => 195526)


--- trunk/Source/WebKit2/ChangeLog	2016-01-25 07:04:12 UTC (rev 195525)
+++ trunk/Source/WebKit2/ChangeLog	2016-01-25 07:45:39 UTC (rev 195526)
@@ -1,3 +1,24 @@
+2016-01-24  Alex Christensen  <[email protected]>
+
+        Report upload progress to NetworkLoadClient when using NetworkSession
+        https://bugs.webkit.org/show_bug.cgi?id=153388
+
+        Reviewed by Darin Adler.
+
+        This fixes http/tests/xmlhttprequest/upload-onload-event.html and a few other tests.
+
+        * NetworkProcess/NetworkLoad.cpp:
+        (WebKit::NetworkLoad::didBecomeDownload):
+        (WebKit::NetworkLoad::didSendData):
+        (WebKit::NetworkLoad::didReceiveResponseAsync):
+        * NetworkProcess/NetworkLoad.h:
+        * NetworkProcess/NetworkSession.h:
+        (WebKit::NetworkSessionTaskClient::~NetworkSessionTaskClient):
+        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+        (-[WKNetworkSessionDelegate initWithNetworkSession:]):
+        (-[WKNetworkSessionDelegate URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:]):
+        (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
+
 2016-01-24  Gyuyoung Kim  <[email protected]>
 
         Reduce PassRefPtr uses in dom - 4

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkLoad.cpp (195525 => 195526)


--- trunk/Source/WebKit2/NetworkProcess/NetworkLoad.cpp	2016-01-25 07:04:12 UTC (rev 195525)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkLoad.cpp	2016-01-25 07:45:39 UTC (rev 195526)
@@ -241,6 +241,11 @@
     m_client.didConvertToDownload();
 }
 
+void NetworkLoad::didSendData(uint64_t totalBytesSent, uint64_t totalBytesExpectedToSend)
+{
+    m_client.didSendData(totalBytesSent, totalBytesExpectedToSend);
+}
+
 #else
 
 void NetworkLoad::didReceiveResponseAsync(ResourceHandle* handle, const ResourceResponse& receivedResponse)

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkLoad.h (195525 => 195526)


--- trunk/Source/WebKit2/NetworkProcess/NetworkLoad.h	2016-01-25 07:04:12 UTC (rev 195525)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkLoad.h	2016-01-25 07:45:39 UTC (rev 195526)
@@ -73,6 +73,7 @@
     virtual void didReceiveData(RefPtr<WebCore::SharedBuffer>&&) final override;
     virtual void didCompleteWithError(const WebCore::ResourceError&) final override;
     virtual void didBecomeDownload() final override;
+    virtual void didSendData(uint64_t totalBytesSent, uint64_t totalBytesExpectedToSend) override;
 #else
     // ResourceHandleClient
     virtual void willSendRequestAsync(WebCore::ResourceHandle*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse) override;

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkSession.h (195525 => 195526)


--- trunk/Source/WebKit2/NetworkProcess/NetworkSession.h	2016-01-25 07:04:12 UTC (rev 195525)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkSession.h	2016-01-25 07:45:39 UTC (rev 195526)
@@ -76,6 +76,7 @@
     virtual void didReceiveData(RefPtr<WebCore::SharedBuffer>&&) = 0;
     virtual void didCompleteWithError(const WebCore::ResourceError&) = 0;
     virtual void didBecomeDownload() = 0;
+    virtual void didSendData(uint64_t totalBytesSent, uint64_t totalBytesExpectedToSend) = 0;
 
     virtual ~NetworkSessionTaskClient() { }
 };

Modified: trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm (195525 => 195526)


--- trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2016-01-25 07:04:12 UTC (rev 195525)
+++ trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2016-01-25 07:45:39 UTC (rev 195526)
@@ -95,6 +95,12 @@
     return self;
 }
 
+- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didSendBodyData:(int64_t)bytesSent totalBytesSent:(int64_t)totalBytesSent totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend
+{
+    if (auto* networkDataTask = _session->dataTaskForIdentifier(task.taskIdentifier))
+        networkDataTask->client().didSendData(totalBytesSent, totalBytesExpectedToSend);
+}
+
 - (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task willPerformHTTPRedirection:(NSHTTPURLResponse *)response newRequest:(NSURLRequest *)request completionHandler:(void (^)(NSURLRequest *))completionHandler
 {
     if (auto* networkDataTask = _session->dataTaskForIdentifier(task.taskIdentifier)) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to