Commit bd6d9522 authored by Christian Dullweber's avatar Christian Dullweber Committed by Commit Bot

Fix session restore on ChromeOS

SessionRestore on Chrome OS in a non-OWNER profile and with any flag
enabled doesn't work correctly after logout/login.
This was caused by the change to allow saving a session file
without commands. (https://crrev.com/c/899249)
This CL reverts the problematic parts and fixes session restore.

Bug: 816586
Change-Id: I4a5050c532143c4fa9990e153952a82b72e3385f
Reviewed-on: https://chromium-review.googlesource.com/978214Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Christian Dullweber <dullweber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#546071}
parent db354a32
...@@ -133,7 +133,7 @@ void BaseSessionService::Save() { ...@@ -133,7 +133,7 @@ void BaseSessionService::Save() {
// opportunity to append more commands. // opportunity to append more commands.
delegate_->OnWillSaveCommands(); delegate_->OnWillSaveCommands();
if (pending_commands_.empty() && !pending_reset_) if (pending_commands_.empty())
return; return;
// We create a new vector which will receive all elements from the // We create a new vector which will receive all elements from the
......
...@@ -534,7 +534,9 @@ void PersistentTabRestoreService::Delegate::OnClearEntries() { ...@@ -534,7 +534,9 @@ void PersistentTabRestoreService::Delegate::OnClearEntries() {
// Schedule a pending reset so that we nuke the file on next write. // Schedule a pending reset so that we nuke the file on next write.
base_session_service_->set_pending_reset(true); base_session_service_->set_pending_reset(true);
base_session_service_->StartSaveTimer(); // Schedule a command, otherwise if there are no pending commands Save does
// nothing.
base_session_service_->ScheduleCommand(CreateRestoredEntryCommand(1));
} }
void PersistentTabRestoreService::Delegate::OnNavigationEntriesDeleted() { void PersistentTabRestoreService::Delegate::OnNavigationEntriesDeleted() {
...@@ -543,7 +545,9 @@ void PersistentTabRestoreService::Delegate::OnNavigationEntriesDeleted() { ...@@ -543,7 +545,9 @@ void PersistentTabRestoreService::Delegate::OnNavigationEntriesDeleted() {
// Schedule a pending reset so that we nuke the file on next write. // Schedule a pending reset so that we nuke the file on next write.
base_session_service_->set_pending_reset(true); base_session_service_->set_pending_reset(true);
base_session_service_->StartSaveTimer(); // Schedule a command, otherwise if there are no pending commands Save does
// nothing.
base_session_service_->ScheduleCommand(CreateRestoredEntryCommand(1));
} }
void PersistentTabRestoreService::Delegate::OnRestoreEntryById( void PersistentTabRestoreService::Delegate::OnRestoreEntryById(
......
...@@ -231,8 +231,7 @@ void SessionBackend::AppendCommands( ...@@ -231,8 +231,7 @@ void SessionBackend::AppendCommands(
!AppendCommandsToFile(current_session_file_.get(), commands)) { !AppendCommandsToFile(current_session_file_.get(), commands)) {
current_session_file_.reset(nullptr); current_session_file_.reset(nullptr);
} }
if (!commands.empty()) empty_file_ = false;
empty_file_ = false;
} }
void SessionBackend::ReadLastSessionCommands( void SessionBackend::ReadLastSessionCommands(
......
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