summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-13 09:55:59 +0000
committermarja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-13 09:55:59 +0000
commit2753bffc450acdb654a3e5ef83038edff10c5100 (patch)
tree9ff0a5601271ffeb682be5dc3921bbd0a910a7a7
parent3394de8bcac89ed4543035e2708975050775ea85 (diff)
downloadchromium_src-2753bffc450acdb654a3e5ef83038edff10c5100.zip
chromium_src-2753bffc450acdb654a3e5ef83038edff10c5100.tar.gz
chromium_src-2753bffc450acdb654a3e5ef83038edff10c5100.tar.bz2
(Base)SessionService: Remove dead code which was only used by the unit tests.
BUG=NONE TEST=builds. Review URL: http://codereview.chromium.org/8873021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114201 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/sessions/base_session_service.cc13
-rw-r--r--chrome/browser/sessions/base_session_service.h6
-rw-r--r--chrome/browser/sessions/session_service.cc31
-rw-r--r--chrome/browser/sessions/session_service.h10
-rw-r--r--chrome/browser/sessions/session_service_unittest.cc32
5 files changed, 1 insertions, 91 deletions
diff --git a/chrome/browser/sessions/base_session_service.cc b/chrome/browser/sessions/base_session_service.cc
index f8e6623..49ecde1 100644
--- a/chrome/browser/sessions/base_session_service.cc
+++ b/chrome/browser/sessions/base_session_service.cc
@@ -275,19 +275,6 @@ BaseSessionService::Handle BaseSessionService::ScheduleGetLastSessionCommands(
return request->handle();
}
-BaseSessionService::Handle
- BaseSessionService::ScheduleGetCurrentSessionCommands(
- InternalGetCommandsRequest* request,
- CancelableRequestConsumerBase* consumer) {
- scoped_refptr<InternalGetCommandsRequest> request_wrapper(request);
- AddRequest(request, consumer);
- RunTaskOnBackendThread(
- FROM_HERE,
- base::Bind(&SessionBackend::ReadCurrentSessionCommands, backend(),
- request_wrapper));
- return request->handle();
-}
-
bool BaseSessionService::RunTaskOnBackendThread(
const tracked_objects::Location& from_here,
const base::Closure& task) {
diff --git a/chrome/browser/sessions/base_session_service.h b/chrome/browser/sessions/base_session_service.h
index 7f43d43..8d39c61 100644
--- a/chrome/browser/sessions/base_session_service.h
+++ b/chrome/browser/sessions/base_session_service.h
@@ -145,12 +145,6 @@ class BaseSessionService : public CancelableRequestProvider,
InternalGetCommandsRequest* request,
CancelableRequestConsumerBase* consumer);
- // Invokes ReadCurrentSessionCommands with request on the backend thread.
- // If testing, ReadLastSessionCommands is invoked directly.
- Handle ScheduleGetCurrentSessionCommands(
- InternalGetCommandsRequest* request,
- CancelableRequestConsumerBase* consumer);
-
// In production, this posts the task to the FILE thread. For
// tests, it immediately runs the specified task on the current
// thread.
diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc
index 546adcc..e60d30e 100644
--- a/chrome/browser/sessions/session_service.cc
+++ b/chrome/browser/sessions/session_service.cc
@@ -84,7 +84,7 @@ class InternalSessionRequest
real_callback(real_callback) {
}
- // The callback supplied to GetLastSession and GetCurrentSession.
+ // The callback supplied to GetLastSession.
SessionService::SessionCallback real_callback;
private:
@@ -424,35 +424,6 @@ SessionService::Handle SessionService::GetLastSession(
consumer);
}
-SessionService::Handle SessionService::GetCurrentSession(
- CancelableRequestConsumerBase* consumer,
- const SessionCallback& callback) {
- if (pending_window_close_ids_.empty()) {
- // If there are no pending window closes, we can get the current session
- // from memory.
- scoped_refptr<InternalSessionRequest> request(new InternalSessionRequest(
- base::Bind(&SessionService::OnGotSessionCommands,
- base::Unretained(this)),
- callback));
- AddRequest(request, consumer);
- IdToRange tab_to_available_range;
- std::set<SessionID::id_type> windows_to_track;
- BuildCommandsFromBrowsers(&(request->commands),
- &tab_to_available_range,
- &windows_to_track);
- request->ForwardResult(request->handle(), request);
- return request->handle();
- } else {
- // If there are pending window closes, read the current session from disk.
- return ScheduleGetCurrentSessionCommands(
- new InternalSessionRequest(
- base::Bind(&SessionService::OnGotSessionCommands,
- base::Unretained(this)),
- callback),
- consumer);
- }
-}
-
void SessionService::Save() {
bool had_commands = !pending_commands().empty();
BaseSessionService::Save();
diff --git a/chrome/browser/sessions/session_service.h b/chrome/browser/sessions/session_service.h
index 77edb7d..2c96cf2 100644
--- a/chrome/browser/sessions/session_service.h
+++ b/chrome/browser/sessions/session_service.h
@@ -170,16 +170,6 @@ class SessionService : public BaseSessionService,
Handle GetLastSession(CancelableRequestConsumerBase* consumer,
const SessionCallback& callback);
- // Fetches the contents of the current session, notifying the callback when
- // done. If the callback is supplied an empty vector of SessionWindows
- // it means the session could not be restored.
- //
- // The created request does NOT directly invoke the callback, rather the
- // callback invokes OnGotSessionCommands from which we map the
- // SessionCommands to browser state, then notify the callback.
- Handle GetCurrentSession(CancelableRequestConsumerBase* consumer,
- const SessionCallback& callback);
-
// Overridden from BaseSessionService because we want some UMA reporting on
// session update activities.
virtual void Save() OVERRIDE;
diff --git a/chrome/browser/sessions/session_service_unittest.cc b/chrome/browser/sessions/session_service_unittest.cc
index f6cd26b..2544337 100644
--- a/chrome/browser/sessions/session_service_unittest.cc
+++ b/chrome/browser/sessions/session_service_unittest.cc
@@ -622,38 +622,6 @@ TEST_F(SessionServiceTest, PinnedTrue) {
EXPECT_TRUE(CreateAndWriteSessionWithOneTab(true, true));
}
-class GetCurrentSessionCallbackHandler {
- public:
- void OnGotSession(int handle, std::vector<SessionWindow*>* windows) {
- EXPECT_EQ(1U, windows->size());
- EXPECT_EQ(2U, (*windows)[0]->tabs.size());
- EXPECT_EQ(2U, (*windows)[0]->tabs[0]->navigations.size());
- EXPECT_EQ(GURL("http://bar/1"),
- (*windows)[0]->tabs[0]->navigations[0].virtual_url());
- EXPECT_EQ(GURL("http://bar/2"),
- (*windows)[0]->tabs[0]->navigations[1].virtual_url());
- EXPECT_EQ(2U, (*windows)[0]->tabs[1]->navigations.size());
- EXPECT_EQ(GURL("http://foo/1"),
- (*windows)[0]->tabs[1]->navigations[0].virtual_url());
- EXPECT_EQ(GURL("http://foo/2"),
- (*windows)[0]->tabs[1]->navigations[1].virtual_url());
- }
-};
-
-TEST_F(SessionServiceTest, GetCurrentSession) {
- AddTab(browser(), GURL("http://foo/1"));
- NavigateAndCommitActiveTab(GURL("http://foo/2"));
- AddTab(browser(), GURL("http://bar/1"));
- NavigateAndCommitActiveTab(GURL("http://bar/2"));
-
- CancelableRequestConsumer consumer;
- GetCurrentSessionCallbackHandler handler;
- service()->GetCurrentSession(
- &consumer,
- base::Bind(&GetCurrentSessionCallbackHandler::OnGotSession,
- base::Unretained(&handler)));
-}
-
// Test that the notification for SESSION_SERVICE_SAVED is working properly.
TEST_F(SessionServiceTest, SavedSessionNotification) {
content::NotificationRegistrar registrar_;