Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Assertion failure in LayerFlushScheduler::resume() when running some …
…layout tests in WebKitTestRunner

https://bugs.webkit.org/show_bug.cgi?id=72535

Reviewed by Anders Carlsson.

LayerFlushScheduler attempted to use a counter strategy for calls to
suspend() and resume(), which allowed us to assert that these calls
were balanced. Unfortunately it is hard to guarantee this in WebKit2,
where we sometimes try to call suspend() before we've entered
compositing mode (hence before we have a LayerTreeHost and a
LayerFlushScheduler). When we later call resume(), this call ends up
being unbalanced and asserts.

For now, remove the assertions and allow unbalanced calls to suspend()
and resume().

* platform/graphics/ca/LayerFlushScheduler.cpp:
(WebCore::LayerFlushScheduler::suspend):
(WebCore::LayerFlushScheduler::resume):
* platform/graphics/ca/LayerFlushScheduler.h:
* platform/graphics/ca/mac/LayerFlushSchedulerMac.cpp:
(WebCore::LayerFlushScheduler::LayerFlushScheduler):
(WebCore::LayerFlushScheduler::runLoopObserverCallback):
(WebCore::LayerFlushScheduler::schedule):

Canonical link: https://commits.webkit.org/89018@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@100492 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
aestes committed Nov 16, 2011
1 parent 514f746 commit 649cb39
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 11 deletions.
27 changes: 27 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,30 @@
2011-11-16 Andy Estes <aestes@apple.com>

Assertion failure in LayerFlushScheduler::resume() when running some layout tests in WebKitTestRunner
https://bugs.webkit.org/show_bug.cgi?id=72535

Reviewed by Anders Carlsson.

LayerFlushScheduler attempted to use a counter strategy for calls to
suspend() and resume(), which allowed us to assert that these calls
were balanced. Unfortunately it is hard to guarantee this in WebKit2,
where we sometimes try to call suspend() before we've entered
compositing mode (hence before we have a LayerTreeHost and a
LayerFlushScheduler). When we later call resume(), this call ends up
being unbalanced and asserts.

For now, remove the assertions and allow unbalanced calls to suspend()
and resume().

* platform/graphics/ca/LayerFlushScheduler.cpp:
(WebCore::LayerFlushScheduler::suspend):
(WebCore::LayerFlushScheduler::resume):
* platform/graphics/ca/LayerFlushScheduler.h:
* platform/graphics/ca/mac/LayerFlushSchedulerMac.cpp:
(WebCore::LayerFlushScheduler::LayerFlushScheduler):
(WebCore::LayerFlushScheduler::runLoopObserverCallback):
(WebCore::LayerFlushScheduler::schedule):

2011-11-16 Sheriff Bot <webkit.review.bot@gmail.com>

Unreviewed, rolling out r100473.
Expand Down
15 changes: 8 additions & 7 deletions Source/WebCore/platform/graphics/ca/LayerFlushScheduler.cpp
Expand Up @@ -33,19 +33,20 @@ namespace WebCore {

void LayerFlushScheduler::suspend()
{
if (!m_suspendCount)
invalidate();
if (m_isSuspended)
return;

++m_suspendCount;
m_isSuspended = true;
invalidate();
}

void LayerFlushScheduler::resume()
{
ASSERT(m_suspendCount);
--m_suspendCount;
if (!m_isSuspended)
return;

if (!m_suspendCount)
schedule();
m_isSuspended = false;
schedule();
}

} // namespace WebCore
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/platform/graphics/ca/LayerFlushScheduler.h
Expand Up @@ -47,7 +47,7 @@ class LayerFlushScheduler {
void resume();

private:
unsigned int m_suspendCount;
bool m_isSuspended;
LayerFlushSchedulerClient* m_client;

#if PLATFORM(MAC)
Expand Down
Expand Up @@ -35,7 +35,7 @@ static const CFIndex CoreAnimationRunLoopOrder = 2000000;
static const CFIndex LayerFlushRunLoopOrder = CoreAnimationRunLoopOrder - 1;

LayerFlushScheduler::LayerFlushScheduler(LayerFlushSchedulerClient* client)
: m_suspendCount(0)
: m_isSuspended(false)
, m_client(client)
{
ASSERT_ARG(client, client);
Expand All @@ -50,13 +50,13 @@ void LayerFlushScheduler::runLoopObserverCallback(CFRunLoopObserverRef, CFRunLoo
{
LayerFlushScheduler* layerFlushScheduler = static_cast<LayerFlushScheduler*>(context);
ASSERT(layerFlushScheduler->m_runLoopObserver);
ASSERT(!layerFlushScheduler->m_suspendCount);
ASSERT(!layerFlushScheduler->m_isSuspended);
layerFlushScheduler->m_client->flushLayers();
}

void LayerFlushScheduler::schedule()
{
if (m_suspendCount)
if (m_isSuspended)
return;

CFRunLoopRef currentRunLoop = CFRunLoopGetCurrent();
Expand Down

0 comments on commit 649cb39

Please sign in to comment.