summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-19 19:32:51 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-19 19:32:51 +0000
commit8105051b2f62c29f80a27a4242141082e45f4c55 (patch)
tree393e801ea8abeab91e1ee8534892012d51e981ef /content
parent97ef83f1b09593f78e402f32d6ed3f6d4a9526ac (diff)
downloadchromium_src-8105051b2f62c29f80a27a4242141082e45f4c55.zip
chromium_src-8105051b2f62c29f80a27a4242141082e45f4c55.tar.gz
chromium_src-8105051b2f62c29f80a27a4242141082e45f4c55.tar.bz2
base::Bind: Fixes in content/
BUG=none TEST=none R=groby Review URL: http://codereview.chromium.org/8987003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115010 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/appcache/chrome_appcache_service_unittest.cc9
-rw-r--r--content/browser/plugin_service.cc7
-rw-r--r--content/plugin/plugin_channel.cc13
-rw-r--r--content/renderer/media/audio_renderer_impl_unittest.cc21
4 files changed, 18 insertions, 32 deletions
diff --git a/content/browser/appcache/chrome_appcache_service_unittest.cc b/content/browser/appcache/chrome_appcache_service_unittest.cc
index 45c51e9..78b2197 100644
--- a/content/browser/appcache/chrome_appcache_service_unittest.cc
+++ b/content/browser/appcache/chrome_appcache_service_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/file_util.h"
#include "base/memory/ref_counted.h"
#include "base/message_loop.h"
@@ -79,11 +80,9 @@ ChromeAppCacheServiceTest::CreateAppCacheService(
mock_policy->AddSessionOnly(kSessionOnlyManifestURL.GetOrigin());
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
- NewRunnableMethod(appcache_service.get(),
- &ChromeAppCacheService::InitializeOnIOThread,
- appcache_path,
- resource_context,
- mock_policy));
+ base::Bind(&ChromeAppCacheService::InitializeOnIOThread,
+ appcache_service.get(), appcache_path, resource_context,
+ mock_policy));
// Steps needed to initialize the storage of AppCache data.
message_loop_.RunAllPending();
if (init_storage) {
diff --git a/content/browser/plugin_service.cc b/content/browser/plugin_service.cc
index be0f97d..7e87513 100644
--- a/content/browser/plugin_service.cc
+++ b/content/browser/plugin_service.cc
@@ -207,9 +207,8 @@ void PluginService::StartWatchingPlugins() {
VLOG(1) << "Watching for changes in: " << plugin_dirs[i].value();
BrowserThread::PostTask(
BrowserThread::FILE, FROM_HERE,
- NewRunnableFunction(
- &PluginService::RegisterFilePathWatcher,
- watcher, plugin_dirs[i], file_watcher_delegate_));
+ base::Bind(&PluginService::RegisterFilePathWatcher, watcher,
+ plugin_dirs[i], file_watcher_delegate_));
file_watchers_.push_back(watcher);
}
#endif
@@ -566,7 +565,7 @@ void PluginService::Observe(int type,
#if defined(OS_MACOSX)
if (type == content::NOTIFICATION_APP_ACTIVATED) {
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
- NewRunnableFunction(&NotifyPluginsOfActivation));
+ base::Bind(&NotifyPluginsOfActivation));
return;
}
#endif
diff --git a/content/plugin/plugin_channel.cc b/content/plugin/plugin_channel.cc
index 1e480ae..a410af7 100644
--- a/content/plugin/plugin_channel.cc
+++ b/content/plugin/plugin_channel.cc
@@ -26,12 +26,9 @@
namespace {
-class PluginReleaseTask : public Task {
- public:
- void Run() {
- ChildProcess::current()->ReleaseProcess();
- }
-};
+void PluginReleaseCallback() {
+ ChildProcess::current()->ReleaseProcess();
+}
// How long we wait before releasing the plugin process.
const int kPluginReleaseTimeMs = 5 * 60 * 1000; // 5 minutes
@@ -179,8 +176,8 @@ PluginChannel::~PluginChannel() {
if (renderer_handle_)
base::CloseProcessHandle(renderer_handle_);
- MessageLoop::current()->PostDelayedTask(FROM_HERE, new PluginReleaseTask(),
- kPluginReleaseTimeMs);
+ MessageLoop::current()->PostDelayedTask(
+ FROM_HERE, base::Bind(&PluginReleaseCallback), kPluginReleaseTimeMs);
}
bool PluginChannel::Send(IPC::Message* msg) {
diff --git a/content/renderer/media/audio_renderer_impl_unittest.cc b/content/renderer/media/audio_renderer_impl_unittest.cc
index 3a653db..21c2c99 100644
--- a/content/renderer/media/audio_renderer_impl_unittest.cc
+++ b/content/renderer/media/audio_renderer_impl_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/bind.h"
+#include "base/bind_helpers.h"
#include "base/message_loop.h"
#include "base/process_util.h"
#include "base/synchronization/waitable_event.h"
@@ -43,22 +44,12 @@ class MockRenderProcess : public RenderProcess {
};
}
-// This task can be posted on the IO thread and will signal an event when
+// This callback can be posted on the IO thread and will signal an event when
// done. The caller can then wait for this signal to ensure that no
// additional tasks remain in the task queue.
-class WaitTask : public Task {
- public:
- explicit WaitTask(base::WaitableEvent* event)
- : event_(event) {}
- virtual ~WaitTask() {}
- virtual void Run() {
- event_->Signal();
- }
-
- private:
- base::WaitableEvent* event_;
- DISALLOW_COPY_AND_ASSIGN(WaitTask);
-};
+void WaitCallback(base::WaitableEvent* event) {
+ event->Signal();
+}
// Class we would be testing.
class TestAudioRendererImpl : public AudioRendererImpl {
@@ -134,7 +125,7 @@ class AudioRendererImplTest
// Posts a final task to the IO message loop and waits for completion.
void WaitForIOThreadCompletion() {
ChildProcess::current()->io_message_loop()->PostTask(
- FROM_HERE, new WaitTask(event_.get()));
+ FROM_HERE, base::Bind(&WaitCallback, base::Unretained(event_.get())));
EXPECT_TRUE(event_->TimedWait(
base::TimeDelta::FromMilliseconds(TestTimeouts::action_timeout_ms())));
}