Index: chrome/test/webdriver/commands/create_session.cc |
diff --git a/chrome/test/webdriver/commands/create_session.cc b/chrome/test/webdriver/commands/create_session.cc |
index 9f30d15ee444e948aaf1d95cd2a19d2440f44aed..86344444fd76e9587fb08e51faa1ca3e6826802d 100644 |
--- a/chrome/test/webdriver/commands/create_session.cc |
+++ b/chrome/test/webdriver/commands/create_session.cc |
@@ -24,28 +24,20 @@ CreateSession::~CreateSession() {} |
bool CreateSession::DoesPost() { return true; } |
void CreateSession::ExecutePost(Response* const response) { |
- SessionManager* session_manager = SessionManager::GetInstance(); |
- Session* session = session_manager->Create(); |
- if (!session) { |
- SET_WEBDRIVER_ERROR(response, |
- "Failed to create session", |
- kInternalServerError); |
- return; |
- } |
- |
- std::string session_id = session->id(); |
+ // Session manages its own liftime, so do not call delete. |
+ Session* session = new Session(); |
if (!session->Init()) { |
- session_manager->Delete(session_id); |
SET_WEBDRIVER_ERROR(response, |
"Failed to initialize session", |
kInternalServerError); |
return; |
} |
- VLOG(1) << "Created session " << session_id; |
+ SessionManager* session_manager = SessionManager::GetInstance(); |
+ VLOG(1) << "Created session " << session->id(); |
std::ostringstream stream; |
stream << "http://" << session_manager->GetAddress() << "/session/" |
- << session_id; |
+ << session->id(); |
response->set_status(kSeeOther); |
response->set_value(Value::CreateStringValue(stream.str())); |
} |