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

Unified Diff: google_apis/drive/gdata_wapi_requests.h

Issue 442193002: Parse Drive API responses all at once in the blocking pool. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix the cause of the regression. Created 6 years, 4 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
« no previous file with comments | « google_apis/drive/drive_api_requests.cc ('k') | google_apis/drive/gdata_wapi_requests.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/drive/gdata_wapi_requests.h
diff --git a/google_apis/drive/gdata_wapi_requests.h b/google_apis/drive/gdata_wapi_requests.h
index 7e64906ca48f2932afd54efc3b0a0e278d39e6dc..c4e1d06b35dc84e43883dd6eb3a14e4ac2482574 100644
--- a/google_apis/drive/gdata_wapi_requests.h
+++ b/google_apis/drive/gdata_wapi_requests.h
@@ -12,29 +12,44 @@
namespace google_apis {
-//========================= GetResourceEntryRequest ==========================
+class ResourceEntry;
+
+// Callback type for GetResourceEntryRequest.
+typedef base::Callback<void(GDataErrorCode error,
+ scoped_ptr<ResourceEntry> entry)>
+ GetResourceEntryCallback;
// This class performs the request for fetching a single resource entry.
-class GetResourceEntryRequest : public GetDataRequest {
+class GetResourceEntryRequest : public UrlFetchRequestBase {
public:
// |callback| must not be null.
GetResourceEntryRequest(RequestSender* sender,
const GDataWapiUrlGenerator& url_generator,
const std::string& resource_id,
const GURL& embed_origin,
- const GetDataCallback& callback);
+ const GetResourceEntryCallback& callback);
virtual ~GetResourceEntryRequest();
protected:
// UrlFetchRequestBase overrides.
+ virtual void ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE;
+ virtual void RunCallbackOnPrematureFailure(GDataErrorCode error) OVERRIDE;
virtual GURL GetURL() const OVERRIDE;
private:
+ void OnDataParsed(GDataErrorCode error, scoped_ptr<ResourceEntry> entry);
+
const GDataWapiUrlGenerator url_generator_;
// Resource id of the requested entry.
const std::string resource_id_;
// Embed origin for an url to the sharing dialog. Can be empty.
- const GURL& embed_origin_;
+ GURL embed_origin_;
+
+ const GetResourceEntryCallback callback_;
+
+ // Note: This should remain the last member so it'll be destroyed and
+ // invalidate its weak pointers before any other members are destroyed.
+ base::WeakPtrFactory<GetResourceEntryRequest> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(GetResourceEntryRequest);
};
« no previous file with comments | « google_apis/drive/drive_api_requests.cc ('k') | google_apis/drive/gdata_wapi_requests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698