Changeset 95702 in webkit
- Timestamp:
- Sep 22, 2011 12:53:28 AM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r95699 r95702 1 2011-09-22 James Robinson <jamesr@chromium.org> 2 3 Unreviewed, rolling out r95699. 4 http://trac.webkit.org/changeset/95699 5 https://bugs.webkit.org/show_bug.cgi?id=67417 6 7 Makes many chromium compositor tests crash 8 9 * platform/CrossThreadCopier.h: 10 * platform/graphics/chromium/LayerRendererChromium.cpp: 11 (WebCore::LayerRendererChromium::~LayerRendererChromium): 12 * platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp: 13 (WebCore::CCHeadsUpDisplay::enabled): 14 * platform/graphics/chromium/cc/CCLayerImpl.cpp: 15 (WebCore::CCLayerImpl::CCLayerImpl): 16 (WebCore::CCLayerImpl::~CCLayerImpl): 17 * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: 18 (WebCore::CCLayerTreeHost::CCLayerTreeHost): 19 (WebCore::CCLayerTreeHost::commitTo): 20 (WebCore::CCLayerTreeHost::setNeedsRedraw): 21 * platform/graphics/chromium/cc/CCLayerTreeHost.h: 22 (WebCore::CCSettings::CCSettings): 23 * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: 24 (WebCore::CCLayerTreeHostImpl::CCLayerTreeHostImpl): 25 (WebCore::CCLayerTreeHostImpl::~CCLayerTreeHostImpl): 26 * platform/graphics/chromium/cc/CCProxy.h: 27 * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp: 28 (WebCore::CCSingleThreadProxy::finishAllRendering): 29 (WebCore::CCSingleThreadProxy::setNeedsCommit): 30 (WebCore::CCSingleThreadProxy::commitIfNeeded): 31 * platform/graphics/chromium/cc/CCThreadProxy.cpp: 32 (WebCore::CCThreadProxy::CCThreadProxy): 33 (WebCore::CCThreadProxy::~CCThreadProxy): 34 (WebCore::CCThreadProxy::compositeAndReadback): 35 (WebCore::CCThreadProxy::finishAllRendering): 36 (WebCore::CCThreadProxy::isStarted): 37 (WebCore::CCThreadProxy::initializeLayerRenderer): 38 (WebCore::CCThreadProxy::setNeedsCommit): 39 (WebCore::CCThreadProxy::setNeedsCommitAndRedraw): 40 (WebCore::CCThreadProxy::setNeedsRedraw): 41 (WebCore::CCThreadProxy::start): 42 (WebCore::CCThreadProxy::stop): 43 (WebCore::CCThreadProxy::beginFrameAndCommitOnCCThread): 44 (WebCore::CCThreadProxy::beginFrameAndCommit): 45 (WebCore::CCThreadProxy::commitOnCCThread): 46 (WebCore::CCThreadProxy::drawLayersOnCCThread): 47 (WebCore::CCThreadProxy::setNeedsCommitOnCCThread): 48 (WebCore::CCThreadProxy::setNeedsCommitAndRedrawOnCCThread): 49 (WebCore::CCThreadProxy::setNeedsRedrawOnCCThread): 50 * platform/graphics/chromium/cc/CCThreadProxy.h: 51 1 52 2011-09-22 Nat Duca <nduca@chromium.org> 2 53 -
trunk/Source/WebCore/platform/CrossThreadCopier.h
r95699 r95702 42 42 namespace WebCore { 43 43 44 class IntRect;45 44 class KURL; 46 45 class ResourceError; … … 65 64 }; 66 65 67 // To allow a type to be passed across threads using its copy constructor, add a forward declaration of the type and68 // a CopyThreadCopierBase<false, false, TypeName> : public CrossThreadCopierPassThrough<TypeName> { }; to this file.69 66 template<> struct CrossThreadCopierBase<false, false, ThreadableLoaderOptions> : public CrossThreadCopierPassThrough<ThreadableLoaderOptions> { 70 };71 72 template<> struct CrossThreadCopierBase<false, false, IntRect> : public CrossThreadCopierPassThrough<IntRect> {73 67 }; 74 68 -
trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
r95699 r95702 183 183 LayerRendererChromium::~LayerRendererChromium() 184 184 { 185 ASSERT(CCProxy::isMainThread());186 185 m_headsUpDisplay.clear(); // Explicitly destroy the HUD before the TextureManager dies. 187 186 cleanupSharedObjects(); -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp
r95699 r95702 90 90 bool CCHeadsUpDisplay::enabled() const 91 91 { 92 // FIXME: HUD does not work in compositor thread mode.93 if (settings().enableCompositorThread)94 return false;95 92 return settings().showPlatformLayerTree || settings().showFPSCounter; 96 93 } -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp
r95699 r95702 56 56 , m_debugBorderWidth(0) 57 57 { 58 ASSERT(CCProxy::isImplThread());59 58 } 60 59 61 60 CCLayerImpl::~CCLayerImpl() 62 61 { 63 ASSERT(CCProxy::isImplThread());64 62 } 65 63 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
r95699 r95702 57 57 , m_visible(true) 58 58 { 59 ASSERT(CCProxy::isMainThread());60 59 } 61 60 … … 108 107 } 109 108 110 // This function commits the CCLayerTreeHost to an impl tree. When modifying111 // this function, keep in mind that the function *runs* on the impl thread! Any112 // code that is logically a main thread operation, e.g. deletion of a LayerChromium,113 // should be delayed until the CCLayerTreeHost::commitComplete, which will run114 // after the commit, but on the main thread.115 109 void CCLayerTreeHost::commitTo(CCLayerTreeHostImpl* hostImpl) 116 110 { … … 127 121 128 122 updateCompositorResources(m_updateList, hostImpl->context()); 123 clearPendingUpdate(); 129 124 130 125 hostImpl->setVisible(m_visible); … … 133 128 134 129 hostImpl->layerRenderer()->setContentsTextureMemoryUseBytes(m_contentsTextureManager->currentMemoryUseBytes()); 130 m_contentsTextureManager->unprotectAllTextures(); 135 131 136 132 // Synchronize trees, if one exists at all... … … 141 137 142 138 m_frameNumber++; 143 }144 145 void CCLayerTreeHost::commitComplete()146 {147 clearPendingUpdate();148 m_contentsTextureManager->unprotectAllTextures();149 139 } 150 140 … … 225 215 { 226 216 #if USE(THREADED_COMPOSITING) 217 TRACE_EVENT("CCLayerTreeHost::setNeedsRedraw", this, 0); 227 218 m_proxy->setNeedsRedraw(); 228 219 #else -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h
r95699 r95702 68 68 , showFPSCounter(false) 69 69 , showPlatformLayerTree(false) { } 70 CCSettings(bool acceleratePainting, bool compositeOffscreen, bool enableCompositorThread, bool showFPSCounter, bool showPlatformLayerTree)71 : acceleratePainting(acceleratePainting)72 , compositeOffscreen(compositeOffscreen)73 , enableCompositorThread(enableCompositorThread)74 , showFPSCounter(showFPSCounter)75 , showPlatformLayerTree(showPlatformLayerTree) { }76 70 77 71 bool acceleratePainting; … … 103 97 // CCLayerTreeHost interface to CCProxy. 104 98 void animateAndLayout(double frameBeginTime); 105 void commitComplete();106 99 void commitTo(CCLayerTreeHostImpl*); 107 100 PassOwnPtr<CCThread> createCompositorThread(); -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp
r95699 r95702 49 49 , m_settings(settings) 50 50 { 51 ASSERT(CCProxy::isImplThread());52 51 } 53 52 54 53 CCLayerTreeHostImpl::~CCLayerTreeHostImpl() 55 54 { 56 ASSERT(CCProxy::isImplThread());57 55 TRACE_EVENT("CCLayerTreeHostImpl::~CCLayerTreeHostImpl()", this, 0); 58 56 if (m_layerRenderer) -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h
r95699 r95702 76 76 #endif 77 77 78 // Testing hooks 79 virtual void loseCompositorContext(int numTimes) = 0; 80 78 81 // Temporary hack while render_widget still does scheduling for CCLayerTreeHostMainThreadI 79 82 virtual GraphicsContext3D* context() = 0; 80 83 81 // Testing hooks 82 virtual void loseCompositorContext(int numTimes) = 0;83 84 protected: 85 CCProxy() { } 86 friend class ScopedSetImplThread; 84 87 #ifndef NDEBUG 85 88 static void setImplThread(bool); 86 89 static void setImplThread(WTF::ThreadIdentifier); 87 90 #endif 88 89 protected:90 CCProxy() { }91 friend class ScopedSetImplThread;92 91 }; 93 92 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp
r95699 r95702 112 112 { 113 113 ASSERT(isMainThread()); 114 if (!recreateContextIfNeeded()) 115 return; 116 117 commitIfNeeded(); 118 119 { 120 ScopedSetImplThread impl; 121 m_layerTreeHostImpl->finishAllRendering(); 122 } 114 ScopedSetImplThread impl; 115 m_layerTreeHostImpl->finishAllRendering(); 123 116 } 124 117 … … 165 158 m_layerTreeHostImpl->commitComplete(); 166 159 } 167 m_layerTreeHost->commitComplete();168 160 } 169 161 … … 259 251 m_layerTreeHostImpl->commitComplete(); 260 252 } 261 m_layerTreeHost->commitComplete();262 253 } 263 254 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp
r95699 r95702 32 32 #include "cc/CCMainThreadTask.h" 33 33 #include "cc/CCThreadTask.h" 34 #include <wtf/CurrentTime.h>35 34 #include <wtf/MainThread.h> 36 35 … … 50 49 51 50 CCThreadProxy::CCThreadProxy(CCLayerTreeHost* layerTreeHost) 52 : m_commit Requested(false)51 : m_commitPending(false) 53 52 , m_layerTreeHost(layerTreeHost) 54 , m_started(false)55 , m_lastExecutedBeginFrameAndCommitSequenceNumber(-1)56 , m_numBeginFrameAndCommitsIssuedOnCCThread(0)57 , m_beginFrameAndCommitPendingOnCCThread(false)58 , m_drawTaskPostedOnCCThread(false)59 , m_redrawRequestedOnCCThread(false)60 53 { 61 54 TRACE_EVENT("CCThreadProxy::CCThreadProxy", this, 0); … … 74 67 TRACE_EVENT("CCThreadProxy::~CCThreadProxy", this, 0); 75 68 ASSERT(isMainThread()); 76 ASSERT(!m_started); 69 ASSERT(!m_layerTreeHostImpl); // Make sure stop() got called. 70 ASSERT(!m_layerTreeHost); // Make sure stop() got called. 77 71 78 72 numProxies--; … … 85 79 bool CCThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect) 86 80 { 87 ASSERT(isMainThread()); 88 ASSERT(m_layerTreeHost); 89 90 finishAllRendering(); 91 bool success = false; 92 CCCompletionEvent completion; 93 ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::drawLayersAndReadbackOnCCThread, AllowCrossThreadAccess(&completion), AllowCrossThreadAccess(&success), AllowCrossThreadAccess(pixels), rect)); 94 completion.wait(); 95 return success; 96 } 97 98 void CCThreadProxy::drawLayersAndReadbackOnCCThread(CCCompletionEvent* completion, bool* success, void* pixels, const IntRect& rect) 99 { 100 ASSERT(CCProxy::isImplThread()); 101 if (!m_layerTreeHostImpl) { 102 *success = false; 103 completion->signal(); 104 return; 105 } 106 drawLayersOnCCThread(); 107 m_layerTreeHostImpl->readback(pixels, rect); 108 *success = m_layerTreeHostImpl->isContextLost(); 109 completion->signal(); 81 ASSERT_NOT_REACHED(); 82 return false; 110 83 } 111 84 … … 117 90 void CCThreadProxy::finishAllRendering() 118 91 { 119 ASSERT(CCProxy::isMainThread()); 120 // If a commit is pending, perform the commit first. 121 if (m_commitRequested) { 122 // This bit of code is uglier than it should be because returning 123 // pointers via the CCThread task model is really messy. Effectively, we 124 // are making a blocking call to createBeginFrameAndCommitTaskOnCCThread, 125 // and trying to get the CCMainThread::Task it returns so we can run it. 126 OwnPtr<CCMainThread::Task> beginFrameAndCommitTask; 127 { 128 CCMainThread::Task* taskPtr = 0; 129 CCCompletionEvent completion; 130 ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::createBeginFrameAndCommitTaskOnCCThread, AllowCrossThreadAccess(&completion), AllowCrossThreadAccess(&taskPtr))); 131 completion.wait(); 132 beginFrameAndCommitTask = adoptPtr(taskPtr); 133 } 134 135 beginFrameAndCommitTask->performTask(); 136 } 137 // Make sure all GL drawing is finished on the impl thread. 138 CCCompletionEvent completion; 139 ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::finishAllRenderingOnCCThread, AllowCrossThreadAccess(&completion))); 140 completion.wait(); 92 ASSERT_NOT_REACHED(); 141 93 } 142 94 143 95 bool CCThreadProxy::isStarted() const 144 96 { 145 ASSERT(CCProxy::isMainThread()); 146 return m_started; 97 return m_layerTreeHostImpl; 147 98 } 148 99 … … 161 112 // are pushed into the initializeSucceeded and capabilities local variables. 162 113 CCCompletionEvent completion; 163 bool initializeSucceeded = false;114 bool initializeSucceeded; 164 115 LayerRendererCapabilities capabilities; 165 116 ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::initializeLayerRendererOnCCThread, … … 185 136 { 186 137 ASSERT(isMainThread()); 187 if (m_commit Requested)138 if (m_commitPending) 188 139 return; 189 140 190 141 TRACE_EVENT("CCThreadProxy::setNeedsCommit", this, 0); 191 m_commit Requested= true;192 ccThread->postTask(createCCThreadTask(this, &CCThreadProxy:: updateSchedulerStateOnCCThread, m_commitRequested, true));142 m_commitPending = true; 143 ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::setNeedsCommitOnCCThread)); 193 144 } 194 145 … … 196 147 { 197 148 ASSERT(isMainThread()); 198 if (m_commit Requested)149 if (m_commitPending) 199 150 return; 200 m_commitRequested = true;201 151 202 152 TRACE_EVENT("CCThreadProxy::setNeedsCommitAndRedraw", this, 0); 203 ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::updateSchedulerStateOnCCThread, m_commitRequested, true)); 153 m_commitPending = true; 154 ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::setNeedsCommitAndRedrawOnCCThread)); 204 155 } 205 156 … … 207 158 { 208 159 ASSERT(isMainThread()); 209 if (m_commitRequested) // Implies that a commit is in flight. 210 return; 211 // Unlike setNeedsCommit that tracks whether a commit message has been sent, 212 // setNeedsRedraw always sends a message to the compositor thread. This is 213 // because the compositor thread can draw without telling the main 214 // thread. This should not be much of a problem because calls to 215 // setNeedsRedraw messages are uncommon (only triggered by WM_PAINT/etc), 216 // compared to setNeedsCommitAndRedraw messages. 217 TRACE_EVENT("CCThreadProxy::setNeedsRedraw", this, 0); 218 ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::updateSchedulerStateOnCCThread, false, true)); 160 ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::setNeedsRedrawOnCCThread)); 219 161 } 220 162 221 163 void CCThreadProxy::start() 222 164 { 223 ASSERT(isMainThread());224 165 // Create LayerTreeHostImpl. 225 166 CCCompletionEvent completion; 226 167 ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::initializeImplOnCCThread, AllowCrossThreadAccess(&completion))); 227 168 completion.wait(); 228 229 m_started = true;230 169 } 231 170 … … 234 173 TRACE_EVENT("CCThreadProxy::stop", this, 0); 235 174 ASSERT(isMainThread()); 236 ASSERT(m_started);237 238 175 // Synchronously deletes the impl. 239 176 CCCompletionEvent completion; … … 243 180 ASSERT(!m_layerTreeHostImpl); // verify that the impl deleted. 244 181 m_layerTreeHost = 0; 245 m_started = false; 246 } 247 248 void CCThreadProxy::finishAllRenderingOnCCThread(CCCompletionEvent* completion) 249 { 250 TRACE_EVENT("CCThreadProxy::finishAllRenderingOnCCThread", this, 0); 251 ASSERT(isImplThread()); 252 ASSERT(!m_beginFrameAndCommitPendingOnCCThread); 253 if (m_redrawRequestedOnCCThread) { 254 drawLayersOnCCThread(); 255 m_layerTreeHostImpl->present(); 256 m_redrawRequestedOnCCThread = false; 257 } 258 m_layerTreeHostImpl->finishAllRendering(); 259 completion->signal(); 260 } 261 262 void CCThreadProxy::createBeginFrameAndCommitTaskOnCCThread(CCCompletionEvent* completion, CCMainThread::Task** taskPtr) 263 { 264 OwnPtr<CCMainThread::Task> task = createBeginFrameAndCommitTaskOnCCThread(); 265 *taskPtr = task.leakPtr(); 266 completion->signal(); 267 } 268 269 PassOwnPtr<CCMainThread::Task> CCThreadProxy::createBeginFrameAndCommitTaskOnCCThread() 270 { 271 TRACE_EVENT("CCThreadProxy::createBeginFrameAndCommitTaskOnCCThread", this, 0); 272 ASSERT(isImplThread()); 273 double frameBeginTime = currentTime(); 274 m_beginFrameAndCommitPendingOnCCThread = true; 275 276 // NOTE, it is possible to receieve a request for a 277 // beginFrameAndCommitOnCCThread from finishAllRendering while a 278 // beginFrameAndCommitOnCCThread is enqueued. Since it CCMainThread doesn't 279 // provide a threadsafe way to cancel tasks, it is important that 280 // beginFrameAndCommit be structured to understand that it may get called at 281 // a point that it shouldn't. We do this by assigning a sequence number to 282 // every new beginFrameAndCommit task. Then, beginFrameAndCommit tracks the 283 // last executed sequence number, dropping beginFrameAndCommit with sequence 284 // numbers below the last executed one. 285 int thisTaskSequenceNumber = m_numBeginFrameAndCommitsIssuedOnCCThread; 286 m_numBeginFrameAndCommitsIssuedOnCCThread++; 287 return createMainThreadTask(this, &CCThreadProxy::beginFrameAndCommit, thisTaskSequenceNumber, frameBeginTime); 288 } 289 290 void CCThreadProxy::beginFrameAndCommit(int sequenceNumber, double frameBeginTime) 291 { 292 TRACE_EVENT("CCThreadProxy::beginFrameAndCommit", this, 0); 182 } 183 184 void CCThreadProxy::beginFrameAndCommitOnCCThread() 185 { 186 TRACE_EVENT("CCThreadProxy::beginFrameAndCommitOnCCThread", this, 0); 187 ASSERT(isImplThread()); 188 // TEMP HACK so we can exercise this code in unit tests. 189 CCMainThread::postTask(createMainThreadTask(this, &CCThreadProxy::beginFrameAndCommit, 0.0)); 190 } 191 192 void CCThreadProxy::beginFrameAndCommit(double frameBeginTime) 193 { 293 194 ASSERT(isMainThread()); 294 195 if (!m_layerTreeHost) 295 196 return; 296 197 297 // Drop beginFrameAndCommit calls that occur out of sequence. See createBeginFrameAndCommitTaskOnCCThread for 298 // an explanation of how out-of-sequence beginFrameAndCommit tasks can occur. 299 if (sequenceNumber < m_lastExecutedBeginFrameAndCommitSequenceNumber) { 300 TRACE_EVENT("EarlyOut_StaleBeginFrameAndCommit", this, 0); 301 return; 302 } 303 m_lastExecutedBeginFrameAndCommitSequenceNumber = sequenceNumber; 304 305 ASSERT(m_commitRequested); 306 307 // FIXME: recreate the context if it was requested by the impl thread 198 TRACE_EVENT("CCThreadProxy::requestFrameAndCommit", this, 0); 308 199 { 309 200 TRACE_EVENT("CCLayerTreeHost::animateAndLayout", this, 0); … … 311 202 } 312 203 313 ASSERT(m_lastExecutedBeginFrameAndCommitSequenceNumber == sequenceNumber); 314 315 // Clear the commit flag after animateAndLayout here --- objects that only 316 // layout when painted will trigger another setNeedsCommit inside 317 // updateLayers. 318 m_commitRequested = false; 319 320 m_layerTreeHost->updateLayers(); 321 204 m_commitPending = false; 205 206 // Blocking call to CCThreadProxy::performCommit 207 CCCompletionEvent completion; 208 ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::commitOnCCThread, AllowCrossThreadAccess(&completion))); 209 completion.wait(); 210 } 211 212 void CCThreadProxy::commitOnCCThread(CCCompletionEvent* completion) 213 { 214 ASSERT(isImplThread()); 215 TRACE_EVENT("CCThreadProxy::commitOnCCThread", this, 0); 216 m_layerTreeHostImpl->beginCommit(); 322 217 { 323 // Blocking call to CCThreadProxy::commitOnCCThread 324 TRACE_EVENT("commit", this, 0); 325 CCCompletionEvent completion; 326 ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::commitOnCCThread, AllowCrossThreadAccess(&completion))); 327 completion.wait(); 328 } 329 330 m_layerTreeHost->commitComplete(); 331 332 ASSERT(m_lastExecutedBeginFrameAndCommitSequenceNumber == sequenceNumber); 333 } 334 335 void CCThreadProxy::commitOnCCThread(CCCompletionEvent* completion) 336 { 337 TRACE_EVENT("CCThreadProxy::beginFrameAndCommitOnCCThread", this, 0); 338 ASSERT(isImplThread()); 339 ASSERT(m_beginFrameAndCommitPendingOnCCThread); 340 m_beginFrameAndCommitPendingOnCCThread = false; 341 if (!m_layerTreeHostImpl) { 342 completion->signal(); 343 return; 344 } 345 m_layerTreeHostImpl->beginCommit(); 346 m_layerTreeHost->commitTo(m_layerTreeHostImpl.get()); 218 TRACE_EVENT("CCLayerTreeHost::commit", this, 0); 219 m_layerTreeHost->commitTo(m_layerTreeHostImpl.get()); 220 } 221 completion->signal(); 222 347 223 m_layerTreeHostImpl->commitComplete(); 348 349 completion->signal(); 350 351 if (m_redrawRequestedOnCCThread) 352 scheduleDrawTaskOnCCThread(); 353 } 354 355 void CCThreadProxy::scheduleDrawTaskOnCCThread() 356 { 357 ASSERT(isImplThread()); 358 if (m_drawTaskPostedOnCCThread) 359 return; 360 TRACE_EVENT("CCThreadProxy::scheduleDrawTaskOnCCThread", this, 0); 224 setNeedsRedrawOnCCThread(); 225 } 226 227 void CCThreadProxy::drawLayersOnCCThread() 228 { 229 TRACE_EVENT("CCThreadProxy::drawLayersOnCCThread", this, 0); 230 ASSERT(isImplThread()); 231 if (m_layerTreeHostImpl) 232 m_layerTreeHostImpl->drawLayers(); 233 } 234 235 void CCThreadProxy::setNeedsCommitOnCCThread() 236 { 237 TRACE_EVENT("CCThreadProxy::setNeedsCommitOnCCThread", this, 0); 238 ASSERT(isImplThread()); 361 239 ASSERT(m_layerTreeHostImpl); 362 m_drawTaskPostedOnCCThread = true; 363 ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::drawLayersAndPresentOnCCThread)); 364 } 365 366 void CCThreadProxy::drawLayersAndPresentOnCCThread() 367 { 368 TRACE_EVENT("CCThreadProxy::drawLayersOnCCThread", this, 0); 369 ASSERT(isImplThread()); 370 if (!m_layerTreeHostImpl) 371 return; 372 240 // FIXME: Not yet implemented, see https://bugs.webkit.org/show_bug.cgi?id=67417 241 ASSERT_NOT_REACHED(); 242 } 243 244 void CCThreadProxy::setNeedsCommitAndRedrawOnCCThread() 245 { 246 TRACE_EVENT("CCThreadProxy::setNeedsCommitAndRedrawOnCCThread", this, 0); 247 ASSERT(isImplThread()); 248 ASSERT(m_layerTreeHostImpl); 249 // TEMP HACK so we can exercise this code in unit tests. 250 CCMainThread::postTask(createMainThreadTask(this, &CCThreadProxy::beginFrameAndCommit, 0.0)); 251 } 252 253 void CCThreadProxy::setNeedsRedrawOnCCThread() 254 { 255 TRACE_EVENT("CCThreadProxy::setNeedsRedrawOnCCThread", this, 0); 256 // TEMP HACK so we can exercise this code in unit tests. 373 257 drawLayersOnCCThread(); 374 m_layerTreeHostImpl->present();375 m_redrawRequestedOnCCThread = false;376 m_drawTaskPostedOnCCThread = false;377 }378 379 void CCThreadProxy::drawLayersOnCCThread()380 {381 TRACE_EVENT("CCThreadProxy::drawLayersOnCCThread", this, 0);382 ASSERT(isImplThread());383 ASSERT(m_layerTreeHostImpl);384 385 m_layerTreeHostImpl->drawLayers();386 ASSERT(!m_layerTreeHostImpl->isContextLost());387 }388 389 void CCThreadProxy::updateSchedulerStateOnCCThread(bool commitRequested, bool redrawRequested)390 {391 TRACE_EVENT("CCThreadProxy::updateSchedulerStateOnCCThread", this, 0);392 ASSERT(isImplThread());393 ASSERT(m_layerTreeHostImpl);394 395 // FIXME: use CCScheduler to decide when to manage the conversion of this396 // commit request into an actual createBeginFrameAndCommitTaskOnCCThread call.397 m_redrawRequestedOnCCThread |= redrawRequested;398 if (!m_beginFrameAndCommitPendingOnCCThread)399 CCMainThread::postTask(createBeginFrameAndCommitTaskOnCCThread());400 401 // If no commit is pending, but a redraw is requested, then post a redraw right away402 if (!m_beginFrameAndCommitPendingOnCCThread && m_redrawRequestedOnCCThread)403 scheduleDrawTaskOnCCThread();404 405 258 } 406 259 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h
r95699 r95702 28 28 #include "cc/CCCompletionEvent.h" 29 29 #include "cc/CCLayerTreeHostImpl.h" 30 #include "cc/CCMainThread.h"31 30 #include "cc/CCProxy.h" 32 31 #include <wtf/OwnPtr.h> … … 60 59 61 60 // Called on CCMainThread 62 void beginFrameAndCommit( int sequenceNumber,double frameBeginTime);61 void beginFrameAndCommit(double frameBeginTime); 63 62 64 63 // Called on CCThread 65 PassOwnPtr<CCMainThread::Task> createBeginFrameAndCommitTaskOnCCThread(); 66 void createBeginFrameAndCommitTaskOnCCThread(CCCompletionEvent*, CCMainThread::Task**); 64 void beginFrameAndCommitOnCCThread(); 67 65 void commitOnCCThread(CCCompletionEvent*); 68 void drawLayersAndPresentOnCCThread();69 66 void drawLayersOnCCThread(); 70 void drawLayersAndReadbackOnCCThread(CCCompletionEvent*, bool* success, void* pixels, const IntRect&);71 void finishAllRenderingOnCCThread(CCCompletionEvent*);72 67 void initializeImplOnCCThread(CCCompletionEvent*); 73 68 void initializeLayerRendererOnCCThread(GraphicsContext3D*, CCCompletionEvent*, bool* initializeSucceeded, LayerRendererCapabilities*); 74 69 void setNeedsCommitOnCCThread(); 75 void updateSchedulerStateOnCCThread(bool commitRequested, bool redrawRequested); 70 void setNeedsCommitAndRedrawOnCCThread(); 71 void setNeedsRedrawOnCCThread(); 76 72 void layerTreeHostClosedOnCCThread(CCCompletionEvent*); 77 void scheduleDrawTaskOnCCThread(); 73 74 // Used on main-thread only. 75 bool m_commitPending; 78 76 79 77 // Accessed on main thread only. 80 bool m_commitRequested;81 78 CCLayerTreeHost* m_layerTreeHost; 82 79 LayerRendererCapabilities m_layerRendererCapabilitiesMainThreadCopy; 83 bool m_started;84 int m_lastExecutedBeginFrameAndCommitSequenceNumber;85 80 86 // Used on the CCThread only81 // Used on the CCThread, but checked on main thread during initialization/shutdown. 87 82 OwnPtr<CCLayerTreeHostImpl> m_layerTreeHostImpl; 88 int m_numBeginFrameAndCommitsIssuedOnCCThread;89 bool m_beginFrameAndCommitPendingOnCCThread;90 bool m_drawTaskPostedOnCCThread;91 bool m_redrawRequestedOnCCThread;92 83 }; 93 84 -
trunk/Source/WebKit/chromium/ChangeLog
r95699 r95702 1 2011-09-22 James Robinson <jamesr@chromium.org> 2 3 Unreviewed, rolling out r95699. 4 http://trac.webkit.org/changeset/95699 5 https://bugs.webkit.org/show_bug.cgi?id=67417 6 7 Makes many chromium compositor tests crash 8 9 * tests/CCLayerTreeHostTest.cpp: 10 (WTF::CCLayerTreeHostTest::doBeginTest): 11 (WTF::TEST_F): 12 * tests/TreeSynchronizerTest.cpp: 13 (WebCore::TEST): 14 1 15 2011-09-22 Nat Duca <nduca@chromium.org> 2 16 -
trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp
r95699 r95702 171 171 } 172 172 173 #if !USE(THREADED_COMPOSITING)174 virtual void scheduleComposite() { }175 #endif176 177 173 private: 178 174 explicit MockLayerTreeHostClient(TestHooks* testHooks) : m_testHooks(testHooks) { } … … 191 187 // The test continues until someone calls endTest. endTest can be called on any thread, but be aware that 192 188 // ending the test is an asynchronous process. 193 class CCLayerTreeHostTest : public testing::TestWithParam<CCSettings>, TestHooks { 194 public: 195 virtual void SetUp() 196 { 197 } 189 class CCLayerTreeHostTest : public testing::Test, TestHooks { 190 public: 198 191 virtual void afterTest() = 0; 199 192 virtual void beginTest() = 0; … … 295 288 m_client = MockLayerTreeHostClient::create(this); 296 289 290 CCSettings settings; 291 settings.enableCompositorThread = true; 297 292 RefPtr<LayerChromium> rootLayer; 298 m_layerTreeHost = MockLayerTreeHost::create(this, m_client.get(), rootLayer, GetParam());293 m_layerTreeHost = MockLayerTreeHost::create(this, m_client.get(), rootLayer, settings); 299 294 ASSERT(m_layerTreeHost); 300 295 … … 305 300 onEndTest(static_cast<void*>(this)); 306 301 } 307 INSTANTIATE_TEST_CASE_P(308 ProxyTests, CCLayerTreeHostTest,309 testing::Values(310 CCSettings(false, false, false, false, false),311 CCSettings(false, false, true, false, false)));312 302 313 303 void CCLayerTreeHostTest::endTest() … … 556 546 TEST_F(CCLayerTreeHostTestSetNeedsRedraw, run) 557 547 { 558 CCSettings setings;559 548 runTest(); 560 549 } … … 562 551 } // namespace 563 552 564 #endif 553 #endif // USE(THREADED_COMPOSITING) -
trunk/Source/WebKit/chromium/tests/TreeSynchronizerTest.cpp
r95699 r95702 29 29 #include "LayerChromium.h" 30 30 #include "cc/CCLayerImpl.h" 31 #include "cc/CCProxy.h"32 31 #include <gtest/gtest.h> 33 32 … … 35 34 36 35 namespace { 37 38 class ScopedSetImplThread {39 public:40 ScopedSetImplThread()41 {42 #ifndef NDEBUG43 CCProxy::setImplThread(true);44 #endif45 }46 ~ScopedSetImplThread()47 {48 #ifndef NDEBUG49 CCProxy::setImplThread(false);50 #endif51 }52 };53 36 54 37 class MockCCLayerImpl : public CCLayerImpl { … … 134 117 TEST(TreeSynchronizerTest, syncSimpleTreeFromEmpty) 135 118 { 136 ScopedSetImplThread impl;137 119 RefPtr<LayerChromium> layerTreeRoot = LayerChromium::create(0); 138 120 layerTreeRoot->addChild(LayerChromium::create(0)); … … 147 129 TEST(TreeSynchronizerTest, syncSimpleTreeReusingLayers) 148 130 { 149 ScopedSetImplThread impl;150 131 Vector<int> ccLayerDestructionList; 151 132 … … 173 154 TEST(TreeSynchronizerTest, syncSimpleTreeAndProperties) 174 155 { 175 ScopedSetImplThread impl;176 156 RefPtr<LayerChromium> layerTreeRoot = LayerChromium::create(0); 177 157 layerTreeRoot->addChild(LayerChromium::create(0)); … … 205 185 TEST(TreeSynchronizerTest, reuseCCLayersAfterStructuralChange) 206 186 { 207 ScopedSetImplThread impl;208 187 Vector<int> ccLayerDestructionList; 209 188 … … 252 231 TEST(TreeSynchronizerTest, syncSimpleTreeThenDestroy) 253 232 { 254 ScopedSetImplThread impl;255 233 Vector<int> ccLayerDestructionList; 256 234 … … 283 261 TEST(TreeSynchronizerTest, syncMaskReplicaAndReplicaMaskLayers) 284 262 { 285 ScopedSetImplThread impl;286 263 RefPtr<LayerChromium> layerTreeRoot = LayerChromium::create(0); 287 264 layerTreeRoot->addChild(LayerChromium::create(0));
Note: See TracChangeset
for help on using the changeset viewer.