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

Side by Side Diff: chrome/browser/cancelable_request.h

Issue 10383262: RefCounted types should not have public destructors, delegate cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make win bot happy Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // CancelableRequestProviders and Consumers work together to make requests that 5 // CancelableRequestProviders and Consumers work together to make requests that
6 // execute on a background thread in the provider and return data to the 6 // execute on a background thread in the provider and return data to the
7 // consumer. These classes collaborate to keep a list of open requests and to 7 // consumer. These classes collaborate to keep a list of open requests and to
8 // make sure that requests do not outlive either of the objects involved in the 8 // make sure that requests do not outlive either of the objects involved in the
9 // transaction. 9 // transaction.
10 // 10 //
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // 115 //
116 // It is intended that providers inherit from this class to provide the 116 // It is intended that providers inherit from this class to provide the
117 // necessary functionality. 117 // necessary functionality.
118 118
119 class CancelableRequestProvider { 119 class CancelableRequestProvider {
120 public: 120 public:
121 // Identifies a specific request from this provider. 121 // Identifies a specific request from this provider.
122 typedef int Handle; 122 typedef int Handle;
123 123
124 CancelableRequestProvider(); 124 CancelableRequestProvider();
125 virtual ~CancelableRequestProvider();
126 125
127 // Called by the enduser of the request to cancel it. This MUST be called on 126 // Called by the enduser of the request to cancel it. This MUST be called on
128 // the same thread that originally issued the request (which is also the same 127 // the same thread that originally issued the request (which is also the same
129 // thread that would have received the callback if it was not canceled). 128 // thread that would have received the callback if it was not canceled).
130 // handle must be for a valid pending (not yet complete or cancelled) request. 129 // handle must be for a valid pending (not yet complete or cancelled) request.
131 void CancelRequest(Handle handle); 130 void CancelRequest(Handle handle);
132 131
133 protected: 132 protected:
133 virtual ~CancelableRequestProvider();
134
134 // Adds a new request and initializes it. This is called by a derived class 135 // Adds a new request and initializes it. This is called by a derived class
135 // to add a new request. The request's Init() will be called (which is why 136 // to add a new request. The request's Init() will be called (which is why
136 // the consumer is required. The handle to the new request is returned. 137 // the consumer is required. The handle to the new request is returned.
137 Handle AddRequest(CancelableRequestBase* request, 138 Handle AddRequest(CancelableRequestBase* request,
138 CancelableRequestConsumerBase* consumer); 139 CancelableRequestConsumerBase* consumer);
139 140
140 // Called by the CancelableRequest when the request has executed. It will 141 // Called by the CancelableRequest when the request has executed. It will
141 // be removed from the list of pending requests (as opposed to canceling, 142 // be removed from the list of pending requests (as opposed to canceling,
142 // which will also set some state on the request). 143 // which will also set some state on the request).
143 void RequestCompleted(Handle handle); 144 void RequestCompleted(Handle handle);
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 } 1008 }
1008 1009
1009 // The value. 1010 // The value.
1010 Type value; 1011 Type value;
1011 1012
1012 protected: 1013 protected:
1013 virtual ~CancelableRequest1() {} 1014 virtual ~CancelableRequest1() {}
1014 }; 1015 };
1015 1016
1016 #endif // CHROME_BROWSER_CANCELABLE_REQUEST_H_ 1017 #endif // CHROME_BROWSER_CANCELABLE_REQUEST_H_
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/base_bookmark_model_observer.h ('k') | chrome/browser/cancelable_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698