Title: [262972] trunk/Source/WebCore
- Revision
- 262972
- Author
- commit-qu...@webkit.org
- Date
- 2020-06-12 13:36:26 -0700 (Fri, 12 Jun 2020)
Log Message
Stop to use ActiveDOMObject::setPendingActivity() for Modules/fetch
https://bugs.webkit.org/show_bug.cgi?id=213037
Patch by Tetsuharu Ohzeki <tetsuharu.ohz...@gmail.com> on 2020-06-12
Reviewed by Youenn Fablet.
By ActiveDOMObject's comments,
these methods should be replaced with using makePendingActivity().
`JSFetchRequest`/`JSFetchResponse` (as derived class of `JSDOMWrapper`) hold
`FetchRequest`/`FetchResponse`, and they have `FetchBodyOwner`
as a base class and keep alive it. We can replace
`setPendingActivity()` calling from `FetchBodyOwner`.
* Modules/fetch/FetchBodyOwner.cpp:
(WebCore::FetchBodyOwner::loadBlob):
(WebCore::FetchBodyOwner::finishBlobLoading):
(WebCore::FetchBodyOwner::virtualHasPendingActivity const):
* Modules/fetch/FetchBodyOwner.h:
* Modules/fetch/FetchBodySource.cpp:
(WebCore::FetchBodySource::setActive):
(WebCore::FetchBodySource::setInactive):
* Modules/fetch/FetchBodySource.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (262971 => 262972)
--- trunk/Source/WebCore/ChangeLog 2020-06-12 19:47:15 UTC (rev 262971)
+++ trunk/Source/WebCore/ChangeLog 2020-06-12 20:36:26 UTC (rev 262972)
@@ -1,3 +1,29 @@
+2020-06-12 Tetsuharu Ohzeki <tetsuharu.ohz...@gmail.com>
+
+ Stop to use ActiveDOMObject::setPendingActivity() for Modules/fetch
+ https://bugs.webkit.org/show_bug.cgi?id=213037
+
+ Reviewed by Youenn Fablet.
+
+ By ActiveDOMObject's comments,
+ these methods should be replaced with using makePendingActivity().
+
+ `JSFetchRequest`/`JSFetchResponse` (as derived class of `JSDOMWrapper`) hold
+ `FetchRequest`/`FetchResponse`, and they have `FetchBodyOwner`
+ as a base class and keep alive it. We can replace
+ `setPendingActivity()` calling from `FetchBodyOwner`.
+
+ * Modules/fetch/FetchBodyOwner.cpp:
+ (WebCore::FetchBodyOwner::loadBlob):
+ (WebCore::FetchBodyOwner::finishBlobLoading):
+ (WebCore::FetchBodyOwner::virtualHasPendingActivity const):
+ * Modules/fetch/FetchBodyOwner.h:
+ * Modules/fetch/FetchBodySource.cpp:
+ (WebCore::FetchBodySource::setActive):
+ (WebCore::FetchBodySource::setInactive):
+ * Modules/fetch/FetchBodySource.h:
+
+
2020-06-12 Takashi Komori <takashi.kom...@sony.com>
[Curl] Implement functions to use ResourceLoadStatistics.
Modified: trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.cpp (262971 => 262972)
--- trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.cpp 2020-06-12 19:47:15 UTC (rev 262971)
+++ trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.cpp 2020-06-12 20:36:26 UTC (rev 262972)
@@ -256,7 +256,6 @@
m_blobLoader = WTF::nullopt;
return;
}
- setPendingActivity(*this);
}
void FetchBodyOwner::finishBlobLoading()
@@ -264,7 +263,6 @@
ASSERT(m_blobLoader);
m_blobLoader = WTF::nullopt;
- unsetPendingActivity(*this);
}
void FetchBodyOwner::blobLoadingSucceeded()
@@ -384,6 +382,11 @@
});
}
+bool FetchBodyOwner::virtualHasPendingActivity() const
+{
+ return !!m_blobLoader;
+}
+
bool FetchBodyOwner::hasLoadingError() const
{
return WTF::switchOn(m_loadingError, [](const ResourceError&) {
Modified: trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.h (262971 => 262972)
--- trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.h 2020-06-12 19:47:15 UTC (rev 262971)
+++ trunk/Source/WebCore/Modules/fetch/FetchBodyOwner.h 2020-06-12 20:36:26 UTC (rev 262972)
@@ -102,6 +102,9 @@
void blobLoadingFailed();
void finishBlobLoading();
+ // ActiveDOMObject API
+ bool virtualHasPendingActivity() const final;
+
struct BlobLoader final : FetchLoaderClient {
BlobLoader(FetchBodyOwner&);
Modified: trunk/Source/WebCore/Modules/fetch/FetchBodySource.cpp (262971 => 262972)
--- trunk/Source/WebCore/Modules/fetch/FetchBodySource.cpp 2020-06-12 19:47:15 UTC (rev 262971)
+++ trunk/Source/WebCore/Modules/fetch/FetchBodySource.cpp 2020-06-12 20:36:26 UTC (rev 262972)
@@ -41,15 +41,16 @@
void FetchBodySource::setActive()
{
ASSERT(m_bodyOwner);
+ ASSERT(!m_pendingActivity);
if (m_bodyOwner)
- m_bodyOwner->setPendingActivity(*m_bodyOwner);
+ m_pendingActivity = m_bodyOwner->makePendingActivity(*m_bodyOwner);
}
void FetchBodySource::setInactive()
{
ASSERT(m_bodyOwner);
- if (m_bodyOwner)
- m_bodyOwner->unsetPendingActivity(*m_bodyOwner);
+ ASSERT(m_pendingActivity);
+ m_pendingActivity = nullptr;
}
void FetchBodySource::doStart()
Modified: trunk/Source/WebCore/Modules/fetch/FetchBodySource.h (262971 => 262972)
--- trunk/Source/WebCore/Modules/fetch/FetchBodySource.h 2020-06-12 19:47:15 UTC (rev 262971)
+++ trunk/Source/WebCore/Modules/fetch/FetchBodySource.h 2020-06-12 20:36:26 UTC (rev 262972)
@@ -28,6 +28,7 @@
#if ENABLE(STREAMS_API)
+#include "ActiveDOMObject.h"
#include "ReadableStreamSource.h"
namespace JSC {
@@ -63,6 +64,7 @@
#if ASSERT_ENABLED
bool m_isClosed { false };
#endif
+ RefPtr<ActiveDOMObject::PendingActivity<FetchBodyOwner>> m_pendingActivity;
};
} // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes