Index: chrome/browser/sessions/base_session_service.cc |
diff --git a/chrome/browser/sessions/base_session_service.cc b/chrome/browser/sessions/base_session_service.cc |
index 05d61bf7213b1a55a42df2c457d4335db8df9d81..fa988d355e797892fb3ef2f9f42595020b703cf9 100644 |
--- a/chrome/browser/sessions/base_session_service.cc |
+++ b/chrome/browser/sessions/base_session_service.cc |
@@ -67,10 +67,10 @@ void BaseSessionService::DeleteLastSession() { |
base::Bind(&SessionBackend::DeleteLastSession, backend())); |
} |
-void BaseSessionService::ScheduleCommand(SessionCommand* command) { |
+void BaseSessionService::ScheduleCommand(scoped_ptr<SessionCommand> command) { |
DCHECK(command); |
commands_since_reset_++; |
- pending_commands_.push_back(command); |
+ pending_commands_.push_back(command.release()); |
StartSaveTimer(); |
} |
@@ -91,15 +91,14 @@ void BaseSessionService::Save() { |
if (pending_commands_.empty()) |
return; |
+ // We create a new ScopedVector which will receive all elements from the |
+ // current commands. This will also clear the current list. |
RunTaskOnBackendThread( |
FROM_HERE, |
base::Bind(&SessionBackend::AppendCommands, backend(), |
- new std::vector<SessionCommand*>(pending_commands_), |
+ new ScopedVector<SessionCommand>(pending_commands_.Pass()), |
pending_reset_)); |
- // Backend took ownership of commands. |
- pending_commands_.clear(); |
- |
if (pending_reset_) { |
commands_since_reset_ = 0; |
pending_reset_ = false; |