summaryrefslogtreecommitdiffstats
path: root/webkit/database
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-19 22:12:07 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-19 22:12:07 +0000
commita74417ba2fce2f63fcbff6281d27553ddcdb95ce (patch)
tree10997d1bc9052c665d57e8548503d9c68c7b65aa /webkit/database
parent73a6d12fa3c00b35aa40c65b0356285efbb1583b (diff)
downloadchromium_src-a74417ba2fce2f63fcbff6281d27553ddcdb95ce.zip
chromium_src-a74417ba2fce2f63fcbff6281d27553ddcdb95ce.tar.gz
chromium_src-a74417ba2fce2f63fcbff6281d27553ddcdb95ce.tar.bz2
base::Bind: Convert webkit/database.
BUG=none TEST=none R=groby@chromium.org Review URL: http://codereview.chromium.org/8355013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106399 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/database')
-rw-r--r--webkit/database/database_connections.cc8
-rw-r--r--webkit/database/database_connections_unittest.cc23
-rw-r--r--webkit/database/database_quota_client.cc3
-rw-r--r--webkit/database/database_quota_client_unittest.cc7
-rw-r--r--webkit/database/database_tracker.cc9
5 files changed, 29 insertions, 21 deletions
diff --git a/webkit/database/database_connections.cc b/webkit/database/database_connections.cc
index a5d762d..f38a869 100644
--- a/webkit/database/database_connections.cc
+++ b/webkit/database/database_connections.cc
@@ -5,6 +5,7 @@
#include "webkit/database/database_connections.h"
#include "base/auto_reset.h"
+#include "base/bind.h"
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/message_loop_proxy.h"
@@ -156,9 +157,10 @@ void DatabaseConnectionsWrapper::RemoveOpenConnection(
// But only remove from the collection on the main thread
// so we can handle the waiting_for_dbs_to_close_ case.
if (!main_thread_->BelongsToCurrentThread()) {
- main_thread_->PostTask(FROM_HERE, NewRunnableMethod(
- this, &DatabaseConnectionsWrapper::RemoveOpenConnection,
- origin_identifier, database_name));
+ main_thread_->PostTask(
+ FROM_HERE,
+ base::Bind(&DatabaseConnectionsWrapper::RemoveOpenConnection, this,
+ origin_identifier, database_name));
return;
}
base::AutoLock auto_lock(open_connections_lock_);
diff --git a/webkit/database/database_connections_unittest.cc b/webkit/database/database_connections_unittest.cc
index a91654a..27eb8cc 100644
--- a/webkit/database/database_connections_unittest.cc
+++ b/webkit/database/database_connections_unittest.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/bind.h"
#include "base/message_loop.h"
#include "base/task.h"
#include "base/threading/thread.h"
@@ -26,9 +27,10 @@ void ScheduleRemoveConnectionTask(
const string16& database_name,
scoped_refptr<DatabaseConnectionsWrapper> obj,
bool* did_task_execute) {
- thread->message_loop()->PostTask(FROM_HERE,
- NewRunnableFunction(RemoveConnectionTask,
- origin_id, database_name, obj, did_task_execute));
+ thread->message_loop()->PostTask(
+ FROM_HERE,
+ base::Bind(&RemoveConnectionTask, origin_id, database_name, obj,
+ did_task_execute));
}
} // anonymous namespace
@@ -116,9 +118,10 @@ TEST(DatabaseConnectionsTest, DatabaseConnectionsWrapperTest) {
// being removed on the current thread.
obj->AddOpenConnection(kOriginId, kName);
bool did_task_execute = false;
- MessageLoop::current()->PostTask(FROM_HERE,
- NewRunnableFunction(&RemoveConnectionTask,
- kOriginId, kName, obj, &did_task_execute));
+ MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&RemoveConnectionTask, kOriginId, kName, obj,
+ &did_task_execute));
obj->WaitForAllDatabasesToClose(); // should return after the task executes
EXPECT_TRUE(did_task_execute);
EXPECT_FALSE(obj->HasOpenConnections());
@@ -129,10 +132,10 @@ TEST(DatabaseConnectionsTest, DatabaseConnectionsWrapperTest) {
base::Thread thread("WrapperTestThread");
thread.Start();
did_task_execute = false;
- MessageLoop::current()->PostTask(FROM_HERE,
- NewRunnableFunction(ScheduleRemoveConnectionTask,
- &thread, kOriginId, kName,
- obj, &did_task_execute));
+ MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&ScheduleRemoveConnectionTask, &thread, kOriginId, kName, obj,
+ &did_task_execute));
obj->WaitForAllDatabasesToClose(); // should return after the task executes
EXPECT_TRUE(did_task_execute);
EXPECT_FALSE(obj->HasOpenConnections());
diff --git a/webkit/database/database_quota_client.cc b/webkit/database/database_quota_client.cc
index fd2eb5a..669052c 100644
--- a/webkit/database/database_quota_client.cc
+++ b/webkit/database/database_quota_client.cc
@@ -6,6 +6,7 @@
#include <vector>
+#include "base/bind.h"
#include "base/location.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop_proxy.h"
@@ -172,7 +173,7 @@ class DatabaseQuotaClient::DeleteOriginTask : public HelperTask {
if (rv == net::OK)
result_ = quota::kQuotaStatusOk;
original_message_loop()->PostTask(
- FROM_HERE, NewRunnableMethod(this, &DeleteOriginTask::CallCompleted));
+ FROM_HERE, base::Bind(&DeleteOriginTask::CallCompleted, this));
Release(); // balanced in RunOnTargetThreadAsync
}
diff --git a/webkit/database/database_quota_client_unittest.cc b/webkit/database/database_quota_client_unittest.cc
index 09f096e..797d7cf 100644
--- a/webkit/database/database_quota_client_unittest.cc
+++ b/webkit/database/database_quota_client_unittest.cc
@@ -71,9 +71,10 @@ class MockDatabaseTracker : public DatabaseTracker {
net::OldCompletionCallback* callback) {
++delete_called_count_;
if (async_delete()) {
- base::MessageLoopProxy::current()->PostTask(FROM_HERE,
- NewRunnableMethod(this,
- &MockDatabaseTracker::AsyncDeleteDataForOrigin, callback));
+ base::MessageLoopProxy::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&MockDatabaseTracker::AsyncDeleteDataForOrigin, this,
+ callback));
return net::ERR_IO_PENDING;
}
return net::OK;
diff --git a/webkit/database/database_tracker.cc b/webkit/database/database_tracker.cc
index 1bd532c..8e09d16 100644
--- a/webkit/database/database_tracker.cc
+++ b/webkit/database/database_tracker.cc
@@ -8,6 +8,7 @@
#include <vector>
#include "base/basictypes.h"
+#include "base/bind.h"
#include "base/file_util.h"
#include "base/message_loop_proxy.h"
#include "base/platform_file.h"
@@ -863,10 +864,10 @@ void DatabaseTracker::Shutdown() {
void DatabaseTracker::SetClearLocalStateOnExit(bool clear_local_state_on_exit) {
DCHECK(db_tracker_thread_.get());
if (!db_tracker_thread_->BelongsToCurrentThread()) {
- db_tracker_thread_->PostTask(FROM_HERE,
- NewRunnableMethod(this,
- &DatabaseTracker::SetClearLocalStateOnExit,
- clear_local_state_on_exit));
+ db_tracker_thread_->PostTask(
+ FROM_HERE,
+ base::Bind(&DatabaseTracker::SetClearLocalStateOnExit, this,
+ clear_local_state_on_exit));
return;
}
if (shutting_down_) {