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

Unified Diff: chrome/browser/webdata/web_data_request_manager.h

Issue 11862010: Fix WebDataRequest ownership gap (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 11 months 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/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..45387686c93d68463e7bb51fa865b1a15903bf32 100644
--- a/chrome/browser/webdata/web_data_request_manager.h
+++ b/chrome/browser/webdata/web_data_request_manager.h
@@ -42,6 +42,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,11 +52,6 @@ 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();
-
// The result is owned by the request.
void SetResult(scoped_ptr<WDTypedResult> r);
const WDTypedResult* GetResult() const;
@@ -62,6 +60,9 @@ class WebDataRequest {
// Used to notify service of request completion.
scoped_refptr<WebDataService> service_;
+ // Used to notify manager if request is cancelled.
+ WebDataRequestManager* manager_;
+
// Tracks loop that the request originated on.
MessageLoop* message_loop_;
@@ -95,11 +96,19 @@ class WebDataRequestManager {
~WebDataRequestManager();
- // Cancel any pending request.
+ // Tries to cancel request, returns true if request was found and
+ // cancelled successfully -- used for clean up of WebDataRequest references.
+ bool MaybeCancelRequest(WebDataServiceBase::Handle h);
+
+ // Cancel any pending request (expects pending_requests_ map to contain |h|).
erikwright (departed) 2013/01/16 19:00:23 replace 'expects' with something more explicit. Do
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/16 19:00:23 This can be private, right?
// Register the request as a pending request.
void RegisterRequest(WebDataRequest* request);
« no previous file with comments | « no previous file | chrome/browser/webdata/web_data_request_manager.cc » ('j') | chrome/browser/webdata/web_data_request_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698