Changeset 184072 in webkit
- Timestamp:
- May 11, 2015, 3:21:40 AM (11 years ago)
- Location:
- trunk/Source/WTF
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
wtf/WorkQueue.h (modified) (1 diff)
-
wtf/gtk/WorkQueueGtk.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r184040 r184072 1 2015-05-11 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] WorkQueue objects are not released 4 https://bugs.webkit.org/show_bug.cgi?id=144824 5 6 Reviewed by Žan Doberšek. 7 8 Do not keep a reference of the WorkQueue for the entire life of 9 its worker thread, since every task scheduled on the WorkQueue 10 already takes a reference. Instead, take a reference of the main 11 loop to make sure that when the worker thread starts, the main 12 loop hasn't been released to avoid runtime warnings (see 13 webkit.org/b/140998). Also removed the g_main_context_pop_thread_default() 14 from the thread body, since the thread-specific context queue will 15 be freed anyway when the thread exits. 16 If the WorkQueue is released early, before the thread has started, 17 schedule a main loop quit in the context, to make sure it will 18 be the first thing run by the main loop and the thread will exit. 19 20 * wtf/WorkQueue.h: Remove unused event loop mutex. 21 * wtf/gtk/WorkQueueGtk.cpp: 22 (WTF::WorkQueue::platformInitialize): 23 (WTF::WorkQueue::platformInvalidate): 24 1 25 2015-05-09 Yoav Weiss <yoav@yoav.ws> 2 26 -
trunk/Source/WTF/wtf/WorkQueue.h
r183746 r184072 107 107 ThreadIdentifier m_workQueueThread; 108 108 GRefPtr<GMainContext> m_eventContext; 109 Mutex m_eventLoopLock;110 109 GRefPtr<GMainLoop> m_eventLoop; 111 110 GMainLoopSource m_socketEventSource; -
trunk/Source/WTF/wtf/gtk/WorkQueueGtk.cpp
r183800 r184072 56 56 threadName += strlen(threadName) - kVisualStudioThreadNameLimit; 57 57 58 RefPtr<WorkQueue> protector(this); 59 m_workQueueThread = createThread(threadName, [protector] { 60 g_main_context_push_thread_default(protector->m_eventContext.get()); 61 g_main_loop_run(protector->m_eventLoop.get()); 62 g_main_context_pop_thread_default(protector->m_eventContext.get()); 58 GRefPtr<GMainLoop> eventLoop(m_eventLoop.get()); 59 m_workQueueThread = createThread(threadName, [eventLoop] { 60 g_main_context_push_thread_default(g_main_loop_get_context(eventLoop.get())); 61 g_main_loop_run(eventLoop.get()); 63 62 }); 64 63 } … … 71 70 } 72 71 73 MutexLocker locker(m_eventLoopLock);74 72 if (m_eventLoop) { 75 73 if (g_main_loop_is_running(m_eventLoop.get())) 76 74 g_main_loop_quit(m_eventLoop.get()); 77 m_eventLoop.clear(); 75 else { 76 // The thread hasn't started yet, so schedule a main loop quit to ensure the thread finishes. 77 GMainLoop* eventLoop = m_eventLoop.get(); 78 GMainLoopSource::scheduleAndDeleteOnDestroy("[WebKit] WorkQueue quit main loop", [eventLoop] { g_main_loop_quit(eventLoop); }, 79 G_PRIORITY_HIGH, nullptr, m_eventContext.get()); 80 } 81 m_eventLoop = nullptr; 78 82 } 79 83 80 m_eventContext .clear();84 m_eventContext = nullptr; 81 85 } 82 86
Note:
See TracChangeset
for help on using the changeset viewer.