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

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

Issue 694813003: Changing SessionService to have a BaseSessionService, not being one. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed browser tests Created 6 years, 1 month 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_service_commands.cc
diff --git a/chrome/browser/sessions/session_service_commands.cc b/chrome/browser/sessions/session_service_commands.cc
index 5b8f5c8fd135e243320a2ce4c41115a803baa68d..21e96dcbe65db8bd97149005241f85bd4a5c3fb3 100644
--- a/chrome/browser/sessions/session_service_commands.cc
+++ b/chrome/browser/sessions/session_service_commands.cc
@@ -755,7 +755,7 @@ scoped_ptr<SessionCommand> CreateSetWindowAppNameCommand(
app_name);
}
-bool ReplacePendingCommand(ScopedVector<SessionCommand>& pending_commands,
+bool ReplacePendingCommand(BaseSessionService* base_session_service,
scoped_ptr<SessionCommand>* command) {
// We optimize page navigations, which can happen quite frequently and
// is expensive. And activation is like Highlander, there can only be one!
@@ -763,8 +763,9 @@ bool ReplacePendingCommand(ScopedVector<SessionCommand>& pending_commands,
(*command)->id() != kCommandSetActiveWindow) {
return false;
}
- for (ScopedVector<SessionCommand>::reverse_iterator i =
- pending_commands.rbegin(); i != pending_commands.rend(); ++i) {
+ for (ScopedVector<SessionCommand>::const_reverse_iterator i =
+ base_session_service->pending_commands().rbegin();
+ i != base_session_service->pending_commands().rend(); ++i) {
SessionCommand* existing_command = *i;
if ((*command)->id() == kCommandUpdateTabNavigation &&
existing_command->id() == kCommandUpdateTabNavigation) {
@@ -794,17 +795,15 @@ bool ReplacePendingCommand(ScopedVector<SessionCommand>& pending_commands,
// existing_command is an update for the same tab/index pair. Replace
// it with the new one. We need to add to the end of the list just in
// case there is a prune command after the update command.
- // Note: ScopedVector::erase will also delete the element.
- pending_commands.erase(i.base() - 1);
- pending_commands.push_back((*command).release());
+ base_session_service->EraseCommand(*(i.base() - 1));
+ base_session_service->AppendRebuildCommand((*command).Pass());
return true;
}
return false;
}
if ((*command)->id() == kCommandSetActiveWindow &&
existing_command->id() == kCommandSetActiveWindow) {
- *i = (*command).release();
- delete existing_command;
+ base_session_service->SwapCommand(existing_command, (*command).Pass());
return true;
}
}
« no previous file with comments | « chrome/browser/sessions/session_service_commands.h ('k') | chrome/browser/sessions/session_service_test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698