Title: [292768] trunk/Source
- Revision
- 292768
- Author
- [email protected]
- Date
- 2022-04-12 02:43:52 -0700 (Tue, 12 Apr 2022)
Log Message
FunctionDispatcher should not be RefCounted
https://bugs.webkit.org/show_bug.cgi?id=231940
Patch by Kimmo Kinnunen <[email protected]> on 2022-04-12
Reviewed by Chris Dumez.
Source/WebKit:
Remove ThreadSafeRefCounted from FunctionDispatcher. Make all existing
function dispatchers refcounted.
No new tests, refactor.
* NetworkProcess/cache/NetworkCacheData.h:
* Platform/IPC/StreamConnectionWorkQueue.h:
Source/WTF:
Remove ThreadSafeRefCounted from FunctionDispatcher. There is nothing inherently
refcountable about FunctionDispatcher. It is better to put the refcount to the
abstraction that needs it.
This makes it possible to build FunctionDispatchers that are not refcounted. This
lets the reader infer more about the API when such a dispatcher is passed to a
function. The reader understands that the passed dispatcher would not be kept alive.
* wtf/FunctionDispatcher.h:
* wtf/RunLoop.h:
Export ~RunLoop. For some reason this is a requirement on G++, MSVC based compilers (?).
This has most likely something to do with the multiple inheritance moving to RunLoop
from FunctionDispatcher. ~FunctionDispacher was exported before, and still is.
* wtf/WorkQueue.h:
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (292767 => 292768)
--- trunk/Source/WTF/ChangeLog 2022-04-12 07:51:30 UTC (rev 292767)
+++ trunk/Source/WTF/ChangeLog 2022-04-12 09:43:52 UTC (rev 292768)
@@ -1,3 +1,25 @@
+2022-04-12 Kimmo Kinnunen <[email protected]>
+
+ FunctionDispatcher should not be RefCounted
+ https://bugs.webkit.org/show_bug.cgi?id=231940
+
+ Reviewed by Chris Dumez.
+
+ Remove ThreadSafeRefCounted from FunctionDispatcher. There is nothing inherently
+ refcountable about FunctionDispatcher. It is better to put the refcount to the
+ abstraction that needs it.
+
+ This makes it possible to build FunctionDispatchers that are not refcounted. This
+ lets the reader infer more about the API when such a dispatcher is passed to a
+ function. The reader understands that the passed dispatcher would not be kept alive.
+
+ * wtf/FunctionDispatcher.h:
+ * wtf/RunLoop.h:
+ Export ~RunLoop. For some reason this is a requirement on G++, MSVC based compilers (?).
+ This has most likely something to do with the multiple inheritance moving to RunLoop
+ from FunctionDispatcher. ~FunctionDispacher was exported before, and still is.
+ * wtf/WorkQueue.h:
+
2022-04-11 Don Olmstead <[email protected]>
Fix PlayStation build after r292696
Modified: trunk/Source/WTF/wtf/FunctionDispatcher.h (292767 => 292768)
--- trunk/Source/WTF/wtf/FunctionDispatcher.h 2022-04-12 07:51:30 UTC (rev 292767)
+++ trunk/Source/WTF/wtf/FunctionDispatcher.h 2022-04-12 09:43:52 UTC (rev 292768)
@@ -26,7 +26,6 @@
#pragma once
#include <wtf/Function.h>
-#include <wtf/ThreadSafeRefCounted.h>
namespace WTF {
@@ -33,7 +32,7 @@
// FunctionDispatcher is an abstract representation of something that functions can be
// dispatched to. This can for example be a run loop or a work queue.
-class FunctionDispatcher : public ThreadSafeRefCounted<FunctionDispatcher> {
+class FunctionDispatcher {
public:
WTF_EXPORT_PRIVATE virtual ~FunctionDispatcher();
Modified: trunk/Source/WTF/wtf/RunLoop.h (292767 => 292768)
--- trunk/Source/WTF/wtf/RunLoop.h 2022-04-12 07:51:30 UTC (rev 292767)
+++ trunk/Source/WTF/wtf/RunLoop.h 2022-04-12 09:43:52 UTC (rev 292768)
@@ -66,7 +66,7 @@
#define DefaultRunLoopMode 0
#endif
-class RunLoop final : public FunctionDispatcher {
+class RunLoop final : public FunctionDispatcher, public ThreadSafeRefCounted<RunLoop> {
WTF_MAKE_NONCOPYABLE(RunLoop);
public:
// Must be called from the main thread.
@@ -82,7 +82,7 @@
WTF_EXPORT_PRIVATE static RunLoop* webIfExists();
#endif
WTF_EXPORT_PRIVATE static bool isMain();
- ~RunLoop() final;
+ WTF_EXPORT_PRIVATE ~RunLoop() final;
WTF_EXPORT_PRIVATE void dispatch(Function<void()>&&) final;
WTF_EXPORT_PRIVATE void dispatchAfter(Seconds, Function<void()>&&);
Modified: trunk/Source/WTF/wtf/WorkQueue.h (292767 => 292768)
--- trunk/Source/WTF/wtf/WorkQueue.h 2022-04-12 07:51:30 UTC (rev 292767)
+++ trunk/Source/WTF/wtf/WorkQueue.h 2022-04-12 09:43:52 UTC (rev 292768)
@@ -42,7 +42,7 @@
namespace WTF {
-class WorkQueueBase : public FunctionDispatcher {
+class WorkQueueBase : public FunctionDispatcher, public ThreadSafeRefCounted<WorkQueueBase> {
public:
using QOS = Thread::QOS;
Modified: trunk/Source/WebKit/ChangeLog (292767 => 292768)
--- trunk/Source/WebKit/ChangeLog 2022-04-12 07:51:30 UTC (rev 292767)
+++ trunk/Source/WebKit/ChangeLog 2022-04-12 09:43:52 UTC (rev 292768)
@@ -1,3 +1,18 @@
+2022-04-12 Kimmo Kinnunen <[email protected]>
+
+ FunctionDispatcher should not be RefCounted
+ https://bugs.webkit.org/show_bug.cgi?id=231940
+
+ Reviewed by Chris Dumez.
+
+ Remove ThreadSafeRefCounted from FunctionDispatcher. Make all existing
+ function dispatchers refcounted.
+
+ No new tests, refactor.
+
+ * NetworkProcess/cache/NetworkCacheData.h:
+ * Platform/IPC/StreamConnectionWorkQueue.h:
+
2022-04-11 Zan Dobersek <[email protected]>
[WK2] Simplify IPC encoding, decoding of tuples
Modified: trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheData.h (292767 => 292768)
--- trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheData.h 2022-04-12 07:51:30 UTC (rev 292767)
+++ trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheData.h 2022-04-12 09:43:52 UTC (rev 292768)
@@ -26,7 +26,6 @@
#pragma once
#include <wtf/FileSystem.h>
-#include <wtf/FunctionDispatcher.h>
#include <wtf/SHA1.h>
#include <wtf/Span.h>
#include <wtf/ThreadSafeRefCounted.h>
Modified: trunk/Source/WebKit/Platform/IPC/StreamConnectionWorkQueue.h (292767 => 292768)
--- trunk/Source/WebKit/Platform/IPC/StreamConnectionWorkQueue.h 2022-04-12 07:51:30 UTC (rev 292767)
+++ trunk/Source/WebKit/Platform/IPC/StreamConnectionWorkQueue.h 2022-04-12 09:43:52 UTC (rev 292768)
@@ -36,7 +36,7 @@
namespace IPC {
-class WTF_CAPABILITY("is current") StreamConnectionWorkQueue final : public FunctionDispatcher {
+class WTF_CAPABILITY("is current") StreamConnectionWorkQueue final : public FunctionDispatcher, public ThreadSafeRefCounted<StreamConnectionWorkQueue> {
public:
static Ref<StreamConnectionWorkQueue> create(const char* name)
{
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes