diff options
18 files changed, 5 insertions, 108 deletions
diff --git a/chrome/browser/chromeos/contacts/gdata_contacts_service.cc b/chrome/browser/chromeos/contacts/gdata_contacts_service.cc index 29d82f0..0d614cb 100644 --- a/chrome/browser/chromeos/contacts/gdata_contacts_service.cc +++ b/chrome/browser/chromeos/contacts/gdata_contacts_service.cc @@ -871,7 +871,6 @@ GDataContactsService::GDataContactsService( GDataContactsService::~GDataContactsService() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - sender_->CancelAll(); STLDeleteContainerPointers(requests_.begin(), requests_.end()); requests_.clear(); } diff --git a/chrome/browser/chromeos/drive/job_scheduler.cc b/chrome/browser/chromeos/drive/job_scheduler.cc index 3242e6e..4de6477 100644 --- a/chrome/browser/chromeos/drive/job_scheduler.cc +++ b/chrome/browser/chromeos/drive/job_scheduler.cc @@ -169,23 +169,21 @@ void JobScheduler::RemoveObserver(JobListObserver* observer) { void JobScheduler::CancelJob(JobID job_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - // TODO(kinaba): Completely remove drive_service_->CancelForFilePath - // once DriveUploader supported cancellation callback: crbug.com/257012. JobEntry* job = job_map_.Lookup(job_id); if (job) { + // TODO(kinaba): crbug.com/251116 Support cancelling jobs not yet started. if (!job->cancel_callback.is_null()) job->cancel_callback.Run(); - else - drive_service_->CancelForFilePath(job->job_info.file_path); } } void JobScheduler::CancelAllJobs() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - // TODO(kinaba): Move the cancellation feature from DriveService - // to JobScheduler. - drive_service_->CancelAll(); + // CancelJob may remove the entry from |job_map_|. That's OK. IDMap supports + // removable during iteration. + for (JobIDMap::iterator iter(&job_map_); !iter.IsAtEnd(); iter.Advance()) + CancelJob(iter.GetCurrentKey()); } void JobScheduler::GetAboutResource( diff --git a/chrome/browser/drive/drive_api_service.cc b/chrome/browser/drive/drive_api_service.cc index 9ece6a0..85f7a8ac 100644 --- a/chrome/browser/drive/drive_api_service.cc +++ b/chrome/browser/drive/drive_api_service.cc @@ -266,16 +266,6 @@ bool DriveAPIService::CanSendRequest() const { return HasRefreshToken(); } -void DriveAPIService::CancelAll() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - sender_->CancelAll(); -} - -bool DriveAPIService::CancelForFilePath(const base::FilePath& file_path) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - return sender_->request_registry()->CancelForFilePath(file_path); -} - std::string DriveAPIService::CanonicalizeResourceId( const std::string& resource_id) const { return drive::util::CanonicalizeResourceId(resource_id); diff --git a/chrome/browser/drive/drive_api_service.h b/chrome/browser/drive/drive_api_service.h index 78b4d6d..e869355 100644 --- a/chrome/browser/drive/drive_api_service.h +++ b/chrome/browser/drive/drive_api_service.h @@ -48,8 +48,6 @@ class DriveAPIService : public DriveServiceInterface, virtual void AddObserver(DriveServiceObserver* observer) OVERRIDE; virtual void RemoveObserver(DriveServiceObserver* observer) OVERRIDE; virtual bool CanSendRequest() const OVERRIDE; - virtual void CancelAll() OVERRIDE; - virtual bool CancelForFilePath(const base::FilePath& file_path) OVERRIDE; virtual std::string CanonicalizeResourceId( const std::string& resource_id) const OVERRIDE; virtual bool HasAccessToken() const OVERRIDE; diff --git a/chrome/browser/drive/drive_service_interface.h b/chrome/browser/drive/drive_service_interface.h index 0fd0e6a..774de4f 100644 --- a/chrome/browser/drive/drive_service_interface.h +++ b/chrome/browser/drive/drive_service_interface.h @@ -50,13 +50,6 @@ class DriveServiceInterface { // True if ready to send requests. virtual bool CanSendRequest() const = 0; - // Cancels all in-flight requests. - virtual void CancelAll() = 0; - - // Cancels ongoing request for a given virtual |file_path|. Returns true if - // the request was found and canceled. - virtual bool CancelForFilePath(const base::FilePath& file_path) = 0; - // Converts the given resource ID into the desired format. virtual std::string CanonicalizeResourceId( const std::string& resource_id) const = 0; diff --git a/chrome/browser/drive/dummy_drive_service.cc b/chrome/browser/drive/dummy_drive_service.cc index 7d2b70c..d9442d1 100644 --- a/chrome/browser/drive/dummy_drive_service.cc +++ b/chrome/browser/drive/dummy_drive_service.cc @@ -18,12 +18,6 @@ void DummyDriveService::RemoveObserver(DriveServiceObserver* observer) {} bool DummyDriveService::CanSendRequest() const { return true; } -void DummyDriveService::CancelAll() {} - -bool DummyDriveService::CancelForFilePath(const base::FilePath& file_path) { - return true; -} - std::string DummyDriveService::CanonicalizeResourceId( const std::string& resource_id) const { return resource_id; diff --git a/chrome/browser/drive/dummy_drive_service.h b/chrome/browser/drive/dummy_drive_service.h index cb535c4..e2c75ca 100644 --- a/chrome/browser/drive/dummy_drive_service.h +++ b/chrome/browser/drive/dummy_drive_service.h @@ -21,8 +21,6 @@ class DummyDriveService : public DriveServiceInterface { virtual void AddObserver(DriveServiceObserver* observer) OVERRIDE; virtual void RemoveObserver(DriveServiceObserver* observer) OVERRIDE; virtual bool CanSendRequest() const OVERRIDE; - virtual void CancelAll() OVERRIDE; - virtual bool CancelForFilePath(const base::FilePath& file_path) OVERRIDE; virtual std::string CanonicalizeResourceId( const std::string& resource_id) const OVERRIDE; virtual bool HasAccessToken() const OVERRIDE; diff --git a/chrome/browser/drive/fake_drive_service.cc b/chrome/browser/drive/fake_drive_service.cc index 47af7fd..8fec2c87 100644 --- a/chrome/browser/drive/fake_drive_service.cc +++ b/chrome/browser/drive/fake_drive_service.cc @@ -203,16 +203,6 @@ bool FakeDriveService::CanSendRequest() const { return true; } -void FakeDriveService::CancelAll() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); -} - -bool FakeDriveService::CancelForFilePath(const base::FilePath& file_path) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - last_cancelled_file_ = file_path; - return true; -} - std::string FakeDriveService::CanonicalizeResourceId( const std::string& resource_id) const { return resource_id; diff --git a/chrome/browser/drive/fake_drive_service.h b/chrome/browser/drive/fake_drive_service.h index ce9643e..f677c7d 100644 --- a/chrome/browser/drive/fake_drive_service.h +++ b/chrome/browser/drive/fake_drive_service.h @@ -81,8 +81,6 @@ class FakeDriveService : public DriveServiceInterface { virtual void AddObserver(DriveServiceObserver* observer) OVERRIDE; virtual void RemoveObserver(DriveServiceObserver* observer) OVERRIDE; virtual bool CanSendRequest() const OVERRIDE; - virtual void CancelAll() OVERRIDE; - virtual bool CancelForFilePath(const base::FilePath& file_path) OVERRIDE; virtual std::string CanonicalizeResourceId( const std::string& resource_id) const OVERRIDE; virtual std::string GetRootResourceId() const OVERRIDE; diff --git a/chrome/browser/drive/gdata_wapi_service.cc b/chrome/browser/drive/gdata_wapi_service.cc index db90f6f..8c8209c 100644 --- a/chrome/browser/drive/gdata_wapi_service.cc +++ b/chrome/browser/drive/gdata_wapi_service.cc @@ -145,16 +145,6 @@ bool GDataWapiService::CanSendRequest() const { return HasRefreshToken(); } -void GDataWapiService::CancelAll() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - sender_->CancelAll(); -} - -bool GDataWapiService::CancelForFilePath(const base::FilePath& file_path) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - return sender_->request_registry()->CancelForFilePath(file_path); -} - std::string GDataWapiService::CanonicalizeResourceId( const std::string& resource_id) const { return resource_id; diff --git a/chrome/browser/drive/gdata_wapi_service.h b/chrome/browser/drive/gdata_wapi_service.h index af83a43..ee91ecc 100644 --- a/chrome/browser/drive/gdata_wapi_service.h +++ b/chrome/browser/drive/gdata_wapi_service.h @@ -53,8 +53,6 @@ class GDataWapiService : public DriveServiceInterface, virtual void AddObserver(DriveServiceObserver* observer) OVERRIDE; virtual void RemoveObserver(DriveServiceObserver* observer) OVERRIDE; virtual bool CanSendRequest() const OVERRIDE; - virtual void CancelAll() OVERRIDE; - virtual bool CancelForFilePath(const base::FilePath& file_path) OVERRIDE; virtual std::string CanonicalizeResourceId( const std::string& resource_id) const OVERRIDE; virtual bool HasAccessToken() const OVERRIDE; diff --git a/chrome/browser/drive/mock_drive_service.h b/chrome/browser/drive/mock_drive_service.h index 01fada8..77b7770 100644 --- a/chrome/browser/drive/mock_drive_service.h +++ b/chrome/browser/drive/mock_drive_service.h @@ -30,8 +30,6 @@ class MockDriveService : public DriveServiceInterface { MOCK_METHOD1(RemoveObserver, void(DriveServiceObserver* observer)); MOCK_CONST_METHOD0(CanSendRequest, bool()); - MOCK_METHOD0(CancelAll, void(void)); - MOCK_METHOD1(CancelForFilePath, bool(const base::FilePath& file_path)); MOCK_CONST_METHOD1(CanonicalizeResourceId, std::string(const std::string& resource_id)); MOCK_CONST_METHOD0(GetRootResourceId, std::string()); diff --git a/chrome/browser/google_apis/request_registry.cc b/chrome/browser/google_apis/request_registry.cc index e7b8f74..240b388 100644 --- a/chrome/browser/google_apis/request_registry.cc +++ b/chrome/browser/google_apis/request_registry.cc @@ -60,36 +60,6 @@ RequestRegistry::RequestRegistry() { } RequestRegistry::~RequestRegistry() { - DCHECK(in_flight_requests_.IsEmpty()); -} - -void RequestRegistry::CancelAll() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - - for (RequestIDMap::iterator iter(&in_flight_requests_); - !iter.IsAtEnd(); - iter.Advance()) { - Request* request = iter.GetCurrentValue(); - CancelRequest(request); - // CancelRequest may immediately trigger OnRequestFinish and remove the - // request from the map, but IDMap is designed to be safe on such remove - // while iteration. - } -} - -bool RequestRegistry::CancelForFilePath(const base::FilePath& file_path) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - - for (RequestIDMap::iterator iter(&in_flight_requests_); - !iter.IsAtEnd(); - iter.Advance()) { - Request* request = iter.GetCurrentValue(); - if (request->progress_status().file_path == file_path) { - CancelRequest(request); - return true; - } - } - return false; } void RequestRegistry::CancelRequest(Request* request) { diff --git a/chrome/browser/google_apis/request_registry.h b/chrome/browser/google_apis/request_registry.h index 571fbfc..0c034a7 100644 --- a/chrome/browser/google_apis/request_registry.h +++ b/chrome/browser/google_apis/request_registry.h @@ -78,13 +78,6 @@ class RequestRegistry { RequestProgressStatus progress_status_; }; - // Cancels all in-flight requests. - void CancelAll(); - - // Cancels ongoing request for a given virtual |file_path|. Returns true if - // the request was found and canceled. - bool CancelForFilePath(const base::FilePath& file_path); - // Cancels the specified request. void CancelRequest(Request* request); diff --git a/chrome/browser/google_apis/request_sender.cc b/chrome/browser/google_apis/request_sender.cc index a1113e7..f4eae2464 100644 --- a/chrome/browser/google_apis/request_sender.cc +++ b/chrome/browser/google_apis/request_sender.cc @@ -35,11 +35,6 @@ void RequestSender::Initialize() { auth_service_->Initialize(profile_); } -void RequestSender::CancelAll() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - request_registry_->CancelAll(); -} - base::Closure RequestSender::StartRequestWithRetry( AuthenticatedRequestInterface* request) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); diff --git a/chrome/browser/google_apis/request_sender.h b/chrome/browser/google_apis/request_sender.h index a32d8aa..5b9b8dc 100644 --- a/chrome/browser/google_apis/request_sender.h +++ b/chrome/browser/google_apis/request_sender.h @@ -51,9 +51,6 @@ class RequestSender { // Prepares the object for use. virtual void Initialize(); - // Cancels all in-flight requests. - void CancelAll(); - // Starts a request implementing the AuthenticatedRequestInterface // interface, and makes the request retry upon authentication failures by // calling back to RetryRequest. diff --git a/chrome/browser/sync_file_system/drive/api_util.cc b/chrome/browser/sync_file_system/drive/api_util.cc index 17e6c9a..01aaa41 100644 --- a/chrome/browser/sync_file_system/drive/api_util.cc +++ b/chrome/browser/sync_file_system/drive/api_util.cc @@ -185,7 +185,6 @@ APIUtil::~APIUtil() { DCHECK(CalledOnValidThread()); net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); drive_service_->RemoveObserver(this); - drive_service_->CancelAll(); } void APIUtil::AddObserver(APIUtilObserver* observer) { diff --git a/chrome/browser/sync_file_system/drive_file_sync_service_mock_unittest.cc b/chrome/browser/sync_file_system/drive_file_sync_service_mock_unittest.cc index 28067c9..94d7d10 100644 --- a/chrome/browser/sync_file_system/drive_file_sync_service_mock_unittest.cc +++ b/chrome/browser/sync_file_system/drive_file_sync_service_mock_unittest.cc @@ -313,7 +313,6 @@ class DriveFileSyncServiceMockTest : public testing::Test { virtual void TearDown() OVERRIDE { EXPECT_CALL(*mock_drive_service(), RemoveObserver(_)); - EXPECT_CALL(*mock_drive_service(), CancelAll()); if (sync_service_) { sync_service_.reset(); |