Commit 841ca3e4 authored by Francois Doray's avatar Francois Doray Committed by Commit Bot

[session restore] CHECK that restored browsers have an active tab.

https://crbug.com/1032348 tells us that there are browsers with no
active tab in some cases when --restore-last-session is specified. To
get a better undertanding of the problem, this CL adds a CHECK to
get a crash report if a Browser doesn't have an active tab at the
end of SessionRestoreImpl::ProcessSessionWindows().

Bug: 1032348
Change-Id: Ic6919429ba9a1ece3a21230c0d63c9d2bb2a79bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1966523
Commit-Queue: Chris Hamilton <chrisha@chromium.org>
Reviewed-by: default avatarChris Hamilton <chrisha@chromium.org>
Cr-Commit-Position: refs/heads/master@{#725989}
parent 127ff385
...@@ -472,6 +472,11 @@ class SessionRestoreImpl : public BrowserListObserver { ...@@ -472,6 +472,11 @@ class SessionRestoreImpl : public BrowserListObserver {
// restore, if needed. // restore, if needed.
if (close_active_tab) if (close_active_tab)
chrome::CloseWebContents(browser, active_tab, true); chrome::CloseWebContents(browser, active_tab, true);
// Sanity check: A restored browser should have an active tab.
// TODO(https://crbug.com/1032348): Change to DCHECK once we understand
// why some browsers don't have an active tab on startup.
CHECK(browser->tab_strip_model()->GetActiveWebContents());
} }
if (browser_to_activate && browser_to_activate->is_type_normal()) if (browser_to_activate && browser_to_activate->is_type_normal())
...@@ -531,7 +536,9 @@ class SessionRestoreImpl : public BrowserListObserver { ...@@ -531,7 +536,9 @@ class SessionRestoreImpl : public BrowserListObserver {
int initial_tab_count, int initial_tab_count,
std::vector<RestoredTab>* created_contents) { std::vector<RestoredTab>* created_contents) {
DVLOG(1) << "RestoreTabsToBrowser " << window.tabs.size(); DVLOG(1) << "RestoreTabsToBrowser " << window.tabs.size();
DCHECK(!window.tabs.empty()); // TODO(https://crbug.com/1032348): Change to DCHECK once we understand
// why some browsers don't have an active tab on startup.
CHECK(!window.tabs.empty());
base::TimeTicks now = base::TimeTicks::Now(); base::TimeTicks now = base::TimeTicks::Now();
base::TimeTicks latest_last_active_time = base::TimeTicks::UnixEpoch(); base::TimeTicks latest_last_active_time = base::TimeTicks::UnixEpoch();
// The last active time of a WebContents is initially set to the // The last active time of a WebContents is initially set to the
......
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