Index: chrome/browser/google_apis/request_sender.h |
diff --git a/chrome/browser/google_apis/request_sender.h b/chrome/browser/google_apis/request_sender.h |
index 3251ca5117bffc1de9f1c31e554854b024cdfc60..b9f03018338aadd0be26f3831937e18e7e27d9c3 100644 |
--- a/chrome/browser/google_apis/request_sender.h |
+++ b/chrome/browser/google_apis/request_sender.h |
@@ -5,6 +5,7 @@ |
#ifndef CHROME_BROWSER_GOOGLE_APIS_REQUEST_SENDER_H_ |
#define CHROME_BROWSER_GOOGLE_APIS_REQUEST_SENDER_H_ |
+#include <set> |
#include <string> |
#include <vector> |
@@ -25,7 +26,6 @@ namespace google_apis { |
class AuthenticatedRequestInterface; |
class AuthService; |
-class RequestRegistry; |
// Helper class that sends requests implementing |
// AuthenticatedRequestInterface and handles retries and authentication. |
@@ -45,21 +45,24 @@ class RequestSender { |
virtual ~RequestSender(); |
AuthService* auth_service() { return auth_service_.get(); } |
- RequestRegistry* request_registry() { |
- return request_registry_.get(); |
- } |
// Prepares the object for use. |
virtual void Initialize(); |
// Starts a request implementing the AuthenticatedRequestInterface |
// interface, and makes the request retry upon authentication failures by |
- // calling back to RetryRequest. |
+ // calling back to RetryRequest. The |request| object is owned by this |
+ // RequestSender. It will be deleted in RequestSender's destructor or |
+ // in RequestFinished(). |
// |
// Returns a closure to cancel the request. The closure cancels the request |
// if it is in-flight, and does nothing if it is already terminated. |
base::Closure StartRequestWithRetry(AuthenticatedRequestInterface* request); |
+ // Notifies to this RequestSender that |request| has finished. |
+ // TODO(kinaba): refactor the life time management and make this at private. |
+ void RequestFinished(AuthenticatedRequestInterface* request); |
+ |
private: |
// Called when the access token is fetched. |
void OnAccessTokenFetched( |
@@ -79,7 +82,7 @@ class RequestSender { |
Profile* profile_; // Not owned. |
scoped_ptr<AuthService> auth_service_; |
- scoped_ptr<RequestRegistry> request_registry_; |
+ std::set<AuthenticatedRequestInterface*> in_flight_requests_; |
const std::string custom_user_agent_; |
base::ThreadChecker thread_checker_; |