| Index: chrome/browser/sessions/session_backend.cc
|
| diff --git a/chrome/browser/sessions/session_backend.cc b/chrome/browser/sessions/session_backend.cc
|
| index c62adf4e8855e2bbc89010e953fa44e99a515f7d..825b8114d4a966f5ec17c1be118f2fa0c6d08f8f 100644
|
| --- a/chrome/browser/sessions/session_backend.cc
|
| +++ b/chrome/browser/sessions/session_backend.cc
|
| @@ -52,7 +52,7 @@ class SessionFileReader {
|
| // true on success. It is up to the caller to free all SessionCommands
|
| // added to commands.
|
| bool Read(BaseSessionService::SessionType type,
|
| - std::vector<SessionCommand*>* commands);
|
| + ScopedVector<SessionCommand>* commands);
|
|
|
| private:
|
| // Reads a single command, returning it. A return value of NULL indicates
|
| @@ -86,7 +86,7 @@ class SessionFileReader {
|
| };
|
|
|
| bool SessionFileReader::Read(BaseSessionService::SessionType type,
|
| - std::vector<SessionCommand*>* commands) {
|
| + ScopedVector<SessionCommand>* commands) {
|
| if (!file_->IsValid())
|
| return false;
|
| FileHeader header;
|
| @@ -221,7 +221,7 @@ void SessionBackend::Init() {
|
| }
|
|
|
| void SessionBackend::AppendCommands(
|
| - std::vector<SessionCommand*>* commands,
|
| + ScopedVector<SessionCommand>* commands,
|
| bool reset_first) {
|
| Init();
|
| // Make sure and check current_session_file_, if opening the file failed
|
| @@ -236,7 +236,7 @@ void SessionBackend::AppendCommands(
|
| current_session_file_.reset(NULL);
|
| }
|
| empty_file_ = false;
|
| - STLDeleteElements(commands);
|
| + // Deleting the ScopedVector will also delete its elements.
|
| delete commands;
|
| }
|
|
|
| @@ -249,12 +249,12 @@ void SessionBackend::ReadLastSessionCommands(
|
| Init();
|
|
|
| ScopedVector<SessionCommand> commands;
|
| - ReadLastSessionCommandsImpl(&(commands.get()));
|
| + ReadLastSessionCommandsImpl(&commands);
|
| callback.Run(commands.Pass());
|
| }
|
|
|
| bool SessionBackend::ReadLastSessionCommandsImpl(
|
| - std::vector<SessionCommand*>* commands) {
|
| + ScopedVector<SessionCommand>* commands) {
|
| Init();
|
| SessionFileReader file_reader(GetLastSessionPath());
|
| return file_reader.Read(type_, commands);
|
| @@ -295,15 +295,15 @@ void SessionBackend::MoveCurrentSessionToLastSession() {
|
| }
|
|
|
| bool SessionBackend::ReadCurrentSessionCommandsImpl(
|
| - std::vector<SessionCommand*>* commands) {
|
| + ScopedVector<SessionCommand>* commands) {
|
| Init();
|
| SessionFileReader file_reader(GetCurrentSessionPath());
|
| return file_reader.Read(type_, commands);
|
| }
|
|
|
| bool SessionBackend::AppendCommandsToFile(base::File* file,
|
| - const std::vector<SessionCommand*>& commands) {
|
| - for (std::vector<SessionCommand*>::const_iterator i = commands.begin();
|
| + const ScopedVector<SessionCommand>& commands) {
|
| + for (ScopedVector<SessionCommand>::const_iterator i = commands.begin();
|
| i != commands.end(); ++i) {
|
| int wrote;
|
| const size_type content_size = static_cast<size_type>((*i)->size());
|
|
|