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

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

Issue 685133004: Handling |SessionCommand|s as scoped_ptr's (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Created 6 years, 2 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: chrome/browser/sessions/base_session_service_commands.cc
diff --git a/chrome/browser/sessions/base_session_service_commands.cc b/chrome/browser/sessions/base_session_service_commands.cc
index 7e3fd5f89e1fcfa82ed251c83ea430a717fb7919..d5a0ef36dea90adeb2c7f2106ea644893dc07afc 100644
--- a/chrome/browser/sessions/base_session_service_commands.cc
+++ b/chrome/browser/sessions/base_session_service_commands.cc
@@ -8,8 +8,6 @@
#include "chrome/browser/sessions/session_backend.h"
#include "chrome/browser/sessions/session_types.h"
-// BaseSessionService ---------------------------------------------------------
-
namespace {
// Helper used by CreateUpdateTabNavigationCommand(). It writes |str| to
@@ -28,7 +26,7 @@ void WriteStringToPickle(Pickle& pickle, int* bytes_written, int max_bytes,
} // namespace
-SessionCommand* CreateUpdateTabNavigationCommand(
+scoped_ptr<SessionCommand> CreateUpdateTabNavigationCommand(
SessionID::id_type command_id,
SessionID::id_type tab_id,
const sessions::SerializedNavigationEntry& navigation) {
@@ -40,10 +38,10 @@ SessionCommand* CreateUpdateTabNavigationCommand(
static const size_t max_state_size =
std::numeric_limits<SessionCommand::size_type>::max() - 1024;
navigation.WriteToPickle(max_state_size, &pickle);
- return new SessionCommand(command_id, pickle);
+ return scoped_ptr<SessionCommand>(new SessionCommand(command_id, pickle));
}
-SessionCommand* CreateSetTabExtensionAppIDCommand(
+scoped_ptr<SessionCommand> CreateSetTabExtensionAppIDCommand(
SessionID::id_type command_id,
SessionID::id_type tab_id,
const std::string& extension_id) {
@@ -59,10 +57,10 @@ SessionCommand* CreateSetTabExtensionAppIDCommand(
WriteStringToPickle(pickle, &bytes_written, max_id_size, extension_id);
- return new SessionCommand(command_id, pickle);
+ return scoped_ptr<SessionCommand>(new SessionCommand(command_id, pickle));
}
-SessionCommand* CreateSetTabUserAgentOverrideCommand(
+scoped_ptr<SessionCommand> CreateSetTabUserAgentOverrideCommand(
SessionID::id_type command_id,
SessionID::id_type tab_id,
const std::string& user_agent_override) {
@@ -80,12 +78,13 @@ SessionCommand* CreateSetTabUserAgentOverrideCommand(
WriteStringToPickle(pickle, &bytes_written, max_user_agent_size,
user_agent_override);
- return new SessionCommand(command_id, pickle);
+ return scoped_ptr<SessionCommand>(new SessionCommand(command_id, pickle));
}
-SessionCommand* CreateSetWindowAppNameCommand(SessionID::id_type command_id,
- SessionID::id_type window_id,
- const std::string& app_name) {
+scoped_ptr<SessionCommand> CreateSetWindowAppNameCommand(
+ SessionID::id_type command_id,
+ SessionID::id_type window_id,
+ const std::string& app_name) {
// Use pickle to handle marshalling.
Pickle pickle;
pickle.WriteInt(window_id);
@@ -98,7 +97,7 @@ SessionCommand* CreateSetWindowAppNameCommand(SessionID::id_type command_id,
WriteStringToPickle(pickle, &bytes_written, max_id_size, app_name);
- return new SessionCommand(command_id, pickle);
+ return scoped_ptr<SessionCommand>(new SessionCommand(command_id, pickle));
}
bool RestoreUpdateTabNavigationCommand(
@@ -109,9 +108,8 @@ bool RestoreUpdateTabNavigationCommand(
if (!pickle.get())
return false;
PickleIterator iterator(*pickle);
- return
- pickle->ReadInt(&iterator, tab_id) &&
- navigation->ReadFromPickle(&iterator);
+ return pickle->ReadInt(&iterator, tab_id) &&
+ navigation->ReadFromPickle(&iterator);
}
bool RestoreSetTabExtensionAppIDCommand(const SessionCommand& command,
« no previous file with comments | « chrome/browser/sessions/base_session_service_commands.h ('k') | chrome/browser/sessions/persistent_tab_restore_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698