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

Unified Diff: components/sessions/session_service_commands.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: components/sessions/session_service_commands.cc
diff --git a/components/sessions/session_service_commands.cc b/components/sessions/session_service_commands.cc
index eca2b4d718186d97d38fa77917213f3cb6cd34ac..f2bb9ea869913a7ac4eb7dd1fc05e9c62c7fc3ff 100644
--- a/components/sessions/session_service_commands.cc
+++ b/components/sessions/session_service_commands.cc
@@ -38,6 +38,7 @@ static const SessionCommand::id_type kCommandWindowClosed = 17;
static const SessionCommand::id_type kCommandSetTabUserAgentOverride = 18;
static const SessionCommand::id_type kCommandSessionStorageAssociated = 19;
static const SessionCommand::id_type kCommandSetActiveWindow = 20;
+static const SessionCommand::id_type kCommandActivationTime = 21;
namespace {
@@ -89,6 +90,11 @@ struct PinnedStatePayload {
bool pinned_state;
};
+struct ActivationTimePayload {
+ SessionID::id_type tab_id;
+ int64 last_activation_time;
+};
+
// Persisted versions of ui::WindowShowState that are written to disk and can
// never change.
enum PersistedWindowShowState {
@@ -558,6 +564,18 @@ bool CreateTabsAndWindows(const ScopedVector<SessionCommand>& data,
break;
}
+ case kCommandActivationTime: {
+ ActivationTimePayload payload;
+ if (!command->GetPayload(&payload, sizeof(payload))) {
+ DVLOG(1) << "Failed reading command " << command->id();
+ return true;
+ }
+ SessionTab* tab = GetTab(payload.tab_id, tabs);
+ tab->last_activation_time =
+ base::TimeTicks::FromInternalValue(payload.last_activation_time);
+ break;
+ }
+
default:
// TODO(skuhne): This might call back into a callback handler to extend
// the command set for specific implementations.
@@ -704,6 +722,18 @@ scoped_ptr<SessionCommand> CreateSetActiveWindowCommand(
return command;
}
+scoped_ptr<SessionCommand> CreateActivationTimeCommand(
+ const SessionID& tab_id,
+ base::TimeTicks activation_time) {
+ ActivationTimePayload payload = {0};
+ payload.tab_id = tab_id.id();
+ payload.last_activation_time = activation_time.ToInternalValue();
+ scoped_ptr<SessionCommand> command(
+ new SessionCommand(kCommandActivationTime, sizeof(payload)));
+ memcpy(command->contents(), &payload, sizeof(payload));
+ return command;
+}
+
scoped_ptr<SessionCommand> CreateTabNavigationPathPrunedFromBackCommand(
const SessionID& tab_id,
int count) {

Powered by Google App Engine
This is Rietveld 408576698