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

Unified Diff: webkit/support/simple_database_system.cc

Issue 8510036: Take 2, base::Bind cleanup in SimpleDatabaseSystem (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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 | « webkit/support/simple_database_system.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/support/simple_database_system.cc
===================================================================
--- webkit/support/simple_database_system.cc (revision 109341)
+++ webkit/support/simple_database_system.cc (working copy)
@@ -5,6 +5,8 @@
#include "webkit/support/simple_database_system.h"
#include "base/auto_reset.h"
+#include "base/bind.h"
+#include "base/bind_helpers.h"
#include "base/file_util.h"
#include "base/message_loop.h"
#include "base/message_loop_proxy.h"
@@ -45,9 +47,10 @@
SimpleDatabaseSystem::~SimpleDatabaseSystem() {
base::WaitableEvent done_event(false, false);
- db_thread_proxy_->PostTask(FROM_HERE,
- NewRunnableMethod(this, &SimpleDatabaseSystem::ThreadCleanup,
- &done_event));
+ db_thread_proxy_->PostTask(
+ FROM_HERE,
+ base::Bind(&SimpleDatabaseSystem::ThreadCleanup,
+ base::Unretained(this), &done_event));
done_event.Wait();
instance_ = NULL;
}
@@ -56,37 +59,44 @@
string16 origin_identifier = database.securityOrigin().databaseIdentifier();
string16 database_name = database.name();
open_connections_->AddOpenConnection(origin_identifier, database_name);
- db_thread_proxy_->PostTask(FROM_HERE,
- NewRunnableMethod(this, &SimpleDatabaseSystem::DatabaseOpened,
- origin_identifier,
- database_name, database.displayName(),
- database.estimatedSize()));
+ db_thread_proxy_->PostTask(
+ FROM_HERE,
+ base::Bind(&SimpleDatabaseSystem::DatabaseOpened,
+ base::Unretained(this),
+ origin_identifier,
+ database_name, database.displayName(),
+ database.estimatedSize()));
}
void SimpleDatabaseSystem::databaseModified(
const WebKit::WebDatabase& database) {
- db_thread_proxy_->PostTask(FROM_HERE,
- NewRunnableMethod(this, &SimpleDatabaseSystem::DatabaseModified,
- database.securityOrigin().databaseIdentifier(),
- database.name()));
+ db_thread_proxy_->PostTask(
+ FROM_HERE,
+ base::Bind(&SimpleDatabaseSystem::DatabaseModified,
+ base::Unretained(this),
+ 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,
- NewRunnableMethod(this, &SimpleDatabaseSystem::DatabaseClosed,
- origin_identifier, database_name));
+ db_thread_proxy_->PostTask(
+ FROM_HERE,
+ base::Bind(&SimpleDatabaseSystem::DatabaseClosed,
+ base::Unretained(this), 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,
- NewRunnableMethod(this, &SimpleDatabaseSystem::VfsOpenFile,
- vfs_file_name, desired_flags,
- &result, &done_event));
+ db_thread_proxy_->PostTask(
+ FROM_HERE,
+ base::Bind(&SimpleDatabaseSystem::VfsOpenFile,
+ base::Unretained(this),
+ vfs_file_name, desired_flags,
+ &result, &done_event));
done_event.Wait();
return result;
}
@@ -95,10 +105,12 @@
const string16& vfs_file_name, bool sync_dir) {
int result = SQLITE_OK;
base::WaitableEvent done_event(false, false);
- db_thread_proxy_->PostTask(FROM_HERE,
- NewRunnableMethod(this, &SimpleDatabaseSystem::VfsDeleteFile,
- vfs_file_name, sync_dir,
- &result, &done_event));
+ db_thread_proxy_->PostTask(
+ FROM_HERE,
+ base::Bind(&SimpleDatabaseSystem::VfsDeleteFile,
+ base::Unretained(this),
+ vfs_file_name, sync_dir,
+ &result, &done_event));
done_event.Wait();
return result;
}
@@ -106,9 +118,10 @@
uint32 SimpleDatabaseSystem::GetFileAttributes(const string16& vfs_file_name) {
uint32 result = 0;
base::WaitableEvent done_event(false, false);
- db_thread_proxy_->PostTask(FROM_HERE,
- NewRunnableMethod(this, &SimpleDatabaseSystem::VfsGetFileAttributes,
- vfs_file_name, &result, &done_event));
+ db_thread_proxy_->PostTask(
+ FROM_HERE,
+ base::Bind(&SimpleDatabaseSystem::VfsGetFileAttributes,
+ base::Unretained(this), vfs_file_name, &result, &done_event));
done_event.Wait();
return result;
}
@@ -116,9 +129,10 @@
int64 SimpleDatabaseSystem::GetFileSize(const string16& vfs_file_name) {
int64 result = 0;
base::WaitableEvent done_event(false, false);
- db_thread_proxy_->PostTask(FROM_HERE,
- NewRunnableMethod(this, &SimpleDatabaseSystem::VfsGetFileSize,
- vfs_file_name, &result, &done_event));
+ db_thread_proxy_->PostTask(
+ FROM_HERE,
+ base::Bind(&SimpleDatabaseSystem::VfsGetFileSize,
+ base::Unretained(this), vfs_file_name, &result, &done_event));
done_event.Wait();
return result;
}
@@ -127,24 +141,28 @@
const string16& origin_identifier) {
int64 result = 0;
base::WaitableEvent done_event(false, false);
- db_thread_proxy_->PostTask(FROM_HERE,
- NewRunnableMethod(this, &SimpleDatabaseSystem::VfsGetSpaceAvailable,
- origin_identifier, &result, &done_event));
+ db_thread_proxy_->PostTask(
+ FROM_HERE,
+ base::Bind(&SimpleDatabaseSystem::VfsGetSpaceAvailable,
+ base::Unretained(this), origin_identifier,
+ &result, &done_event));
done_event.Wait();
return result;
}
void SimpleDatabaseSystem::ClearAllDatabases() {
open_connections_->WaitForAllDatabasesToClose();
- db_thread_proxy_->PostTask(FROM_HERE,
- NewRunnableMethod(this, &SimpleDatabaseSystem::ResetTracker));
+ db_thread_proxy_->PostTask(
+ FROM_HERE,
+ base::Bind(&SimpleDatabaseSystem::ResetTracker, base::Unretained(this)));
}
void SimpleDatabaseSystem::SetDatabaseQuota(int64 quota) {
if (!db_thread_proxy_->BelongsToCurrentThread()) {
- db_thread_proxy_->PostTask(FROM_HERE,
- NewRunnableMethod(this, &SimpleDatabaseSystem::SetDatabaseQuota,
- quota));
+ db_thread_proxy_->PostTask(
+ FROM_HERE,
+ base::Bind(&SimpleDatabaseSystem::SetDatabaseQuota,
+ base::Unretained(this), quota));
return;
}
quota_per_origin_ = quota;
« no previous file with comments | « webkit/support/simple_database_system.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698