[Curl] Bugfix for r231968, Suspend/Resume with WK2
authorBasuke.Suzuki@sony.com <Basuke.Suzuki@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 May 2018 00:14:39 +0000 (00:14 +0000)
committerBasuke.Suzuki@sony.com <Basuke.Suzuki@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 May 2018 00:14:39 +0000 (00:14 +0000)
https://bugs.webkit.org/show_bug.cgi?id=185830

The flags are needed to be updated even if it is cancelled or finished to cleanup correctly.
Also fixed trivial bug for very rare case (hard to produce the situation).

Reviewed by Youenn Fablet.

No new tests because WK2 is not ready for WinCairo yet in public., tested internaly.

* platform/network/curl/CurlRequest.cpp:
(WebCore::CurlRequest::suspend):
(WebCore::CurlRequest::resume):
(WebCore::CurlRequest::pausedStatusChanged):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/network/curl/CurlRequest.cpp

index be587bc..e456536 100644 (file)
@@ -1,3 +1,20 @@
+2018-05-21  Basuke Suzuki  <Basuke.Suzuki@sony.com>
+
+        [Curl] Bugfix for r231968, Suspend/Resume with WK2
+        https://bugs.webkit.org/show_bug.cgi?id=185830
+
+        The flags are needed to be updated even if it is cancelled or finished to cleanup correctly.
+        Also fixed trivial bug for very rare case (hard to produce the situation).
+
+        Reviewed by Youenn Fablet.
+
+        No new tests because WK2 is not ready for WinCairo yet in public., tested internaly.
+
+        * platform/network/curl/CurlRequest.cpp:
+        (WebCore::CurlRequest::suspend):
+        (WebCore::CurlRequest::resume):
+        (WebCore::CurlRequest::pausedStatusChanged):
+
 2018-05-21  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r232030.
index 2aa48f1..026e8d2 100644 (file)
@@ -132,9 +132,6 @@ void CurlRequest::suspend()
 {
     ASSERT(isMainThread());
 
-    if (isCompletedOrCancelled())
-        return;
-
     setRequestPaused(true);
 }
 
@@ -142,9 +139,6 @@ void CurlRequest::resume()
 {
     ASSERT(isMainThread());
 
-    if (isCompletedOrCancelled())
-        return;
-
     setRequestPaused(false);
 }
 
@@ -648,6 +642,9 @@ void CurlRequest::invokeCancel()
 
 void CurlRequest::pausedStatusChanged()
 {
+    if (isCompletedOrCancelled())
+        return;
+
     runOnWorkerThreadIfRequired([this, protectedThis = makeRef(*this)]() {
         if (isCompletedOrCancelled())
             return;
@@ -664,7 +661,7 @@ void CurlRequest::pausedStatusChanged()
             if (error == CURLE_OK)
                 updateHandlePauseState(paused);
 
-            needCancel = (error != CURLE_OK && paused);
+            needCancel = (error != CURLE_OK && !paused);
         }
 
         if (needCancel)