summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-12 17:10:58 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-12 17:10:58 +0000
commit8075105cb6bc684ebfe613edd6a9a27384c80d7e (patch)
tree86386ce875a2fd3e08db4fd4cd9f6e9b09c096cb /content
parent82f4b8292a2bf50213b9ae86399303f907e930e0 (diff)
downloadchromium_src-8075105cb6bc684ebfe613edd6a9a27384c80d7e.zip
chromium_src-8075105cb6bc684ebfe613edd6a9a27384c80d7e.tar.gz
chromium_src-8075105cb6bc684ebfe613edd6a9a27384c80d7e.tar.bz2
base::Bind: Low-hanging fruit conversions of NewRunnableFunction.
BUG=none TEST=none R=csilv@chromium.org Review URL: http://codereview.chromium.org/8536037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109803 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/browser_thread_unittest.cc7
-rw-r--r--content/browser/file_system/file_system_browsertest.cc7
-rw-r--r--content/browser/plugin_process_host.cc16
-rw-r--r--content/browser/plugin_process_host_mac.cc28
-rw-r--r--content/browser/plugin_service_browsertest.cc5
-rw-r--r--content/browser/user_metrics.cc6
-rw-r--r--content/gpu/gpu_child_thread.cc7
-rw-r--r--content/renderer/devtools_agent_filter.cc6
-rw-r--r--content/shell/shell_browser_main.cc5
9 files changed, 40 insertions, 47 deletions
diff --git a/content/browser/browser_thread_unittest.cc b/content/browser/browser_thread_unittest.cc
index 11ccecc..fee3fa1 100644
--- a/content/browser/browser_thread_unittest.cc
+++ b/content/browser/browser_thread_unittest.cc
@@ -92,7 +92,7 @@ class BrowserThreadTest : public testing::Test {
TEST_F(BrowserThreadTest, PostTask) {
BrowserThread::PostTask(
BrowserThread::FILE, FROM_HERE,
- NewRunnableFunction(&BasicFunction, MessageLoop::current()));
+ base::Bind(&BasicFunction, MessageLoop::current()));
MessageLoop::current()->Run();
}
@@ -124,9 +124,8 @@ TEST_F(BrowserThreadTest, NotReleasedIfTargetThreadNonExistent) {
TEST_F(BrowserThreadTest, PostTaskViaMessageLoopProxy) {
scoped_refptr<base::MessageLoopProxy> message_loop_proxy =
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE);
- message_loop_proxy->PostTask(FROM_HERE,
- NewRunnableFunction(&BasicFunction,
- MessageLoop::current()));
+ message_loop_proxy->PostTask(
+ FROM_HERE, base::Bind(&BasicFunction, MessageLoop::current()));
MessageLoop::current()->Run();
}
diff --git a/content/browser/file_system/file_system_browsertest.cc b/content/browser/file_system/file_system_browsertest.cc
index 1b4a0fd..a755a59 100644
--- a/content/browser/file_system/file_system_browsertest.cc
+++ b/content/browser/file_system/file_system_browsertest.cc
@@ -63,9 +63,10 @@ class FileSystemBrowserTestWithLowQuota : public FileSystemBrowserTest {
static void SetTempQuota(int64 bytes, scoped_refptr<QuotaManager> qm) {
if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
- BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
- NewRunnableFunction(&FileSystemBrowserTestWithLowQuota::SetTempQuota,
- bytes, qm));
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(&FileSystemBrowserTestWithLowQuota::SetTempQuota, bytes,
+ qm));
return;
}
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
diff --git a/content/browser/plugin_process_host.cc b/content/browser/plugin_process_host.cc
index b21a5da..f155279 100644
--- a/content/browser/plugin_process_host.cc
+++ b/content/browser/plugin_process_host.cc
@@ -13,6 +13,7 @@
#include <vector>
#include "base/base_switches.h"
+#include "base/bind.h"
#include "base/command_line.h"
#include "base/file_path.h"
#include "base/file_util.h"
@@ -95,7 +96,7 @@ void PluginProcessHost::OnReparentPluginWindow(HWND window, HWND parent) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
- NewRunnableFunction(ReparentPluginWindowHelper, window, parent));
+ base::Bind(ReparentPluginWindowHelper, window, parent));
}
#endif // defined(OS_WIN)
@@ -141,10 +142,9 @@ PluginProcessHost::~PluginProcessHost() {
if (BrowserThread::CurrentlyOn(BrowserThread::UI)) {
base::mac::ReleaseFullScreen(base::mac::kFullScreenModeHideAll);
} else {
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- NewRunnableFunction(base::mac::ReleaseFullScreen,
- base::mac::kFullScreenModeHideAll));
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
+ base::Bind(base::mac::ReleaseFullScreen,
+ base::mac::kFullScreenModeHideAll));
}
}
// If the plugin hid the cursor, reset that.
@@ -152,10 +152,8 @@ PluginProcessHost::~PluginProcessHost() {
if (BrowserThread::CurrentlyOn(BrowserThread::UI)) {
base::mac::SetCursorVisibility(true);
} else {
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- NewRunnableFunction(base::mac::SetCursorVisibility,
- true));
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
+ base::Bind(base::mac::SetCursorVisibility, true));
}
}
#endif
diff --git a/content/browser/plugin_process_host_mac.cc b/content/browser/plugin_process_host_mac.cc
index 95b9a84..99e3e27 100644
--- a/content/browser/plugin_process_host_mac.cc
+++ b/content/browser/plugin_process_host_mac.cc
@@ -8,6 +8,7 @@
#include <vector>
+#include "base/bind.h"
#include "base/logging.h"
#include "base/mac/mac_util.h"
#include "content/browser/plugin_process_host.h"
@@ -44,10 +45,9 @@ void PluginProcessHost::OnPluginShowWindow(uint32 window_id,
// the main display, hide the menubar so that it has the whole screen.
// (but only if we haven't already seen this fullscreen window, since
// otherwise our refcounting can get skewed).
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- NewRunnableFunction(base::mac::RequestFullScreen,
- base::mac::kFullScreenModeHideAll));
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
+ base::Bind(base::mac::RequestFullScreen,
+ base::mac::kFullScreenModeHideAll));
}
}
@@ -77,16 +77,14 @@ void PluginProcessHost::OnPluginHideWindow(uint32 window_id,
plugin_fullscreen_windows_set_.erase(window_id);
pid_t plugin_pid = browser_needs_activation ? -1 : handle();
browser_needs_activation = false;
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- NewRunnableFunction(ReleasePluginFullScreen, plugin_pid));
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
+ base::Bind(ReleasePluginFullScreen, plugin_pid));
}
if (browser_needs_activation) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
- NewRunnableFunction(base::mac::ActivateProcess,
- base::GetCurrentProcId()));
+ base::Bind(base::mac::ActivateProcess, base::GetCurrentProcId()));
}
}
@@ -96,18 +94,16 @@ void PluginProcessHost::OnAppActivation() {
// If our plugin process has any modal windows up, we need to bring it forward
// so that they act more like an in-process modal window would.
if (!plugin_modal_windows_set_.empty()) {
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- NewRunnableFunction(base::mac::ActivateProcess, handle()));
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
+ base::Bind(base::mac::ActivateProcess, handle()));
}
}
void PluginProcessHost::OnPluginSetCursorVisibility(bool visible) {
if (plugin_cursor_visible_ != visible) {
plugin_cursor_visible_ = visible;
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- NewRunnableFunction(base::mac::SetCursorVisibility,
- visible));
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
+ base::Bind(base::mac::SetCursorVisibility,
+ visible));
}
}
diff --git a/content/browser/plugin_service_browsertest.cc b/content/browser/plugin_service_browsertest.cc
index 116a6e1..c8f8e1e 100644
--- a/content/browser/plugin_service_browsertest.cc
+++ b/content/browser/plugin_service_browsertest.cc
@@ -168,9 +168,8 @@ void OpenChannelAndThenCancel(PluginProcessHost::Client* client) {
IN_PROC_BROWSER_TEST_F(PluginServiceTest, CancelOpenChannelToPluginService) {
::testing::StrictMock<MockCanceledPluginServiceClient> mock_client(
browser()->profile()->GetResourceContext());
- BrowserThread::PostTask(
- BrowserThread::IO, FROM_HERE,
- NewRunnableFunction(OpenChannelAndThenCancel, &mock_client));
+ BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
+ base::Bind(OpenChannelAndThenCancel, &mock_client));
ui_test_utils::RunMessageLoop();
EXPECT_TRUE(mock_client.get_resource_context_called());
}
diff --git a/content/browser/user_metrics.cc b/content/browser/user_metrics.cc
index 6f0a35f..b359654 100644
--- a/content/browser/user_metrics.cc
+++ b/content/browser/user_metrics.cc
@@ -4,6 +4,7 @@
#include "content/browser/user_metrics.h"
+#include "base/bind.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
@@ -20,9 +21,8 @@ void UserMetrics::RecordComputedAction(const std::string& action) {
void UserMetrics::Record(const char *action) {
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- NewRunnableFunction(&UserMetrics::CallRecordOnUI, action));
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
+ base::Bind(&UserMetrics::CallRecordOnUI, action));
return;
}
diff --git a/content/gpu/gpu_child_thread.cc b/content/gpu/gpu_child_thread.cc
index 0004357..02c38af 100644
--- a/content/gpu/gpu_child_thread.cc
+++ b/content/gpu/gpu_child_thread.cc
@@ -7,6 +7,7 @@
#include <string>
#include <vector>
+#include "base/bind.h"
#include "base/command_line.h"
#include "base/threading/worker_pool.h"
#include "base/win/scoped_com_initializer.h"
@@ -175,8 +176,7 @@ void GpuChildThread::OnCollectGraphicsInfo() {
// Asynchronously collect the DirectX diagnostics because this can take a
// couple of seconds.
if (!base::WorkerPool::PostTask(
- FROM_HERE,
- NewRunnableFunction(&GpuChildThread::CollectDxDiagnostics, this),
+ FROM_HERE, base::Bind(&GpuChildThread::CollectDxDiagnostics, this),
true)) {
// Flag GPU info as complete if the DirectX diagnostics cannot be
// collected.
@@ -223,8 +223,7 @@ void GpuChildThread::CollectDxDiagnostics(GpuChildThread* thread) {
gpu_info_collector::GetDxDiagnostics(&node);
thread->message_loop()->PostTask(
- FROM_HERE,
- NewRunnableFunction(&GpuChildThread::SetDxDiagnostics, thread, node));
+ FROM_HERE, base::Bind(&GpuChildThread::SetDxDiagnostics, thread, node));
}
// Runs on the main thread.
diff --git a/content/renderer/devtools_agent_filter.cc b/content/renderer/devtools_agent_filter.cc
index 281ddf2..04d4b2a 100644
--- a/content/renderer/devtools_agent_filter.cc
+++ b/content/renderer/devtools_agent_filter.cc
@@ -1,9 +1,10 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/renderer/devtools_agent_filter.h"
+#include "base/bind.h"
#include "base/message_loop.h"
#include "content/common/devtools_messages.h"
#include "content/renderer/devtools_agent.h"
@@ -93,6 +94,5 @@ void DevToolsAgentFilter::OnDispatchOnInspectorBackend(
new MessageImpl(message, current_routing_id_));
render_thread_loop_->PostTask(
- FROM_HERE,
- NewRunnableFunction(&WebDevToolsAgent::processPendingMessages));
+ FROM_HERE, base::Bind(&WebDevToolsAgent::processPendingMessages));
}
diff --git a/content/shell/shell_browser_main.cc b/content/shell/shell_browser_main.cc
index a336404..3874d80 100644
--- a/content/shell/shell_browser_main.cc
+++ b/content/shell/shell_browser_main.cc
@@ -4,6 +4,7 @@
#include "content/shell/shell_browser_main.h"
+#include "base/bind.h"
#include "base/message_loop.h"
#include "base/threading/thread.h"
#include "base/threading/thread_restrictions.h"
@@ -31,8 +32,8 @@ ShellBrowserMainParts::ShellBrowserMainParts(
ShellBrowserMainParts::~ShellBrowserMainParts() {
base::ThreadRestrictions::SetIOAllowed(true);
io_thread()->message_loop()->PostTask(
- FROM_HERE,
- NewRunnableFunction(&base::ThreadRestrictions::SetIOAllowed, true));
+ FROM_HERE, base::IgnoreReturn<bool>(
+ base::Bind(&base::ThreadRestrictions::SetIOAllowed, true)));
browser_context_.reset();