Title: [260892] trunk/Source/WebCore
- Revision
- 260892
- Author
- [email protected]
- Date
- 2020-04-29 04:33:46 -0700 (Wed, 29 Apr 2020)
Log Message
PlatformMediaResourceLoader should be destroyed on the main thread
https://bugs.webkit.org/show_bug.cgi?id=211155
Reviewed by Xabier Rodriguez-Calvar.
PlatformMediaResourceLoader is only safe to use from the main thread.
A tricky detail is this includes its destruction. The same is true for
PlatformMediaResource.
Both classes are ThreadSafeRefCounted<> classes and therefore
WTF::DestructionThread::Main can be used to ensure destruction is run
in the correct thread with no need for additional client code.
* platform/graphics/PlatformMediaResourceLoader.h:
* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(WebKitWebSrcPrivate::StreamingMembers::~StreamingMembers):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (260891 => 260892)
--- trunk/Source/WebCore/ChangeLog 2020-04-29 10:36:22 UTC (rev 260891)
+++ trunk/Source/WebCore/ChangeLog 2020-04-29 11:33:46 UTC (rev 260892)
@@ -1,3 +1,22 @@
+2020-04-29 Alicia Boya GarcĂa <[email protected]>
+
+ PlatformMediaResourceLoader should be destroyed on the main thread
+ https://bugs.webkit.org/show_bug.cgi?id=211155
+
+ Reviewed by Xabier Rodriguez-Calvar.
+
+ PlatformMediaResourceLoader is only safe to use from the main thread.
+ A tricky detail is this includes its destruction. The same is true for
+ PlatformMediaResource.
+
+ Both classes are ThreadSafeRefCounted<> classes and therefore
+ WTF::DestructionThread::Main can be used to ensure destruction is run
+ in the correct thread with no need for additional client code.
+
+ * platform/graphics/PlatformMediaResourceLoader.h:
+ * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
+ (WebKitWebSrcPrivate::StreamingMembers::~StreamingMembers):
+
2020-04-29 Rob Buis <[email protected]>
Make PolicyChecker an inner class of FrameLoader
Modified: trunk/Source/WebCore/platform/graphics/PlatformMediaResourceLoader.h (260891 => 260892)
--- trunk/Source/WebCore/platform/graphics/PlatformMediaResourceLoader.h 2020-04-29 10:36:22 UTC (rev 260891)
+++ trunk/Source/WebCore/platform/graphics/PlatformMediaResourceLoader.h 2020-04-29 11:33:46 UTC (rev 260892)
@@ -54,7 +54,7 @@
virtual void loadFinished(PlatformMediaResource&) { }
};
-class PlatformMediaResourceLoader : public ThreadSafeRefCounted<PlatformMediaResourceLoader> {
+class PlatformMediaResourceLoader : public ThreadSafeRefCounted<PlatformMediaResourceLoader, WTF::DestructionThread::Main> {
WTF_MAKE_NONCOPYABLE(PlatformMediaResourceLoader); WTF_MAKE_FAST_ALLOCATED;
public:
enum LoadOption {
@@ -71,7 +71,7 @@
PlatformMediaResourceLoader() = default;
};
-class PlatformMediaResource : public ThreadSafeRefCounted<PlatformMediaResource> {
+class PlatformMediaResource : public ThreadSafeRefCounted<PlatformMediaResource, WTF::DestructionThread::Main> {
WTF_MAKE_NONCOPYABLE(PlatformMediaResource); WTF_MAKE_FAST_ALLOCATED;
public:
PlatformMediaResource() = default;
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp (260891 => 260892)
--- trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp 2020-04-29 10:36:22 UTC (rev 260891)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp 2020-04-29 11:33:46 UTC (rev 260892)
@@ -102,16 +102,14 @@
GUniquePtr<gchar> httpMethod;
struct StreamingMembers {
+#ifndef NDEBUG
~StreamingMembers()
{
// By the time we're destroying WebKitWebSrcPrivate unLock() should have been called and therefore resource
// should have already been cleared.
ASSERT(!resource);
- // ResourceLoader is not thread-safe. It's not even ThreadSafeRefCounted. Therefore, to be safe, we want the
- // unref to happen in the main thread.
- if (loader)
- RunLoop::main().dispatch([loader = WTFMove(loader)] { });
}
+#endif
// Properties initially empty, but set once the first HTTP response arrives:
bool wasResponseReceived;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes