Changeset 102863 in webkit
- Timestamp:
- Dec 14, 2011 6:02:59 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/platform/graphics/chromium/cc/CCScopedThreadProxy.h
r100370 r102863 72 72 void runTaskIfNotShutdown(PassOwnPtr<CCThread::Task> popTask) 73 73 { 74 OwnPtr<CCThread::Task> task = popTask; 75 // If our shutdown flag is set, it's possible that m_targetThread has already been destroyed so don't 76 // touch it. 77 if (m_shutdown) { 78 deref(); 79 return; 80 } 74 81 ASSERT(currentThread() == m_targetThread->threadID()); 75 OwnPtr<CCThread::Task> task = popTask; 76 if (!m_shutdown) 77 task->performTask(); 82 task->performTask(); 78 83 deref(); 79 84 } -
trunk/Source/WebKit/chromium/ChangeLog
r102817 r102863 1 2011-12-14 Sami Kyostila <skyostil@chromium.org> 2 3 [chromium] Fix CCLayerTreeHostTest shutdown race 4 https://bugs.webkit.org/show_bug.cgi?id=73926 5 6 This patch fixes a shutdown race condition in CCLayerTreeHostTest which 7 may happen if endTest() is called from within the drawLayersOnCCThread() 8 test hook. The sequence of events leading to the problem is: 9 10 1. CCThreadProxy::scheduledActionDrawAndSwap() is called when a frame 11 begins. 12 2. CCThreadProxy calls drawLayersOnCCThread(), which in turn calls 13 endTest(). 14 3. Seeing it's not running in the main thread, endTest() posts a task 15 calling itself in the main thread. 16 4. CCThreadProxy posts a task for calling didCommitAndDrawFrame() in 17 the main thread. 18 19 The race is between the task posted in step #3 and the CC thread running 20 in scheduledActionDrawAndSwap(). If the endTask() task is scheduled 21 before the CC thread reaches step #4, it drains the pending message 22 queue (CCLayerTreeHostTest.cpp:369) before the task in step #4 is 23 posted. 24 25 The result is that the didCommitAndDrawFrame() task is executed after 26 the test fixture has been torn down, causing a read of unallocated 27 memory in CCScopedThreadProxy::runTaskIfNotShutdown (as m_targetThread 28 is no longer valid). 29 30 The fix is check m_shutdown before touching m_targetThread in 31 CCScopedThreadProxy. That is, events will still be queued after shutdown 32 but they will not be processed. 33 34 Reviewed by James Robinson. 35 1 36 2011-12-14 Jonathan Backer <backer@chromium.org> 2 37
Note: See TracChangeset
for help on using the changeset viewer.