Changeset 100055 in webkit
- Timestamp:
- Nov 11, 2011 6:05:39 PM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r100054 r100055 1 2011-11-11 Iain Merrick <husky@google.com> 2 3 [chromium] Fix CCThreadProxy::setVisible 4 https://bugs.webkit.org/show_bug.cgi?id=71903 5 6 The behavior is different depending on whether we're showing 7 or hiding the compositor. This patch fixes both code paths. 8 9 Reviewed by James Robinson. 10 11 * platform/graphics/chromium/cc/CCCompletionEvent.h: 12 (WebCore::CCCompletionEvent::CCCompletionEvent): 13 (WebCore::CCCompletionEvent::~CCCompletionEvent): 14 (WebCore::CCCompletionEvent::wait): 15 (WebCore::CCCompletionEvent::signal): 16 * platform/graphics/chromium/cc/CCThreadProxy.cpp: 17 (WebCore::CCThreadProxy::setVisible): 18 1 19 2011-11-11 Iain Merrick <husky@google.com> 2 20 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCCompletionEvent.h
r95901 r100055 31 31 32 32 // Used for making blocking calls from one thread to another. Use only when 33 // absolutely certain that doing-so will not lead to a livelock.33 // absolutely certain that doing-so will not lead to a deadlock. 34 34 // 35 35 // It is safe to destroy this object as soon as wait() returns. … … 38 38 CCCompletionEvent() 39 39 { 40 #ifndef NDEBUG 41 m_waited = false; 42 m_signaled = false; 43 #endif 40 44 m_mutex.lock(); 41 45 } … … 44 48 { 45 49 m_mutex.unlock(); 50 ASSERT(m_waited); 51 ASSERT(m_signaled); 46 52 } 47 53 48 54 void wait() 49 55 { 56 ASSERT(!m_waited); 57 #ifndef NDEBUG 58 m_waited = true; 59 #endif 50 60 m_condition.wait(m_mutex); 51 61 } … … 54 64 { 55 65 MutexLocker lock(m_mutex); 66 ASSERT(!m_signaled); 67 #ifndef NDEBUG 68 m_signaled = true; 69 #endif 56 70 m_condition.signal(); 57 71 } … … 60 74 Mutex m_mutex; 61 75 ThreadCondition m_condition; 76 #ifndef NDEBUG 77 // Used to assert that wait() and signal() are each called exactly once. 78 bool m_waited; 79 bool m_signaled; 80 #endif 62 81 }; 63 82 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp
r100054 r100055 250 250 { 251 251 ASSERT(isMainThread()); 252 if (!visible) {253 CCCompletionEvent completion;254 s_ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::didBecomeInvisibleOnImplThread, AllowCrossThreadAccess(&completion)));255 return; 256 } 257 setNeedsRedraw(); 258 } 259 260 void CCThreadProxy::didBecomeInvisibleOnImplThread(CCCompletionEvent* completion)261 { 262 ASSERT(isImplThread());263 m_layerTreeHost->didBecomeInvisibleOnImplThread(m_layerTreeHostImpl.get());264 m_schedulerOnImplThread->setVisible( false);265 m_layerTreeHostImpl->setVisible( false);252 CCCompletionEvent completion; 253 s_ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::setVisibleOnImplThread, AllowCrossThreadAccess(&completion), visible)); 254 completion.wait(); 255 } 256 257 void CCThreadProxy::setVisibleOnImplThread(CCCompletionEvent* completion, bool visible) 258 { 259 ASSERT(isImplThread()); 260 if (!visible) 261 m_layerTreeHost->didBecomeInvisibleOnImplThread(m_layerTreeHostImpl.get()); 262 else 263 m_schedulerOnImplThread->setNeedsRedraw(); 264 m_schedulerOnImplThread->setVisible(visible); 265 m_layerTreeHostImpl->setVisible(visible); 266 266 completion->signal(); 267 267 } … … 448 448 m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get()); 449 449 CCTextureUpdater updater(m_layerTreeHostImpl->contentsTextureAllocator()); 450 m_layerTreeHostImpl->setVisible(m_layerTreeHost->visible());451 m_schedulerOnImplThread->setVisible(m_layerTreeHostImpl->visible());452 450 m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get()); 453 451 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h
r99844 r100055 100 100 void initializeLayerRendererOnImplThread(GraphicsContext3D*, CCCompletionEvent*, bool* initializeSucceeded, LayerRendererCapabilities*, int* compositorIdentifier); 101 101 void setNeedsAnimateOnImplThread(); 102 void didBecomeInvisibleOnImplThread(CCCompletionEvent*);102 void setVisibleOnImplThread(CCCompletionEvent*, bool visible); 103 103 void layerTreeHostClosedOnImplThread(CCCompletionEvent*); 104 104 -
trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp
r99943 r100055 210 210 } 211 211 212 void postSetVisibleToMainThread(bool visible) 213 { 214 callOnMainThread(visible ? CCLayerTreeHostTest::dispatchSetVisible : CCLayerTreeHostTest::dispatchSetInvisible, this); 215 } 216 212 217 void timeout() 213 218 { … … 270 275 if (test->m_layerTreeHost) 271 276 test->m_layerTreeHost->setNeedsRedraw(); 277 } 278 279 static void dispatchSetVisible(void* self) 280 { 281 ASSERT(isMainThread()); 282 CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self); 283 ASSERT(test); 284 if (test->m_layerTreeHost) 285 test->m_layerTreeHost->setVisible(true); 286 } 287 288 static void dispatchSetInvisible(void* self) 289 { 290 ASSERT(isMainThread()); 291 CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self); 292 ASSERT(test); 293 if (test->m_layerTreeHost) 294 test->m_layerTreeHost->setVisible(false); 272 295 } 273 296 … … 765 788 } 766 789 790 class CCLayerTreeHostTestSetVisible : public CCLayerTreeHostTest { 791 public: 792 793 CCLayerTreeHostTestSetVisible() 794 : m_numCommits(0) 795 , m_numDraws(0) 796 { 797 } 798 799 virtual void beginTest() 800 { 801 postSetVisibleToMainThread(false); 802 postSetNeedsRedrawToMainThread(); // This is suppressed while we're invisible. 803 postSetVisibleToMainThread(true); // Triggers the redraw. 804 } 805 806 virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) 807 { 808 EXPECT_TRUE(impl->visible()); 809 ++m_numDraws; 810 endTest(); 811 } 812 813 virtual void afterTest() 814 { 815 EXPECT_EQ(1, m_numDraws); 816 } 817 818 private: 819 int m_numCommits; 820 int m_numDraws; 821 }; 822 823 TEST_F(CCLayerTreeHostTestSetVisible, runMultiThread) 824 { 825 runTest(true); 826 } 827 767 828 } // namespace
Note: See TracChangeset
for help on using the changeset viewer.