WebKit Bugzilla
Attachment 343348 Details for
Bug 186934
: [WTF] Flush all the tasks of WorkQueue when invalidating
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186934-20180623031758.patch (text/plain), 2.38 KB, created by
Yusuke Suzuki
on 2018-06-22 11:17:59 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Yusuke Suzuki
Created:
2018-06-22 11:17:59 PDT
Size:
2.38 KB
patch
obsolete
>Subversion Revision: 233078 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index 42022b3c7f11cac66dac1d1766527bc2b986d184..eebda61d14d5729a9752f4e666ec33e043ab578e 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,18 @@ >+2018-06-22 Yusuke Suzuki <utatane.tea@gmail.com> >+ >+ [WTF] Flush all the tasks of WorkQueue when invalidating >+ https://bugs.webkit.org/show_bug.cgi?id=186934 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ When invalidating WorkQueue, we should flush all the tasks. >+ Otherwise, tasks in WorkQueue can be executed even after WorkQueue is destroyed. >+ >+ * wtf/WorkQueue.h: >+ * wtf/generic/WorkQueueGeneric.cpp: >+ (WorkQueue::platformInitialize): >+ (WorkQueue::platformInvalidate): >+ > 2018-06-21 Carlos Garcia Campos <cgarcia@igalia.com> > > [GLIB] improve get_type() fast path in WEBKIT_DEFINE_TYPE >diff --git a/Source/WTF/wtf/WorkQueue.h b/Source/WTF/wtf/WorkQueue.h >index 4ecd2b5eb3e0bb18da9d6b14fee44db3e1aaa5bd..ea58cdc2b6e1269a7e73b5c98c02fb7e14c262b6 100644 >--- a/Source/WTF/wtf/WorkQueue.h >+++ b/Source/WTF/wtf/WorkQueue.h >@@ -106,6 +106,7 @@ class WorkQueue final : public FunctionDispatcher { > HANDLE m_timerQueue; > #elif USE(GLIB_EVENT_LOOP) || USE(GENERIC_EVENT_LOOP) > RunLoop* m_runLoop; >+ RefPtr<Thread> m_thread; > #endif > }; > >diff --git a/Source/WTF/wtf/generic/WorkQueueGeneric.cpp b/Source/WTF/wtf/generic/WorkQueueGeneric.cpp >index e0591644aaa27e5556c637538ea8e8192c5aa9a6..4d9fed5a5ebcc3a1a2031316d9ec16abc013b6ac 100644 >--- a/Source/WTF/wtf/generic/WorkQueueGeneric.cpp >+++ b/Source/WTF/wtf/generic/WorkQueueGeneric.cpp >@@ -37,23 +37,20 @@ > void WorkQueue::platformInitialize(const char* name, Type, QOS) > { > BinarySemaphore semaphore; >- Thread::create(name, [&] { >+ m_thread = Thread::create(name, [&] { > m_runLoop = &RunLoop::current(); > semaphore.signal(); > m_runLoop->run(); >- })->detach(); >+ }); > semaphore.wait(WallTime::infinity()); > } > > void WorkQueue::platformInvalidate() > { >- if (m_runLoop) { >- Ref<RunLoop> protector(*m_runLoop); >- protector->stop(); >- protector->dispatch([] { >- RunLoop::current().stop(); >- }); >- } >+ m_runLoop->dispatch([&] { >+ RunLoop::current().stop(); >+ }); >+ m_thread->waitForCompletion(); > } > > void WorkQueue::dispatch(Function<void()>&& function)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186934
: 343348