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

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

Issue 17379020: Get rid of RequestRegistry (part 5): each request cancels itself. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/request_registry.h ('k') | chrome/browser/google_apis/request_sender.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/google_apis/request_registry.cc
diff --git a/chrome/browser/google_apis/request_registry.cc b/chrome/browser/google_apis/request_registry.cc
index 9c247c5cabbc58083a5cd2dca281ea29f476a711..cc9fb03cc6b8d819773c8b839aec60e4d151e0af 100644
--- a/chrome/browser/google_apis/request_registry.cc
+++ b/chrome/browser/google_apis/request_registry.cc
@@ -4,43 +4,21 @@
#include "chrome/browser/google_apis/request_registry.h"
-#include "content/public/browser/browser_thread.h"
-
-using content::BrowserThread;
-
namespace google_apis {
-RequestProgressStatus::RequestProgressStatus()
- : request_id(-1),
- transfer_state(REQUEST_NOT_STARTED) {
-}
-
RequestRegistry::Request::Request(RequestRegistry* registry)
- : registry_(registry) {
+ : registry_(registry), id_(-1) {
}
RequestRegistry::Request::~Request() {
}
-void RequestRegistry::Request::Cancel() {
- DoCancel();
- NotifyFinish(REQUEST_FAILED);
-}
-
void RequestRegistry::Request::NotifyStart() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- // Some request_ids may be restarted. Report only the first "start".
- if (progress_status_.transfer_state == REQUEST_NOT_STARTED) {
- progress_status_.transfer_state = REQUEST_STARTED;
- registry_->OnRequestStart(this, &progress_status_.request_id);
- }
+ registry_->OnRequestStart(this, &id_);
}
-void RequestRegistry::Request::NotifyFinish(
- RequestTransferState status) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- progress_status_.transfer_state = status;
- registry_->OnRequestFinish(progress_status().request_id);
+void RequestRegistry::Request::NotifyFinish() {
+ registry_->OnRequestFinish(id_);
}
RequestRegistry::RequestRegistry() {
@@ -50,23 +28,13 @@ RequestRegistry::RequestRegistry() {
RequestRegistry::~RequestRegistry() {
}
-void RequestRegistry::CancelRequest(Request* request) {
- request->Cancel();
-}
-
void RequestRegistry::OnRequestStart(
RequestRegistry::Request* request,
RequestID* id) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
*id = in_flight_requests_.Add(request);
- DVLOG(1) << "Request[" << *id << "] started.";
}
void RequestRegistry::OnRequestFinish(RequestID id) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- DVLOG(1) << "Request[" << id << "] finished.";
if (in_flight_requests_.Lookup(id))
in_flight_requests_.Remove(id);
}
« no previous file with comments | « chrome/browser/google_apis/request_registry.h ('k') | chrome/browser/google_apis/request_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698