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

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

Issue 8677030: base::Bind: Convert more of chrome/browser/sessions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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/session_service.cc
diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc
index 1c570ac88b87ac2ecf5d90cc2b44e9e4dd8996a0..a86adb8c19eaa0eaaba0fb2bfa144e70231480e0 100644
--- a/chrome/browser/sessions/session_service.cc
+++ b/chrome/browser/sessions/session_service.cc
@@ -9,6 +9,7 @@
#include <set>
#include <vector>
+#include "base/bind.h"
csilv 2011/11/24 00:01:04 add bind/bind_helpers.h
James Hawkins 2011/11/24 00:15:36 Done.
#include "base/file_util.h"
#include "base/memory/scoped_vector.h"
#include "base/message_loop.h"
@@ -76,7 +77,7 @@ class InternalSessionRequest
: public BaseSessionService::InternalGetCommandsRequest {
public:
InternalSessionRequest(
- CallbackType* callback,
+ const CallbackType& callback,
SessionService::SessionCallback* real_callback)
: BaseSessionService::InternalGetCommandsRequest(callback),
real_callback(real_callback) {
@@ -183,8 +184,9 @@ void SessionService::MoveCurrentSessionToLastSession() {
if (!backend_thread()) {
backend()->MoveCurrentSessionToLastSession();
} else {
- backend_thread()->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
- backend(), &SessionBackend::MoveCurrentSessionToLastSession));
+ backend_thread()->message_loop()->PostTask(
+ FROM_HERE, base::Bind(&SessionBackend::MoveCurrentSessionToLastSession,
+ backend()));
}
}
@@ -419,8 +421,10 @@ SessionService::Handle SessionService::GetLastSession(
SessionCallback* callback) {
return ScheduleGetLastSessionCommands(
new InternalSessionRequest(
- NewCallback(this, &SessionService::OnGotSessionCommands),
- callback), consumer);
+ base::Bind(&SessionService::OnGotSessionCommands,
+ base::Unretained(this)),
+ callback),
+ consumer);
}
SessionService::Handle SessionService::GetCurrentSession(
@@ -430,7 +434,8 @@ SessionService::Handle SessionService::GetCurrentSession(
// If there are no pending window closes, we can get the current session
// from memory.
scoped_refptr<InternalSessionRequest> request(new InternalSessionRequest(
- NewCallback(this, &SessionService::OnGotSessionCommands),
+ base::Bind(&SessionService::OnGotSessionCommands,
+ base::Unretained(this)),
callback));
AddRequest(request, consumer);
IdToRange tab_to_available_range;
@@ -438,16 +443,16 @@ SessionService::Handle SessionService::GetCurrentSession(
BuildCommandsFromBrowsers(&(request->commands),
&tab_to_available_range,
&windows_to_track);
- request->ForwardResult(
- BaseSessionService::InternalGetCommandsRequest::TupleType(
- request->handle(), request));
+ 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(
- NewCallback(this, &SessionService::OnGotSessionCommands),
- callback), consumer);
+ base::Bind(&SessionService::OnGotSessionCommands,
+ base::Unretained(this)),
+ callback),
+ consumer);
}
}

Powered by Google App Engine
This is Rietveld 408576698