Chromium Code Reviews| Index: chrome/browser/webdata/web_data_request_manager.h |
| diff --git a/chrome/browser/webdata/web_data_request_manager.h b/chrome/browser/webdata/web_data_request_manager.h |
| index eab0c9bd1b7578cc6a215910d463fd1df0eff056..5216d0d65f9d380a8605cef5e7e881990c37e7f3 100644 |
| --- a/chrome/browser/webdata/web_data_request_manager.h |
| +++ b/chrome/browser/webdata/web_data_request_manager.h |
| @@ -31,8 +31,7 @@ class WebDataRequestManager; |
| ////////////////////////////////////////////////////////////////////////////// |
| class WebDataRequest { |
| public: |
| - WebDataRequest(WebDataService* service, |
| - WebDataServiceConsumer* consumer, |
| + WebDataRequest(WebDataServiceConsumer* consumer, |
| WebDataRequestManager* manager); |
| virtual ~WebDataRequest(); |
| @@ -42,6 +41,9 @@ class WebDataRequest { |
| // Retrieves the |consumer_| set in the constructor. |
| WebDataServiceConsumer* GetConsumer() const; |
| + // Retrieves the original message loop the of the request. |
| + MessageLoop* GetMessageLoop() const; |
| + |
| // Returns |true| if the request was cancelled via the |Cancel()| method. |
| bool IsCancelled() const; |
| @@ -49,18 +51,16 @@ class WebDataRequest { |
| // our consumer_ reference is invalid. |
| void Cancel(); |
| - // Invoked by the service when this request has been completed. |
| - // This will notify the service in whatever thread was used to create this |
| - // request. |
| - void RequestComplete(); |
| + // Invoked when the request has been completed. |
| + void OnComplete(); |
| // The result is owned by the request. |
| void SetResult(scoped_ptr<WDTypedResult> r); |
| - const WDTypedResult* GetResult() const; |
| + scoped_ptr<WDTypedResult> GetResult(); |
|
erikwright (departed)
2013/01/28 20:01:05
A note that the caller should only invoke this one
Cait (Slow)
2013/01/29 01:10:29
Done.
|
| private: |
| - // Used to notify service of request completion. |
| - scoped_refptr<WebDataService> service_; |
| + // Used to notify manager if request is cancelled. |
|
erikwright (departed)
2013/01/28 20:01:05
A note about why a raw pointer is used vs. a ref_p
Cait (Slow)
2013/01/29 01:10:29
Done.
|
| + WebDataRequestManager* manager_; |
| // Tracks loop that the request originated on. |
| MessageLoop* message_loop_; |
| @@ -89,17 +89,19 @@ class WebDataRequest { |
| // |
| // Note: This is an internal interface, not to be used outside of webdata/ |
| ////////////////////////////////////////////////////////////////////////////// |
| -class WebDataRequestManager { |
| +class WebDataRequestManager : public base::RefCounted<WebDataRequestManager> { |
| public: |
| WebDataRequestManager(); |
| - ~WebDataRequestManager(); |
| - |
| // Cancel any pending request. |
| void CancelRequest(WebDataServiceBase::Handle h); |
| - // Invoked by request implementations when a request has been processed. |
| - void RequestCompleted(WebDataServiceBase::Handle h); |
| + // Invoked by the WebDataService when |request| has been completed. |
| + void RequestCompleted(scoped_ptr<WebDataRequest> request); |
| + |
| + // This will notify the consumer in whatever thread was used to create this |
| + // request. |
| + void RequestCompletedOnThread(scoped_ptr<WebDataRequest> request); |
|
erikwright (departed)
2013/01/28 20:01:05
needs to be public?
Cait (Slow)
2013/01/29 01:10:29
Done.
|
| // Register the request as a pending request. |
| void RegisterRequest(WebDataRequest* request); |
| @@ -108,6 +110,10 @@ class WebDataRequestManager { |
| int GetNextRequestHandle(); |
| private: |
| + friend class base::RefCounted<WebDataRequestManager>; |
| + |
| + ~WebDataRequestManager(); |
| + |
| // A lock to protect pending requests and next request handle. |
| base::Lock pending_lock_; |