Commit a87edf63 authored by sreeram@chromium.org's avatar sreeram@chromium.org

Always call WasShown() before trying to paint.

See the bug link for details on the crash that this CL is attempting to fix.
Although I haven't been able to reproduce the crash locally, my intuition is
that, when we call window->ShowInstant(), sometimes it tries to paint, and
since the RenderWidgetHostView hasn't yet been told that it's being shown, it
fails the DCHECK(). So, reorder the calls so that WasShown() is always called
before any change to the Instant overlay layout (ShowInstant/HideInstant).

BUG=143207
R=sky@chromium.org
TEST=Watch try bots/waterfall; Instant shouldn't fire this DCHECK().

Review URL: https://chromiumcodereview.appspot.com/10828374

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152348 0039d316-1c4b-4281-b951-d872f2087c98
parent 9dc6e59d
......@@ -583,8 +583,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, TransitionsBetweenSearchAndURL) {
}
// Test that Instant can't be fooled into committing a URL.
// Disabled: http://crbug.com/143207
IN_PROC_BROWSER_TEST_F(InstantTest, DISABLED_DoesNotCommitURLs) {
IN_PROC_BROWSER_TEST_F(InstantTest, DoesNotCommitURLs) {
ASSERT_NO_FATAL_FAILURE(SetupInstant("instant.html"));
EXPECT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
......
......@@ -78,6 +78,7 @@ bool BrowserInstantController::OpenInstant(WindowOpenDisposition disposition) {
void BrowserInstantController::ShowInstant() {
TabContents* preview = instant_->GetPreviewContents();
preview->web_contents()->WasShown();
browser_->window()->ShowInstant(preview);
content::NotificationService::current()->Notify(
......@@ -88,10 +89,12 @@ void BrowserInstantController::ShowInstant() {
// TODO(beng): Investigate if we can avoid this and instead rely on the
// visibility of the WebContentsView.
chrome::GetActiveWebContents(browser_)->WasHidden();
preview->web_contents()->WasShown();
}
void BrowserInstantController::HideInstant() {
if (chrome::GetActiveWebContents(browser_))
chrome::GetActiveWebContents(browser_)->WasShown();
browser_->window()->HideInstant();
content::NotificationService::current()->Notify(
......@@ -99,8 +102,6 @@ void BrowserInstantController::HideInstant() {
content::Source<InstantController>(instant()),
content::NotificationService::NoDetails());
if (chrome::GetActiveWebContents(browser_))
chrome::GetActiveWebContents(browser_)->WasShown();
if (TabContents* preview = instant_->GetPreviewContents())
preview->web_contents()->WasHidden();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment