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

Unified Diff: chrome/browser/chromeos/gdata/gdata_operations.cc

Issue 10808027: gdrive: Get JSON feeds parsing off the UI thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: making OnDataParsed() a private method of GetDataOperation Created 8 years, 5 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/chromeos/gdata/gdata_operations.cc
diff --git a/chrome/browser/chromeos/gdata/gdata_operations.cc b/chrome/browser/chromeos/gdata/gdata_operations.cc
index e0057eb392b823f9288ef945bfcda7c37497b55f..b264f3018db3845dab19c87aa968e9f102a87a09 100644
--- a/chrome/browser/chromeos/gdata/gdata_operations.cc
+++ b/chrome/browser/chromeos/gdata/gdata_operations.cc
@@ -261,8 +261,7 @@ void DownloadFileOperation::OnURLFetchDownloadData(
get_download_data_callback_.Run(HTTP_SUCCESS, download_data.Pass());
}
-bool DownloadFileOperation::ProcessURLFetchResults(
- const URLFetcher* source) {
+void DownloadFileOperation::ProcessURLFetchResults(const URLFetcher* source) {
GDataErrorCode code = GetErrorCode(source);
// Take over the ownership of the the downloaded temp file.
@@ -275,7 +274,7 @@ bool DownloadFileOperation::ProcessURLFetchResults(
if (!download_action_callback_.is_null())
download_action_callback_.Run(code, document_url_, temp_file);
- return code == HTTP_SUCCESS;
+ OnProcessURLFetchResultsComplete(code == HTTP_SUCCESS);
}
void DownloadFileOperation::RunCallbackOnPrematureFailure(GDataErrorCode code) {
@@ -477,11 +476,10 @@ AuthorizeAppsOperation::GetExtraRequestHeaders() const {
return headers;
}
-bool AuthorizeAppsOperation::ProcessURLFetchResults(
- const URLFetcher* source) {
+void AuthorizeAppsOperation::ProcessURLFetchResults(const URLFetcher* source) {
std::string data;
source->GetResponseAsString(&data);
- return GetDataOperation::ProcessURLFetchResults(source);
+ GetDataOperation::ProcessURLFetchResults(source);
}
bool AuthorizeAppsOperation::GetContentData(std::string* upload_content_type,
@@ -502,7 +500,9 @@ bool AuthorizeAppsOperation::GetContentData(std::string* upload_content_type,
return true;
}
-base::Value* AuthorizeAppsOperation::ParseResponse(const std::string& data) {
+void AuthorizeAppsOperation::ParseResponse(
+ GDataErrorCode fetch_error_code,
+ const std::string& data) {
// Parse entry XML.
XmlReader xml_reader;
scoped_ptr<DocumentEntry> entry;
@@ -531,7 +531,9 @@ base::Value* AuthorizeAppsOperation::ParseResponse(const std::string& data) {
}
}
- return link_list.release();
+ RunCallback(fetch_error_code, link_list.PassAs<base::Value>());
+ const bool success = true;
+ OnProcessURLFetchResultsComplete(success);
}
GURL AuthorizeAppsOperation::GetURL() const {
@@ -644,7 +646,7 @@ GURL InitiateUploadOperation::GetURL() const {
return initiate_upload_url_;
}
-bool InitiateUploadOperation::ProcessURLFetchResults(
+void InitiateUploadOperation::ProcessURLFetchResults(
const URLFetcher* source) {
GDataErrorCode code = GetErrorCode(source);
@@ -661,7 +663,7 @@ bool InitiateUploadOperation::ProcessURLFetchResults(
if (!callback_.is_null())
callback_.Run(code, GURL(upload_location));
- return code == HTTP_SUCCESS;
+ OnProcessURLFetchResultsComplete(code == HTTP_SUCCESS);
}
void InitiateUploadOperation::NotifySuccessToOperationRegistry() {
@@ -748,8 +750,7 @@ GURL ResumeUploadOperation::GetURL() const {
return params_.upload_location;
}
-bool ResumeUploadOperation::ProcessURLFetchResults(
- const URLFetcher* source) {
+void ResumeUploadOperation::ProcessURLFetchResults(const URLFetcher* source) {
GDataErrorCode code = GetErrorCode(source);
net::HttpResponseHeaders* hdrs = source->GetResponseHeaders();
int64 start_range_received = -1;
@@ -810,7 +811,8 @@ bool ResumeUploadOperation::ProcessURLFetchResults(
last_chunk_completed_ = true;
}
- return last_chunk_completed_ || code == HTTP_RESUME_INCOMPLETE;
+ OnProcessURLFetchResultsComplete(
+ last_chunk_completed_ || code == HTTP_RESUME_INCOMPLETE);
}
void ResumeUploadOperation::NotifyStartToOperationRegistry() {

Powered by Google App Engine
This is Rietveld 408576698