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

Unified Diff: chrome/browser/sessions/base_session_service.h

Issue 11446033: Convert SessionService to use new CancelableTaskTracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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.h
diff --git a/chrome/browser/sessions/base_session_service.h b/chrome/browser/sessions/base_session_service.h
index 529f9b5bfaf1c8f1a7de2c4afa9394a53b38a9ec..9e1a0d747e2c3a111b784a6f215fa8093f5dd63c 100644
--- a/chrome/browser/sessions/base_session_service.h
+++ b/chrome/browser/sessions/base_session_service.h
@@ -11,9 +11,11 @@
#include "base/gtest_prod_util.h"
#include "base/location.h"
#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_vector.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/common/cancelable_request.h"
#include "chrome/browser/sessions/session_id.h"
+#include "chrome/common/cancelable_task_tracker.h"
#include "googleurl/src/gurl.h"
class Profile;
@@ -48,29 +50,9 @@ class BaseSessionService : public CancelableRequestProvider {
// Deletes the last session.
void DeleteLastSession();
- class InternalGetCommandsRequest;
-
- typedef base::Callback<void(Handle,
- scoped_refptr<InternalGetCommandsRequest>)>
+ typedef base::Callback<void(ScopedVector<SessionCommand>)>
InternalGetCommandsCallback;
- // Callback used when fetching the last session. The last session consists
- // of a vector of SessionCommands.
- class InternalGetCommandsRequest :
- public CancelableRequest<InternalGetCommandsCallback> {
- public:
- explicit InternalGetCommandsRequest(const CallbackType& callback);
-
- // The commands. The backend fills this in for us.
- std::vector<SessionCommand*> commands;
-
- protected:
- virtual ~InternalGetCommandsRequest();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(InternalGetCommandsRequest);
- };
-
protected:
virtual ~BaseSessionService();
@@ -160,11 +142,12 @@ class BaseSessionService : public CancelableRequestProvider {
// Returns true if the entry at specified |url| should be written to disk.
bool ShouldTrackEntry(const GURL& url);
- // Invokes ReadLastSessionCommands with request on the backend thread.
- // If testing, ReadLastSessionCommands is invoked directly.
- Handle ScheduleGetLastSessionCommands(
- InternalGetCommandsRequest* request,
- CancelableRequestConsumerBase* consumer);
+ // Invokes SessionBackend::ReadLastSessionCommands with callback on the
+ // backend thread.
+ // If testing, SessionBackend::ReadLastSessionCommands is invoked directly.
+ CancelableTaskTracker::TaskId ScheduleGetLastSessionCommands(
+ const InternalGetCommandsCallback& callback,
+ CancelableTaskTracker* tracker);
// In production, this posts the task to the FILE thread. For
// tests, it immediately runs the specified task on the current
« no previous file with comments | « no previous file | chrome/browser/sessions/base_session_service.cc » ('j') | chrome/browser/sessions/session_restore.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698