diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-01 20:38:10 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-01 20:38:10 +0000 |
commit | f1f3f0f8af3740ec2afaebcaed410950a9cc0ac8 (patch) | |
tree | 6ccdd87ccfc89adbcb372c517559fa61fbc6c6b2 /webkit/database | |
parent | d1666539b57bf8552e203d355fd09909d36f9732 (diff) | |
download | chromium_src-f1f3f0f8af3740ec2afaebcaed410950a9cc0ac8.zip chromium_src-f1f3f0f8af3740ec2afaebcaed410950a9cc0ac8.tar.gz chromium_src-f1f3f0f8af3740ec2afaebcaed410950a9cc0ac8.tar.bz2 |
Begin CompletionCallback switchover.
Rename CompletionCallback to OldCompletionCallback in preparation for introducing a new CompletionCallback based on base::Callback.
Also renames other CompletionCallback types like CancelableCompletionCallback and TestCompletionCallback and CompletionCallbackImpl. All using sed with s/CompletionCallback/OldCompletionCallback/g.
BUG=98719
TEST=none
Review URL: http://codereview.chromium.org/8070013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103650 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/database')
-rw-r--r-- | webkit/database/database_quota_client.cc | 10 | ||||
-rw-r--r-- | webkit/database/database_quota_client_unittest.cc | 4 | ||||
-rw-r--r-- | webkit/database/database_tracker.cc | 14 | ||||
-rw-r--r-- | webkit/database/database_tracker.h | 10 | ||||
-rw-r--r-- | webkit/database/database_tracker_unittest.cc | 2 |
5 files changed, 20 insertions, 20 deletions
diff --git a/webkit/database/database_quota_client.cc b/webkit/database/database_quota_client.cc index f72910d..32482fd 100644 --- a/webkit/database/database_quota_client.cc +++ b/webkit/database/database_quota_client.cc @@ -143,7 +143,7 @@ class DatabaseQuotaClient::DeleteOriginTask : public HelperTask { result_(quota::kQuotaStatusUnknown), caller_callback_(caller_callback), ALLOW_THIS_IN_INITIALIZER_LIST(completion_callback_( - this, &DeleteOriginTask::OnCompletionCallback)) { + this, &DeleteOriginTask::OnOldCompletionCallback)) { } private: @@ -159,16 +159,16 @@ class DatabaseQuotaClient::DeleteOriginTask : public HelperTask { } virtual bool RunOnTargetThreadAsync() OVERRIDE { - AddRef(); // balanced in OnCompletionCallback + AddRef(); // balanced in OnOldCompletionCallback string16 origin_id = DatabaseUtil::GetOriginIdentifier(origin_url_); int rv = db_tracker_->DeleteDataForOrigin(origin_id, &completion_callback_); if (rv == net::ERR_IO_PENDING) return false; // we wait for the callback - OnCompletionCallback(rv); + OnOldCompletionCallback(rv); return false; } - void OnCompletionCallback(int rv) { + void OnOldCompletionCallback(int rv) { if (rv == net::OK) result_ = quota::kQuotaStatusOk; original_message_loop()->PostTask( @@ -179,7 +179,7 @@ class DatabaseQuotaClient::DeleteOriginTask : public HelperTask { const GURL origin_url_; quota::QuotaStatusCode result_; scoped_ptr<DeletionCallback> caller_callback_; - net::CompletionCallbackImpl<DeleteOriginTask> completion_callback_; + net::OldCompletionCallbackImpl<DeleteOriginTask> completion_callback_; }; // DatabaseQuotaClient -------------------------------------------------------- diff --git a/webkit/database/database_quota_client_unittest.cc b/webkit/database/database_quota_client_unittest.cc index 2f29f60..ba91206 100644 --- a/webkit/database/database_quota_client_unittest.cc +++ b/webkit/database/database_quota_client_unittest.cc @@ -68,7 +68,7 @@ class MockDatabaseTracker : public DatabaseTracker { virtual int DeleteDataForOrigin( const string16& origin_id, - net::CompletionCallback* callback) { + net::OldCompletionCallback* callback) { ++delete_called_count_; if (async_delete()) { base::MessageLoopProxy::current()->PostTask(FROM_HERE, @@ -79,7 +79,7 @@ class MockDatabaseTracker : public DatabaseTracker { return net::OK; } - void AsyncDeleteDataForOrigin(net::CompletionCallback* callback) { + void AsyncDeleteDataForOrigin(net::OldCompletionCallback* callback) { callback->Run(net::OK); } diff --git a/webkit/database/database_tracker.cc b/webkit/database/database_tracker.cc index 12c6f5c..1bd532c 100644 --- a/webkit/database/database_tracker.cc +++ b/webkit/database/database_tracker.cc @@ -214,7 +214,7 @@ void DatabaseTracker::DeleteDatabaseIfNeeded(const string16& origin_identifier, if (dbs_to_be_deleted_[origin_identifier].empty()) dbs_to_be_deleted_.erase(origin_identifier); - std::vector<net::CompletionCallback*> to_be_deleted; + std::vector<net::OldCompletionCallback*> to_be_deleted; for (PendingCompletionMap::iterator callback = deletion_callbacks_.begin(); callback != deletion_callbacks_.end(); ++callback) { DatabaseSet::iterator found_origin = @@ -225,14 +225,14 @@ void DatabaseTracker::DeleteDatabaseIfNeeded(const string16& origin_identifier, if (databases.empty()) { callback->second.erase(found_origin); if (callback->second.empty()) { - net::CompletionCallback* cb = callback->first; + net::OldCompletionCallback* cb = callback->first; cb->Run(net::OK); to_be_deleted.push_back(cb); } } } } - for (std::vector<net::CompletionCallback*>::iterator cb = + for (std::vector<net::OldCompletionCallback*>::iterator cb = to_be_deleted.begin(); cb != to_be_deleted.end(); ++cb) deletion_callbacks_.erase(*cb); } @@ -629,7 +629,7 @@ void DatabaseTracker::ScheduleDatabaseForDeletion( void DatabaseTracker::ScheduleDatabasesForDeletion( const DatabaseSet& databases, - net::CompletionCallback* callback) { + net::OldCompletionCallback* callback) { DCHECK(!callback || deletion_callbacks_.find(callback) == deletion_callbacks_.end()); DCHECK(!databases.empty()); @@ -645,7 +645,7 @@ void DatabaseTracker::ScheduleDatabasesForDeletion( int DatabaseTracker::DeleteDatabase(const string16& origin_identifier, const string16& database_name, - net::CompletionCallback* callback) { + net::OldCompletionCallback* callback) { if (!LazyInit()) return net::ERR_FAILED; @@ -665,7 +665,7 @@ int DatabaseTracker::DeleteDatabase(const string16& origin_identifier, int DatabaseTracker::DeleteDataModifiedSince( const base::Time& cutoff, - net::CompletionCallback* callback) { + net::OldCompletionCallback* callback) { if (!LazyInit()) return net::ERR_FAILED; @@ -715,7 +715,7 @@ int DatabaseTracker::DeleteDataModifiedSince( } int DatabaseTracker::DeleteDataForOrigin(const string16& origin, - net::CompletionCallback* callback) { + net::OldCompletionCallback* callback) { if (!LazyInit()) return net::ERR_FAILED; diff --git a/webkit/database/database_tracker.h b/webkit/database/database_tracker.h index 1acfc92..c2432f5 100644 --- a/webkit/database/database_tracker.h +++ b/webkit/database/database_tracker.h @@ -133,7 +133,7 @@ class DatabaseTracker // if non-NULL. int DeleteDatabase(const string16& origin_identifier, const string16& database_name, - net::CompletionCallback* callback); + net::OldCompletionCallback* callback); // Delete any databases that have been touched since the cutoff date that's // supplied, omitting any that match IDs within |protected_origins|. @@ -142,14 +142,14 @@ class DatabaseTracker // if non-NULL. Protected origins, according the the SpecialStoragePolicy, // are not deleted by this method. int DeleteDataModifiedSince(const base::Time& cutoff, - net::CompletionCallback* callback); + net::OldCompletionCallback* callback); // Delete all databases that belong to the given origin. Returns net::OK on // success, net::FAILED if not all databases could be deleted, and // net::ERR_IO_PENDING and |callback| is invoked upon completion, if non-NULL. // virtual for unit testing only virtual int DeleteDataForOrigin(const string16& origin_identifier, - net::CompletionCallback* callback); + net::OldCompletionCallback* callback); bool IsIncognitoProfile() const { return is_incognito_; } @@ -170,7 +170,7 @@ class DatabaseTracker friend class MockDatabaseTracker; // for testing typedef std::map<string16, std::set<string16> > DatabaseSet; - typedef std::map<net::CompletionCallback*, DatabaseSet> PendingCompletionMap; + typedef std::map<net::OldCompletionCallback*, DatabaseSet> PendingCompletionMap; typedef std::map<string16, base::PlatformFile> FileHandlesMap; typedef std::map<string16, string16> OriginDirectoriesMap; @@ -247,7 +247,7 @@ class DatabaseTracker // Schedule a set of open databases for deletion. If non-null, callback is // invoked upon completion. void ScheduleDatabasesForDeletion(const DatabaseSet& databases, - net::CompletionCallback* callback); + net::OldCompletionCallback* callback); // Returns the directory where all DB files for the given origin are stored. string16 GetOriginDirectory(const string16& origin_identifier); diff --git a/webkit/database/database_tracker_unittest.cc b/webkit/database/database_tracker_unittest.cc index 6fa492c..e46e16b 100644 --- a/webkit/database/database_tracker_unittest.cc +++ b/webkit/database/database_tracker_unittest.cc @@ -214,7 +214,7 @@ class DatabaseTracker_TestHelper_Test { // Delete db1. Should also delete origin1. TestObserver observer; tracker->AddObserver(&observer); - TestCompletionCallback callback; + TestOldCompletionCallback callback; int result = tracker->DeleteDatabase(kOrigin1, kDB1, &callback); EXPECT_EQ(net::ERR_IO_PENDING, result); ASSERT_FALSE(callback.have_result()); |