diff options
author | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-10 00:21:16 +0000 |
---|---|---|
committer | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-10 00:21:16 +0000 |
commit | b0eb45a0dd246ff17cdd2afdb11f790664c2091f (patch) | |
tree | 705793252fd793961737ff3994ca465a4e90d0c3 | |
parent | 92a37b488c6481a400ac2903d6b1dfbd1ae14e9d (diff) | |
download | chromium_src-b0eb45a0dd246ff17cdd2afdb11f790664c2091f.zip chromium_src-b0eb45a0dd246ff17cdd2afdb11f790664c2091f.tar.gz chromium_src-b0eb45a0dd246ff17cdd2afdb11f790664c2091f.tar.bz2 |
Revert 109337 - base::Bind cleanup in SimpleDatabaseSystem
Review URL: http://codereview.chromium.org/8497053
TBR=michaeln@google.com
Review URL: http://codereview.chromium.org/8497057
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109341 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | webkit/support/simple_database_system.cc | 91 | ||||
-rw-r--r-- | webkit/support/simple_database_system.h | 3 |
2 files changed, 40 insertions, 54 deletions
diff --git a/webkit/support/simple_database_system.cc b/webkit/support/simple_database_system.cc index 192ced7..73a2452 100644 --- a/webkit/support/simple_database_system.cc +++ b/webkit/support/simple_database_system.cc @@ -5,7 +5,6 @@ #include "webkit/support/simple_database_system.h" #include "base/auto_reset.h" -#include "base/bind_helpers.h" #include "base/file_util.h" #include "base/message_loop.h" #include "base/message_loop_proxy.h" @@ -46,10 +45,9 @@ SimpleDatabaseSystem::SimpleDatabaseSystem() SimpleDatabaseSystem::~SimpleDatabaseSystem() { base::WaitableEvent done_event(false, false); - db_thread_proxy_->PostTask( - FROM_HERE, - base::Bind(&SimpleDatabaseSystem::ThreadCleanup, - base::Unretained(this), &done_event)); + db_thread_proxy_->PostTask(FROM_HERE, + NewRunnableMethod(this, &SimpleDatabaseSystem::ThreadCleanup, + &done_event)); done_event.Wait(); instance_ = NULL; } @@ -58,44 +56,37 @@ void SimpleDatabaseSystem::databaseOpened(const WebKit::WebDatabase& database) { string16 origin_identifier = database.securityOrigin().databaseIdentifier(); string16 database_name = database.name(); open_connections_->AddOpenConnection(origin_identifier, database_name); - db_thread_proxy_->PostTask( - FROM_HERE, - base::Bind(&SimpleDatabaseSystem::DatabaseOpened, - base::Unretained(this), - origin_identifier, - database_name, database.displayName(), - database.estimatedSize())); + db_thread_proxy_->PostTask(FROM_HERE, + NewRunnableMethod(this, &SimpleDatabaseSystem::DatabaseOpened, + origin_identifier, + database_name, database.displayName(), + database.estimatedSize())); } void SimpleDatabaseSystem::databaseModified( const WebKit::WebDatabase& database) { - db_thread_proxy_->PostTask( - FROM_HERE, - base::Bind(&SimpleDatabaseSystem::DatabaseModified, - base::Unretained(this), - database.securityOrigin().databaseIdentifier(), - database.name())); + db_thread_proxy_->PostTask(FROM_HERE, + NewRunnableMethod(this, &SimpleDatabaseSystem::DatabaseModified, + database.securityOrigin().databaseIdentifier(), + database.name())); } void SimpleDatabaseSystem::databaseClosed(const WebKit::WebDatabase& database) { string16 origin_identifier = database.securityOrigin().databaseIdentifier(); string16 database_name = database.name(); - db_thread_proxy_->PostTask( - FROM_HERE, - base::Bind(&SimpleDatabaseSystem::DatabaseClosed, - base::Unretained(this), origin_identifier, database_name)); + db_thread_proxy_->PostTask(FROM_HERE, + NewRunnableMethod(this, &SimpleDatabaseSystem::DatabaseClosed, + origin_identifier, database_name)); } base::PlatformFile SimpleDatabaseSystem::OpenFile( const string16& vfs_file_name, int desired_flags) { base::PlatformFile result = base::kInvalidPlatformFileValue; base::WaitableEvent done_event(false, false); - db_thread_proxy_->PostTask( - FROM_HERE, - base::Bind(&SimpleDatabaseSystem::VfsOpenFile, - base::Unretained(this), - vfs_file_name, desired_flags, - &result, &done_event)); + db_thread_proxy_->PostTask(FROM_HERE, + NewRunnableMethod(this, &SimpleDatabaseSystem::VfsOpenFile, + vfs_file_name, desired_flags, + &result, &done_event)); done_event.Wait(); return result; } @@ -104,12 +95,10 @@ int SimpleDatabaseSystem::DeleteFile( const string16& vfs_file_name, bool sync_dir) { int result = SQLITE_OK; base::WaitableEvent done_event(false, false); - db_thread_proxy_->PostTask( - FROM_HERE, - base::Bind(&SimpleDatabaseSystem::VfsDeleteFile, - base::Unretained(this), - vfs_file_name, sync_dir, - &result, &done_event)); + db_thread_proxy_->PostTask(FROM_HERE, + NewRunnableMethod(this, &SimpleDatabaseSystem::VfsDeleteFile, + vfs_file_name, sync_dir, + &result, &done_event)); done_event.Wait(); return result; } @@ -117,10 +106,9 @@ int SimpleDatabaseSystem::DeleteFile( uint32 SimpleDatabaseSystem::GetFileAttributes(const string16& vfs_file_name) { uint32 result = 0; base::WaitableEvent done_event(false, false); - db_thread_proxy_->PostTask( - FROM_HERE, - base::Bind(&SimpleDatabaseSystem::VfsGetFileAttributes, - base::Unretained(this), vfs_file_name, &result, &done_event)); + db_thread_proxy_->PostTask(FROM_HERE, + NewRunnableMethod(this, &SimpleDatabaseSystem::VfsGetFileAttributes, + vfs_file_name, &result, &done_event)); done_event.Wait(); return result; } @@ -128,10 +116,9 @@ uint32 SimpleDatabaseSystem::GetFileAttributes(const string16& vfs_file_name) { int64 SimpleDatabaseSystem::GetFileSize(const string16& vfs_file_name) { int64 result = 0; base::WaitableEvent done_event(false, false); - db_thread_proxy_->PostTask( - FROM_HERE, - base::Bind(&SimpleDatabaseSystem::VfsGetFileSize, - base::Unretained(this), vfs_file_name, &result, &done_event)); + db_thread_proxy_->PostTask(FROM_HERE, + NewRunnableMethod(this, &SimpleDatabaseSystem::VfsGetFileSize, + vfs_file_name, &result, &done_event)); done_event.Wait(); return result; } @@ -140,28 +127,24 @@ int64 SimpleDatabaseSystem::GetSpaceAvailable( const string16& origin_identifier) { int64 result = 0; base::WaitableEvent done_event(false, false); - db_thread_proxy_->PostTask( - FROM_HERE, - base::Bind(&SimpleDatabaseSystem::VfsGetSpaceAvailable, - base::Unretained(this), origin_identifier, - &result, &done_event)); + db_thread_proxy_->PostTask(FROM_HERE, + NewRunnableMethod(this, &SimpleDatabaseSystem::VfsGetSpaceAvailable, + origin_identifier, &result, &done_event)); done_event.Wait(); return result; } void SimpleDatabaseSystem::ClearAllDatabases() { open_connections_->WaitForAllDatabasesToClose(); - db_thread_proxy_->PostTask( - FROM_HERE, - base::Bind(&SimpleDatabaseSystem::ResetTracker, base::Unretained(this))); + db_thread_proxy_->PostTask(FROM_HERE, + NewRunnableMethod(this, &SimpleDatabaseSystem::ResetTracker)); } void SimpleDatabaseSystem::SetDatabaseQuota(int64 quota) { if (!db_thread_proxy_->BelongsToCurrentThread()) { - db_thread_proxy_->PostTask( - FROM_HERE, - base::Bind(&SimpleDatabaseSystem::SetDatabaseQuota, - base::Unretained(this), quota)); + db_thread_proxy_->PostTask(FROM_HERE, + NewRunnableMethod(this, &SimpleDatabaseSystem::SetDatabaseQuota, + quota)); return; } quota_per_origin_ = quota; diff --git a/webkit/support/simple_database_system.h b/webkit/support/simple_database_system.h index b15cb48..14c9014 100644 --- a/webkit/support/simple_database_system.h +++ b/webkit/support/simple_database_system.h @@ -12,6 +12,7 @@ #include "base/scoped_temp_dir.h" #include "base/string16.h" #include "base/synchronization/lock.h" +#include "base/task.h" #include "base/threading/thread.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDatabaseObserver.h" #include "webkit/database/database_connections.h" @@ -100,4 +101,6 @@ class SimpleDatabaseSystem : public webkit_database::DatabaseTracker::Observer, static SimpleDatabaseSystem* instance_; }; +DISABLE_RUNNABLE_METHOD_REFCOUNT(SimpleDatabaseSystem); + #endif // WEBKIT_SUPPORT_SIMPLE_DATABASE_SYSTEM_H_ |