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

Unified Diff: chrome/browser/google_apis/base_requests.cc

Issue 17175017: Get rid of RequestRegistry (part 6): get rid of RequestRegistry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment fix Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/google_apis/base_requests.h ('k') | chrome/browser/google_apis/base_requests_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/google_apis/base_requests.cc
diff --git a/chrome/browser/google_apis/base_requests.cc b/chrome/browser/google_apis/base_requests.cc
index 3c11531d0d0451f091adb86ff7e26ebdc5b4372b..b2e2ed0c0519bcc50b231c4d2989e19778efbf06 100644
--- a/chrome/browser/google_apis/base_requests.cc
+++ b/chrome/browser/google_apis/base_requests.cc
@@ -93,12 +93,11 @@ void ParseJson(const std::string& json, const ParseJsonCallback& callback) {
//============================ UrlFetchRequestBase ===========================
UrlFetchRequestBase::UrlFetchRequestBase(
- RequestSender* runner,
+ RequestSender* sender,
net::URLRequestContextGetter* url_request_context_getter)
- : RequestRegistry::Request(runner->request_registry()),
- url_request_context_getter_(url_request_context_getter),
+ : url_request_context_getter_(url_request_context_getter),
re_authenticate_count_(0),
- started_(false),
+ sender_(sender),
save_temp_file_(false),
weak_ptr_factory_(this) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -191,11 +190,7 @@ void UrlFetchRequestBase::Start(const std::string& access_token,
}
}
- // Register to request registry.
- NotifyStart();
-
url_fetcher_->Start();
- started_ = true;
}
URLFetcher::RequestType UrlFetchRequestBase::GetRequestType() const {
@@ -221,7 +216,7 @@ bool UrlFetchRequestBase::GetContentFile(base::FilePath* local_file_path,
void UrlFetchRequestBase::Cancel() {
url_fetcher_.reset(NULL);
RunCallbackOnPrematureFailure(GDATA_CANCELLED);
- NotifyFinish();
+ sender_->RequestFinished(this);
}
// static
@@ -240,7 +235,7 @@ GDataErrorCode UrlFetchRequestBase::GetErrorCode(const URLFetcher* source) {
}
void UrlFetchRequestBase::OnProcessURLFetchResultsComplete(bool result) {
- NotifyFinish();
+ sender_->RequestFinished(this);
}
void UrlFetchRequestBase::OnURLFetchComplete(const URLFetcher* source) {
@@ -266,16 +261,7 @@ void UrlFetchRequestBase::OnURLFetchComplete(const URLFetcher* source) {
void UrlFetchRequestBase::OnAuthFailed(GDataErrorCode code) {
RunCallbackOnPrematureFailure(code);
-
- // Check if this failed before we even started fetching. If so, register
- // for start so we can properly unregister with finish.
- if (!started_)
- NotifyStart();
-
- // Note: NotifyFinish() must be invoked at the end, after all other callbacks
- // and notifications. Once NotifyFinish() is called, the current instance of
- // request will be deleted from the RequestRegistry and become invalid.
- NotifyFinish();
+ sender_->RequestFinished(this);
}
base::WeakPtr<AuthenticatedRequestInterface>
« no previous file with comments | « chrome/browser/google_apis/base_requests.h ('k') | chrome/browser/google_apis/base_requests_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698