diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-12 17:10:58 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-12 17:10:58 +0000 |
commit | 8075105cb6bc684ebfe613edd6a9a27384c80d7e (patch) | |
tree | 86386ce875a2fd3e08db4fd4cd9f6e9b09c096cb /chrome_frame | |
parent | 82f4b8292a2bf50213b9ae86399303f907e930e0 (diff) | |
download | chromium_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 'chrome_frame')
6 files changed, 32 insertions, 21 deletions
diff --git a/chrome_frame/crash_reporting/nt_loader_unittest.cc b/chrome_frame/crash_reporting/nt_loader_unittest.cc index 4f75d74..3bc27bf 100644 --- a/chrome_frame/crash_reporting/nt_loader_unittest.cc +++ b/chrome_frame/crash_reporting/nt_loader_unittest.cc @@ -8,6 +8,8 @@ #include <winnt.h> #include "base/at_exit.h" +#include "base/bind.h" +#include "base/bind_helpers.h" #include "base/environment.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" @@ -81,11 +83,11 @@ TEST(NtLoader, OwnsCriticalSection) { base::Thread other("Other threads"); ASSERT_TRUE(other.Start()); other.message_loop()->PostTask( - FROM_HERE, NewRunnableFunction(::EnterCriticalSection, &cs)); + FROM_HERE, base::Bind(::EnterCriticalSection, &cs)); base::win::ScopedHandle event(::CreateEvent(NULL, FALSE, FALSE, NULL)); other.message_loop()->PostTask( - FROM_HERE, NewRunnableFunction(::SetEvent, event.Get())); + FROM_HERE, base::IgnoreReturn<BOOL>(base::Bind(::SetEvent, event.Get()))); ASSERT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(event.Get(), INFINITE)); @@ -96,7 +98,7 @@ TEST(NtLoader, OwnsCriticalSection) { // Make the other thread release it. other.message_loop()->PostTask( - FROM_HERE, NewRunnableFunction(::LeaveCriticalSection, &cs)); + FROM_HERE, base::Bind(::LeaveCriticalSection, &cs)); other.Stop(); diff --git a/chrome_frame/test/net/fake_external_tab.cc b/chrome_frame/test/net/fake_external_tab.cc index c33b54c..b597289 100644 --- a/chrome_frame/test/net/fake_external_tab.cc +++ b/chrome_frame/test/net/fake_external_tab.cc @@ -8,6 +8,7 @@ #include <atlcom.h> #include <exdisp.h> +#include "base/bind.h" #include "base/command_line.h" #include "base/debug/debugger.h" #include "base/file_util.h" @@ -416,7 +417,7 @@ DWORD CFUrlRequestUnittestRunner::RunAllUnittests(void* param) { reinterpret_cast<CFUrlRequestUnittestRunner*>(param); me->test_result_ = me->Run(); me->fake_chrome_.ui_loop()->PostTask(FROM_HERE, - NewRunnableFunction(TakeDownBrowser, me)); + base::Bind(TakeDownBrowser, me)); return 0; } diff --git a/chrome_frame/test/net/test_automation_resource_message_filter.cc b/chrome_frame/test/net/test_automation_resource_message_filter.cc index f7f00bc..655950c 100644 --- a/chrome_frame/test/net/test_automation_resource_message_filter.cc +++ b/chrome_frame/test/net/test_automation_resource_message_filter.cc @@ -1,9 +1,11 @@ -// 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 "chrome_frame/test/net/test_automation_resource_message_filter.h" +#include "base/bind.h" + TestAutomationResourceMessageFilter::TestAutomationResourceMessageFilter( AutomationProvider* automation) : automation_(automation) { } @@ -32,8 +34,8 @@ bool TestAutomationResourceMessageFilter::OnMessageReceived( handled = true; IPC::Message* msg = new IPC::Message(message); RequestJob& job = it->second; - job.loop_->PostTask(FROM_HERE, NewRunnableFunction(OnRequestMessage, - job.job_, msg)); + job.loop_->PostTask(FROM_HERE, + base::Bind(OnRequestMessage, job.job_, msg)); } } else { handled = AutomationResourceMessageFilter::OnMessageReceived(message); diff --git a/chrome_frame/test/test_server_test.cc b/chrome_frame/test/test_server_test.cc index e358e99..4175d22 100644 --- a/chrome_frame/test/test_server_test.cc +++ b/chrome_frame/test/test_server_test.cc @@ -6,6 +6,7 @@ #include <wininet.h> #include "base/basictypes.h" +#include "base/bind.h" #include "base/path_service.h" #include "base/win/scoped_handle.h" #include "chrome_frame/test/test_server.h" @@ -145,8 +146,7 @@ TEST_F(TestServerTest, TestServer) { // We should never hit this, but it's our way to break out of the test if // things start hanging. QuitMessageHit quit_msg(&loop); - loop.PostDelayedTask(FROM_HERE, - NewRunnableFunction(QuitMessageLoop, &quit_msg), + loop.PostDelayedTask(FROM_HERE, base::Bind(QuitMessageLoop, &quit_msg), 10 * 1000); UrlTaskChain quit_task("http://localhost:1337/quit", NULL); diff --git a/chrome_frame/test/urlmon_moniker_integration_test.cc b/chrome_frame/test/urlmon_moniker_integration_test.cc index 0812b53..7c656a8 100644 --- a/chrome_frame/test/urlmon_moniker_integration_test.cc +++ b/chrome_frame/test/urlmon_moniker_integration_test.cc @@ -5,6 +5,7 @@ #include <atlbase.h> #include <atlcom.h> +#include "base/bind.h" #include "base/threading/thread.h" #include "base/win/scoped_comptr.h" #include "base/win/scoped_handle.h" @@ -67,7 +68,7 @@ class RunTestServer : public base::Thread { bool ret = StartWithOptions(Options(MessageLoop::TYPE_UI, 0)); if (ret) { message_loop()->PostTask(FROM_HERE, - NewRunnableFunction(&RunTestServer::StartServer, this)); + base::Bind(&RunTestServer::StartServer, this)); wait_until_ready(); } return ret; diff --git a/chrome_frame/vtable_patch_manager_unittest.cc b/chrome_frame/vtable_patch_manager_unittest.cc index 82b3772..2176a05 100644 --- a/chrome_frame/vtable_patch_manager_unittest.cc +++ b/chrome_frame/vtable_patch_manager_unittest.cc @@ -6,6 +6,8 @@ #include <unknwn.h> +#include "base/bind.h" +#include "base/bind_helpers.h" #include "base/message_loop.h" #include "base/threading/thread.h" #include "base/win/scoped_handle.h" @@ -217,15 +219,16 @@ TEST_F(VtablePatchManagerTest, ThreadSafePatching) { vtable_patch::patch_lock_.Acquire(); // Instruct the background thread to patch factory_. - background.message_loop()->PostTask(FROM_HERE, - NewRunnableFunction(&vtable_patch::PatchInterfaceMethods, - &factory_, - &IClassFactory_PatchInfo[0])); + background.message_loop()->PostTask( + FROM_HERE, + base::IgnoreReturn<HRESULT>( + base::Bind(&vtable_patch::PatchInterfaceMethods, &factory_, + &IClassFactory_PatchInfo[0]))); // And subsequently to signal the event. Neither of these actions should // occur until we've released the patch lock. - background.message_loop()->PostTask(FROM_HERE, - NewRunnableFunction(::SetEvent, event.Get())); + background.message_loop()->PostTask( + FROM_HERE, base::IgnoreReturn<BOOL>(base::Bind(::SetEvent, event.Get()))); // Wait for a little while, to give the background thread time to process. // We expect this wait to time out, as the background thread should end up @@ -258,14 +261,16 @@ TEST_F(VtablePatchManagerTest, ThreadSafePatching) { vtable_patch::patch_lock_.Acquire(); // Instruct the background thread to unpatch. - background.message_loop()->PostTask(FROM_HERE, - NewRunnableFunction(&vtable_patch::UnpatchInterfaceMethods, - &IClassFactory_PatchInfo[0])); + background.message_loop()->PostTask( + FROM_HERE, + base::IgnoreReturn<HRESULT>( + base::Bind(&vtable_patch::UnpatchInterfaceMethods, + &IClassFactory_PatchInfo[0]))); // And subsequently to signal the event. Neither of these actions should // occur until we've released the patch lock. - background.message_loop()->PostTask(FROM_HERE, - NewRunnableFunction(::SetEvent, event.Get())); + background.message_loop()->PostTask( + FROM_HERE, base::IgnoreReturn<BOOL>(base::Bind(::SetEvent, event.Get()))); // Wait for a little while, to give the background thread time to process. // We expect this wait to time out, as the background thread should end up |