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

Unified Diff: webkit/glue/webthread_impl.cc

Issue 8550010: base::Bind() conversion for webkit. (Closed) Base URL: svn://svn.chromium.org/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/glue/resource_fetcher_unittest.cc ('k') | webkit/glue/weburlloader_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webthread_impl.cc
diff --git a/webkit/glue/webthread_impl.cc b/webkit/glue/webthread_impl.cc
index 26ce1a34f8c907f550268a384e3820113d1ee04b..236497e6891e07e6c64ddc005807b154ddca8631 100644
--- a/webkit/glue/webthread_impl.cc
+++ b/webkit/glue/webthread_impl.cc
@@ -7,34 +7,27 @@
#include "webkit/glue/webthread_impl.h"
-#include "base/task.h"
+#include "base/bind.h"
+#include "base/bind_helpers.h"
#include "base/message_loop.h"
namespace webkit_glue {
-class TaskAdapter : public Task {
-public:
- TaskAdapter(WebKit::WebThread::Task* task) : task_(task) { }
- virtual void Run() {
- task_->run();
- }
-private:
- scoped_ptr<WebKit::WebThread::Task> task_;
-};
-
WebThreadImpl::WebThreadImpl(const char* name)
: thread_(new base::Thread(name)) {
thread_->Start();
}
void WebThreadImpl::postTask(Task* task) {
- thread_->message_loop()->PostTask(FROM_HERE,
- new TaskAdapter(task));
+ thread_->message_loop()->PostTask(
+ FROM_HERE, base::Bind(&WebKit::WebThread::Task::run, base::Owned(task)));
}
void WebThreadImpl::postDelayedTask(
Task* task, long long delay_ms) {
thread_->message_loop()->PostDelayedTask(
- FROM_HERE, new TaskAdapter(task), delay_ms);
+ FROM_HERE,
+ base::Bind(&WebKit::WebThread::Task::run, base::Owned(task)),
+ delay_ms);
}
WebThreadImpl::~WebThreadImpl() {
@@ -47,12 +40,16 @@ WebThreadImplForMessageLoop::WebThreadImplForMessageLoop(
}
void WebThreadImplForMessageLoop::postTask(Task* task) {
- message_loop_->PostTask(FROM_HERE, new TaskAdapter(task));
+ message_loop_->PostTask(
+ FROM_HERE, base::Bind(&WebKit::WebThread::Task::run, base::Owned(task)));
}
void WebThreadImplForMessageLoop::postDelayedTask(
Task* task, long long delay_ms) {
- message_loop_->PostDelayedTask(FROM_HERE, new TaskAdapter(task), delay_ms);
+ message_loop_->PostDelayedTask(
+ FROM_HERE,
+ base::Bind(&WebKit::WebThread::Task::run, base::Owned(task)),
+ delay_ms);
}
WebThreadImplForMessageLoop::~WebThreadImplForMessageLoop() {
« no previous file with comments | « webkit/glue/resource_fetcher_unittest.cc ('k') | webkit/glue/weburlloader_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698