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

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: Merge to ToT for Time => TimeTicks. Sanitize the times. More covergae on test. 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..a7f653d5aa82cf25fedbb9bb92c0249773021f23 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 kCommandLastActiveTime = 21;
namespace {
@@ -89,6 +90,11 @@ struct PinnedStatePayload {
bool pinned_state;
};
+struct LastActiveTimePayload {
+ SessionID::id_type tab_id;
+ int64 last_active_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 kCommandLastActiveTime: {
+ LastActiveTimePayload 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_active_time =
+ base::TimeTicks::FromInternalValue(payload.last_active_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> CreateLastActiveTimeCommand(
+ const SessionID& tab_id,
+ base::TimeTicks last_active_time) {
+ LastActiveTimePayload payload = {0};
+ payload.tab_id = tab_id.id();
+ payload.last_active_time = last_active_time.ToInternalValue();
+ scoped_ptr<SessionCommand> command(
+ new SessionCommand(kCommandLastActiveTime, 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