Chromium Code Reviews| Index: chrome/browser/webdata/web_data_service.h |
| diff --git a/chrome/browser/webdata/web_data_service.h b/chrome/browser/webdata/web_data_service.h |
| index b0a0689f4ffbb5dd23f148fe2d72a97bd0352697..469ecf871f7e81a7f70cdaf1381667e7738804fc 100644 |
| --- a/chrome/browser/webdata/web_data_service.h |
| +++ b/chrome/browser/webdata/web_data_service.h |
| @@ -27,6 +27,7 @@ |
| #include "chrome/browser/search_engines/template_url.h" |
| #include "chrome/browser/search_engines/template_url_id.h" |
| #include "chrome/browser/webdata/keyword_table.h" |
| +#include "chrome/browser/webdata/web_data_request_manager.h" |
| #include "content/public/browser/browser_thread.h" |
| #include "sql/init_status.h" |
| @@ -100,58 +101,6 @@ class WebDataService |
| public AutofillWebData, |
| public RefcountedProfileKeyedService { |
| public: |
| - ////////////////////////////////////////////////////////////////////////////// |
| - // |
| - // Internal requests |
| - // |
| - // Every request is processed using a request object. The object contains |
| - // both the request parameters and the results. |
| - ////////////////////////////////////////////////////////////////////////////// |
| - class WebDataRequest { |
| - public: |
| - WebDataRequest(WebDataService* service, |
| - Handle handle, |
| - WebDataServiceConsumer* consumer); |
| - |
| - virtual ~WebDataRequest(); |
| - |
| - Handle GetHandle() const; |
| - |
| - // Retrieves the |consumer_| set in the constructor. If the request was |
| - // cancelled via the |Cancel()| method then |true| is returned and |
| - // |*consumer| is set to NULL. The |consumer| parameter may be set to NULL |
| - // if only the return value is desired. |
| - bool IsCancelled(WebDataServiceConsumer** consumer) const; |
| - |
| - // This can be invoked from any thread. From this point we assume that |
| - // 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(); |
| - |
| - // The result is owned by the request. |
| - void SetResult(WDTypedResult* r); |
| - const WDTypedResult* GetResult() const; |
| - |
| - private: |
| - scoped_refptr<WebDataService> service_; |
| - MessageLoop* message_loop_; |
| - Handle handle_; |
| - |
| - // A lock to protect against simultaneous cancellations of the request. |
| - // Cancellation affects both the |cancelled_| flag and |consumer_|. |
| - mutable base::Lock cancel_lock_; |
| - bool cancelled_; |
| - WebDataServiceConsumer* consumer_; |
| - |
| - WDTypedResult* result_; |
| - |
| - DISALLOW_COPY_AND_ASSIGN(WebDataRequest); |
| - }; |
| - |
| // |
| // Internally we use instances of the following template to represent |
| // requests. |
| @@ -427,9 +376,6 @@ class WebDataService |
| // Invoked by request implementations when a request has been processed. |
| void RequestCompleted(Handle h); |
| - // Register the request as a pending request. |
| - void RegisterRequest(WebDataRequest* request); |
| - |
| ////////////////////////////////////////////////////////////////////////////// |
| // |
| // The following methods are only invoked in the web data service thread. |
| @@ -471,9 +417,6 @@ class WebDataService |
| // Schedule a commit if one is not already pending. |
| void ScheduleCommit(); |
| - // Return the next request handle. |
| - int GetNextRequestHandle(); |
| - |
| ////////////////////////////////////////////////////////////////////////////// |
| // |
| // Keywords. |
| @@ -575,6 +518,9 @@ class WebDataService |
| // |db_| lifetime must be managed on the database thread. |
| WebDatabase* db_; |
| + // Keeps track of all pending requests made to the db. |
| + scoped_ptr<WebDataRequestManager> wdr_mgr_; |
|
dhollowa
2013/01/04 01:34:50
nit: no abbreviations. How about |request_manager
Cait (Slow)
2013/01/04 22:59:29
Done.
|
| + |
| // Syncable services for the database data. We own the services, but don't |
| // use |scoped_ptr|s because the lifetimes must be managed on the database |
| // thread. |
| @@ -590,15 +536,6 @@ class WebDataService |
| // Whether we should commit the database. |
| bool should_commit_; |
| - // A lock to protect pending requests and next request handle. |
| - base::Lock pending_lock_; |
| - |
| - // Next handle to be used for requests. Incremented for each use. |
| - Handle next_request_handle_; |
| - |
| - typedef std::map<Handle, WebDataRequest*> RequestMap; |
| - RequestMap pending_requests_; |
| - |
| // MessageLoop the WebDataService is created on. |
| MessageLoop* main_loop_; |