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

Unified Diff: google_apis/drive/base_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 | « chrome/browser/drive/drive_api_util.cc ('k') | google_apis/drive/base_requests.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/drive/base_requests.h
diff --git a/google_apis/drive/base_requests.h b/google_apis/drive/base_requests.h
index afe12a04fbef7ee5dac09b43bb35c136d16f8323..d0b5a745adf5df1ba87f0f9f6327e4e7b8c13c86 100644
--- a/google_apis/drive/base_requests.h
+++ b/google_apis/drive/base_requests.h
@@ -29,10 +29,6 @@ namespace google_apis {
class RequestSender;
-// Callback used to pass parsed JSON from ParseJson(). If parsing error occurs,
-// then the passed argument is null.
-typedef base::Callback<void(scoped_ptr<base::Value> value)> ParseJsonCallback;
-
// Callback used for DownloadFileRequest and ResumeUploadRequestBase.
typedef base::Callback<void(int64 progress, int64 total)> ProgressCallback;
@@ -41,12 +37,8 @@ typedef base::Callback<void(
GDataErrorCode error,
scoped_ptr<std::string> content)> GetContentCallback;
-// Parses JSON passed in |json| on |blocking_task_runner|. Runs |callback| on
-// the calling thread when finished with either success or failure.
-// The callback must not be null.
-void ParseJson(base::TaskRunner* blocking_task_runner,
- const std::string& json,
- const ParseJsonCallback& callback);
+// Parses JSON passed in |json|. Returns NULL on failure.
+scoped_ptr<base::Value> ParseJson(const std::string& json);
//======================= AuthenticatedRequestInterface ======================
@@ -249,45 +241,6 @@ class EntryActionRequest : public UrlFetchRequestBase {
DISALLOW_COPY_AND_ASSIGN(EntryActionRequest);
};
-//============================== GetDataRequest ==============================
-
-// Callback type for requests that returns JSON data.
-typedef base::Callback<void(GDataErrorCode error,
- scoped_ptr<base::Value> json_data)> GetDataCallback;
-
-// This class performs the request for fetching and converting the fetched
-// content into a base::Value.
-class GetDataRequest : public UrlFetchRequestBase {
- public:
- // |callback| is called when the request finishes either by success or by
- // failure. On success, a JSON Value object is passed. It must not be null.
- GetDataRequest(RequestSender* sender, const GetDataCallback& callback);
- virtual ~GetDataRequest();
-
- protected:
- // UrlFetchRequestBase overrides.
- virtual void ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE;
- virtual void RunCallbackOnPrematureFailure(
- GDataErrorCode fetch_error_code) OVERRIDE;
-
- private:
- // Parses JSON response.
- void ParseResponse(GDataErrorCode fetch_error_code, const std::string& data);
-
- // Called when ParseJsonOnBlockingPool() is completed.
- void OnDataParsed(GDataErrorCode fetch_error_code,
- scoped_ptr<base::Value> value);
-
- const GetDataCallback 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<GetDataRequest> weak_ptr_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(GetDataRequest);
-};
-
-
//=========================== InitiateUploadRequestBase=======================
// Callback type for DriveServiceInterface::InitiateUpload.
« no previous file with comments | « chrome/browser/drive/drive_api_util.cc ('k') | google_apis/drive/base_requests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698