Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(758)

Unified Diff: chrome/browser/sessions/session_restore.cc

Issue 1131373003: [Session restore] Add MRU logic to loading of background pages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sessions/session_restore.cc
diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc
index c6692162035c06fdb0cb02d7c1b7714f178e2d53..134397d09e0fc4d95941ac26bfc502f94d308a22 100644
--- a/chrome/browser/sessions/session_restore.cc
+++ b/chrome/browser/sessions/session_restore.cc
@@ -521,7 +521,8 @@ class SessionRestoreImpl : public content::NotificationObserver {
continue;
RestoredTab restored_tab(contents, is_selected_tab,
- tab.extension_app_id.empty(), tab.pinned);
+ tab.extension_app_id.empty(), tab.pinned,
+ tab.last_activation_time);
created_contents->push_back(restored_tab);
// If this isn't the selected tab, there's nothing else to do.
@@ -545,7 +546,8 @@ class SessionRestoreImpl : public content::NotificationObserver {
RestoreTab(tab, tab_index_offset + i, browser, false);
if (contents) {
RestoredTab restored_tab(contents, false,
- tab.extension_app_id.empty(), tab.pinned);
+ tab.extension_app_id.empty(), tab.pinned,
+ tab.last_activation_time);
created_contents->push_back(restored_tab);
}
}
@@ -591,6 +593,12 @@ class SessionRestoreImpl : public content::NotificationObserver {
// focused tab will be loaded by Browser, and TabLoader will load the rest.
DCHECK(web_contents->GetController().NeedsReload());
+ // Restore the saved activation time. By default, the activation time of a
+ // WebContent is initially set to the creation time of the tab, which is not
+ // necessarly the same as the loading time. This makes sure that the state
+ // is preserved between restores.
+ web_contents->SetLastActiveTime(tab.last_activation_time);
sky 2015/05/12 21:25:29 It's my understanding there is no guarantee that t
Georges Khalil 2015/05/15 16:55:30 You are right, if the OS reboots, TimeTicks become
sky 2015/05/18 15:53:28 I think time ticks is safer as blocks can go back.
Georges Khalil 2015/05/19 19:32:15 I'm not sure how we could sanitize time ticks, as
sky 2015/05/19 19:55:16 After you've read the data in all we care about is
gab 2015/05/20 17:08:57 I'm not convinced that this is true. For example,
+
return web_contents;
}

Powered by Google App Engine
This is Rietveld 408576698