Bug 77049

Summary: [Chromium] Force compositeAndReadback through regular scheduling flow
Product: WebKit Reporter: David Reveman <reveman>
Component: WebCore Misc.Assignee: Nat Duca <nduca>
Status: RESOLVED FIXED    
Severity: Normal CC: cc-bugs, jamesr, nduca, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch for landing none

David Reveman
Reported 2012-01-25 14:20:24 PST
Scheduler currently assumes that beginFrameComplete is only called after scheduledActionBeginFrame(). That's not the case for compositeAndReadback which might trigger a call to beginFrameComplete in different situations. This can currently cause an assertion failure in debug builds.
Attachments
Patch (5.54 KB, patch)
2012-01-25 14:23 PST, David Reveman
no flags
Patch (6.64 KB, patch)
2012-01-26 11:58 PST, David Reveman
no flags
Patch (29.80 KB, patch)
2012-03-09 01:45 PST, Nat Duca
no flags
Patch for landing (29.50 KB, patch)
2012-03-12 12:30 PDT, Nat Duca
no flags
David Reveman
Comment 1 2012-01-25 14:23:48 PST
David Reveman
Comment 2 2012-01-25 14:29:52 PST
The attached patch addresses this by simply changing the assumptions made about when beginFrameComplete can be called. Maybe we want to follow up with some larger changes to how compositeAndReadback interacts with the scheduler but I think this change is good enough as a bugfix+unittest patch.
David Reveman
Comment 3 2012-01-26 11:58:48 PST
David Reveman
Comment 4 2012-01-26 12:01:06 PST
*** Bug 72908 has been marked as a duplicate of this bug. ***
David Reveman
Comment 5 2012-01-26 12:02:40 PST
Included a fix for https://bugs.webkit.org/show_bug.cgi?id=72908 as it's very much part of the same problem.
Nat Duca
Comment 6 2012-01-26 12:22:00 PST
Can you describe the sequence of events that is currently broken?
David Reveman
Comment 7 2012-01-26 13:31:51 PST
(In reply to comment #6) > Can you describe the sequence of events that is currently broken? The unit test covers the sequences I found to be broken. Here's one of them: ImplThread - setVisible(false), e.g. the page is a background tab. MainThread - setNeedsCommit, some change to the page cause this to be called. MainThread - compositeAndReadback, is called before the scheduler schedules a BeginFrame action. MainThread - beginFrameAndCommit, is called as pending commit exists. ImplThread - beginFrameCompleteOnImplThread, blows up in debug mode as scheduler commit state is not COMMIT_STATE_FRAME_IN_PROGRESS when beginFrameComplete() is called.
James Robinson
Comment 8 2012-02-21 22:49:47 PST
Can we make compositeAndReadback() forcibly kick the scheduler into the right state instead of making the scheduler ASSERT()s universally more liberal? compositeAndReadback() is very much a special case, and one that we'd like to get rid of. I can't speak for Nat but I know that I'd be happier with that particular codepath setting funky bits explicitly instead of all scheduler / state machine logic needing to be aware of otherwise nonsensical states.
Nat Duca
Comment 9 2012-03-07 12:26:39 PST
Thanks for the reproduce case! I'm going to try to fix this by changing the compositeAndReadback flow to never create a beginFrameAndCommitTask in the first place.
Nat Duca
Comment 10 2012-03-09 01:45:50 PST
James Robinson
Comment 11 2012-03-09 14:04:19 PST
Comment on attachment 131007 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=131007&action=review Very nice! I think we have a wee bit o' a memory leak, but easily fixable. R=me > Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp:397 > + m_pendingBeginFrameRequest = new BeginFrameAndCommitState(); if we schedule a begin frame from the impl thread, but then start a shutdown from the main thread before we process the message will we end up leaking this pointer? maybe m_pendingBeginFrameRequest should be an OwnPtr<> member - i think if we have to shut down the compositor with a beginFrame pending the right thing to do is to free up its memory and just don't worry about the scroll offsets/etc on it
Nat Duca
Comment 12 2012-03-09 14:05:38 PST
(In reply to comment #11) > (From update of attachment 131007 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=131007&action=review > > Very nice! I think we have a wee bit o' a memory leak, but easily fixable. Hahaha whomp. Will fix that up. Thanks!
Nat Duca
Comment 13 2012-03-12 12:30:49 PDT
Created attachment 131381 [details] Patch for landing
WebKit Review Bot
Comment 14 2012-03-12 13:08:38 PDT
Comment on attachment 131381 [details] Patch for landing Clearing flags on attachment: 131381 Committed r110464: <http://trac.webkit.org/changeset/110464>
WebKit Review Bot
Comment 15 2012-03-12 13:08:43 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.