diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-01 02:14:47 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-01 02:14:47 +0000 |
commit | 8f5a7e49df055f720d398e659d8f0fd1bb532ad0 (patch) | |
tree | 0cf8bfd736484a794b2d9c4127f53784ee5cdeea | |
parent | f182444916248f4d0612fada91b49ee672573d85 (diff) | |
download | chromium_src-8f5a7e49df055f720d398e659d8f0fd1bb532ad0.zip chromium_src-8f5a7e49df055f720d398e659d8f0fd1bb532ad0.tar.gz chromium_src-8f5a7e49df055f720d398e659d8f0fd1bb532ad0.tar.bz2 |
base::Bind: Remove NewRunnableFunction.
BUG=none
TEST=none
R=groby,ajwong
Review URL: http://codereview.chromium.org/8960011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116072 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | PRESUBMIT.py | 1 | ||||
-rw-r--r-- | base/callback.h | 4 | ||||
-rw-r--r-- | base/callback.h.pump | 4 | ||||
-rw-r--r-- | base/memory/weak_ptr_unittest.cc | 28 | ||||
-rw-r--r-- | base/message_loop_proxy_impl_unittest.cc | 7 | ||||
-rw-r--r-- | base/message_pump_glib_unittest.cc | 128 | ||||
-rw-r--r-- | base/task.h | 102 | ||||
-rw-r--r-- | content/browser/browser_main_loop.cc | 3 | ||||
-rw-r--r-- | tools/valgrind/common.py | 1 | ||||
-rw-r--r-- | webkit/appcache/appcache_storage_impl.cc | 4 |
10 files changed, 90 insertions, 192 deletions
diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 2ff37a8..3338ddd 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -189,7 +189,6 @@ def _CheckNoNewOldCallback(input_api, output_api): of the old callback system. """ return ('NewRunnableMethod' in line or - 'NewRunnableFunction' in line or 'NewCallback' in line or input_api.re.search(r'\bCallback\d<', line) or input_api.re.search(r'\bpublic Task\b', line) or diff --git a/base/callback.h b/base/callback.h index 318bff0..84abef9 100644 --- a/base/callback.h +++ b/base/callback.h @@ -19,8 +19,8 @@ // Closure should #include "base/callback_forward.h" instead of this file. // New, super-duper, unified Callback system. This will eventually replace -// NewRunnableMethod, NewRunnableFunction, CreateFunctor, and CreateCallback -// systems currently in the Chromium code base. +// NewRunnableMethod, CreateFunctor, and CreateCallback systems currently in the +// Chromium code base. // // WHAT IS THIS: // diff --git a/base/callback.h.pump b/base/callback.h.pump index d2285e9..cab7a38 100644 --- a/base/callback.h.pump +++ b/base/callback.h.pump @@ -24,8 +24,8 @@ $var MAX_ARITY = 7 // Closure should #include "base/callback_forward.h" instead of this file. // New, super-duper, unified Callback system. This will eventually replace -// NewRunnableMethod, NewRunnableFunction, CreateFunctor, and CreateCallback -// systems currently in the Chromium code base. +// NewRunnableMethod, CreateFunctor, and CreateCallback systems currently in the +// Chromium code base. // // WHAT IS THIS: // diff --git a/base/memory/weak_ptr_unittest.cc b/base/memory/weak_ptr_unittest.cc index f9f8b3e..4b73d17 100644 --- a/base/memory/weak_ptr_unittest.cc +++ b/base/memory/weak_ptr_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/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "testing/gtest/include/gtest/gtest.h" @@ -22,7 +23,7 @@ class OffThreadObjectCreator { creator_thread.Start(); creator_thread.message_loop()->PostTask( FROM_HERE, - NewRunnableFunction(OffThreadObjectCreator::CreateObject, &result)); + base::Bind(OffThreadObjectCreator::CreateObject, &result)); } DCHECK(result); // We synchronized on thread destruction above. return result; @@ -55,10 +56,8 @@ class BackgroundThread : public Thread { WaitableEvent completion(true, false); message_loop()->PostTask( FROM_HERE, - NewRunnableFunction(&BackgroundThread::DoCreateFromProducer, - consumer, - producer, - &completion)); + base::Bind(&BackgroundThread::DoCreateFromProducer, consumer, producer, + &completion)); completion.Wait(); } @@ -66,10 +65,8 @@ class BackgroundThread : public Thread { WaitableEvent completion(true, false); message_loop()->PostTask( FROM_HERE, - NewRunnableFunction(&BackgroundThread::DoCreateFromConsumer, - consumer, - other, - &completion)); + base::Bind(&BackgroundThread::DoCreateFromConsumer, consumer, other, + &completion)); completion.Wait(); } @@ -77,9 +74,7 @@ class BackgroundThread : public Thread { WaitableEvent completion(true, false); message_loop()->PostTask( FROM_HERE, - NewRunnableFunction(&BackgroundThread::DoDeleteProducer, - object, - &completion)); + base::Bind(&BackgroundThread::DoDeleteProducer, object, &completion)); completion.Wait(); } @@ -87,9 +82,7 @@ class BackgroundThread : public Thread { WaitableEvent completion(true, false); message_loop()->PostTask( FROM_HERE, - NewRunnableFunction(&BackgroundThread::DoDeleteConsumer, - object, - &completion)); + base::Bind(&BackgroundThread::DoDeleteConsumer, object, &completion)); completion.Wait(); } @@ -98,10 +91,7 @@ class BackgroundThread : public Thread { Producer* result = NULL; message_loop()->PostTask( FROM_HERE, - NewRunnableFunction(&BackgroundThread::DoDeRef, - consumer, - &result, - &completion)); + base::Bind(&BackgroundThread::DoDeRef, consumer, &result, &completion)); completion.Wait(); return result; } diff --git a/base/message_loop_proxy_impl_unittest.cc b/base/message_loop_proxy_impl_unittest.cc index a0d9953..2935911 100644 --- a/base/message_loop_proxy_impl_unittest.cc +++ b/base/message_loop_proxy_impl_unittest.cc @@ -93,13 +93,6 @@ class MessageLoopProxyImplTest : public testing::Test { mutable MessageLoop loop_; }; - -TEST_F(MessageLoopProxyImplTest, LegacyPostTask) { - EXPECT_TRUE(file_thread_->message_loop_proxy()->PostTask( - FROM_HERE, NewRunnableFunction(&BasicFunction, this))); - MessageLoop::current()->Run(); -} - TEST_F(MessageLoopProxyImplTest, Release) { EXPECT_TRUE(io_thread_->message_loop_proxy()->ReleaseSoon(FROM_HERE, this)); MessageLoop::current()->Run(); diff --git a/base/message_pump_glib_unittest.cc b/base/message_pump_glib_unittest.cc index 5d838a1..5286c66 100644 --- a/base/message_pump_glib_unittest.cc +++ b/base/message_pump_glib_unittest.cc @@ -9,6 +9,8 @@ #include <algorithm> #include <vector> +#include "base/bind.h" +#include "base/bind_helpers.h" #include "base/callback.h" #include "base/memory/ref_counted.h" #include "base/message_loop.h" @@ -58,25 +60,23 @@ class EventInjector { Event event = events_[0]; events_.erase(events_.begin()); ++processed_events_; - if (!event.callback.is_null()) { + if (!event.callback.is_null()) event.callback.Run(); - } else if (event.task) { - event.task->Run(); - delete event.task; - } + else if (!event.task.is_null()) + event.task.Run(); } // Adds an event to the queue. When "handled", executes |callback|. // delay_ms is relative to the last event if any, or to Now() otherwise. void AddEvent(int delay_ms, const base::Closure& callback) { - AddEventHelper(delay_ms, callback, NULL); + AddEventHelper(delay_ms, callback, base::Closure()); } void AddDummyEvent(int delay_ms) { - AddEventHelper(delay_ms, base::Closure(), NULL); + AddEventHelper(delay_ms, base::Closure(), base::Closure()); } - void AddEventAsTask(int delay_ms, Task* task) { + void AddEventAsTask(int delay_ms, const base::Closure& task) { AddEventHelper(delay_ms, base::Closure(), task); } @@ -91,22 +91,23 @@ class EventInjector { struct Event { base::Time time; base::Closure callback; - Task* task; + base::Closure task; }; struct Source : public GSource { EventInjector* injector; }; - void AddEventHelper(int delay_ms, const base::Closure& callback, Task* task) { + void AddEventHelper( + int delay_ms, const base::Closure& callback, const base::Closure& task) { base::Time last_time; - if (!events_.empty()) { + if (!events_.empty()) last_time = (events_.end()-1)->time; - } else { + else last_time = base::Time::NowFromSystemTime(); - } + base::Time future = last_time + base::TimeDelta::FromMilliseconds(delay_ms); - EventInjector::Event event = { future, callback, task }; + EventInjector::Event event = {future, callback, task}; events_.push_back(event); } @@ -155,7 +156,7 @@ void ExpectProcessedEvents(EventInjector* injector, int count) { // Posts a task on the current message loop. void PostMessageLoopTask(const tracked_objects::Location& from_here, - Task* task) { + const base::Closure& task) { MessageLoop::current()->PostTask(from_here, task); } @@ -213,22 +214,24 @@ TEST_F(MessagePumpGLibTest, TestEventTaskInterleave) { // If changes cause this test to fail, it is reasonable to change it, but // TestWorkWhileWaitingForEvents and TestEventsWhileWaitingForWork have to be // changed accordingly, otherwise they can become flaky. - injector()->AddEventAsTask(0, NewRunnableFunction(DoNothing)); - Task* check_task = NewRunnableFunction(ExpectProcessedEvents, injector(), 2); - Task* posted_task = NewRunnableFunction(PostMessageLoopTask, - FROM_HERE, check_task); + injector()->AddEventAsTask(0, base::Bind(&DoNothing)); + base::Closure check_task = + base::Bind(&ExpectProcessedEvents, base::Unretained(injector()), 2); + base::Closure posted_task = + base::Bind(&PostMessageLoopTask, FROM_HERE, check_task); injector()->AddEventAsTask(0, posted_task); - injector()->AddEventAsTask(0, NewRunnableFunction(DoNothing)); + injector()->AddEventAsTask(0, base::Bind(&DoNothing)); injector()->AddEvent(0, MessageLoop::QuitClosure()); loop()->Run(); EXPECT_EQ(4, injector()->processed_events()); injector()->Reset(); - injector()->AddEventAsTask(0, NewRunnableFunction(DoNothing)); - check_task = NewRunnableFunction(ExpectProcessedEvents, injector(), 2); - posted_task = NewRunnableFunction(PostMessageLoopTask, FROM_HERE, check_task); + injector()->AddEventAsTask(0, base::Bind(&DoNothing)); + check_task = + base::Bind(&ExpectProcessedEvents, base::Unretained(injector()), 2); + posted_task = base::Bind(&PostMessageLoopTask, FROM_HERE, check_task); injector()->AddEventAsTask(0, posted_task); - injector()->AddEventAsTask(10, NewRunnableFunction(DoNothing)); + injector()->AddEventAsTask(10, base::Bind(&DoNothing)); injector()->AddEvent(0, MessageLoop::QuitClosure()); loop()->Run(); EXPECT_EQ(4, injector()->processed_events()); @@ -239,13 +242,14 @@ TEST_F(MessagePumpGLibTest, TestWorkWhileWaitingForEvents) { // Tests that we process tasks while waiting for new events. // The event queue is empty at first. for (int i = 0; i < 10; ++i) { - loop()->PostTask(FROM_HERE, NewRunnableFunction(IncrementInt, &task_count)); + loop()->PostTask(FROM_HERE, base::Bind(&IncrementInt, &task_count)); } // After all the previous tasks have executed, enqueue an event that will // quit. loop()->PostTask( - FROM_HERE, NewRunnableMethod(injector(), &EventInjector::AddEvent, - 0, MessageLoop::QuitClosure())); + FROM_HERE, + base::Bind(&EventInjector::AddEvent, base::Unretained(injector()), 0, + MessageLoop::QuitClosure())); loop()->Run(); ASSERT_EQ(10, task_count); EXPECT_EQ(1, injector()->processed_events()); @@ -255,15 +259,16 @@ TEST_F(MessagePumpGLibTest, TestWorkWhileWaitingForEvents) { task_count = 0; for (int i = 0; i < 10; ++i) { loop()->PostDelayedTask( - FROM_HERE, NewRunnableFunction(IncrementInt, &task_count), 10*i); + FROM_HERE, base::Bind(&IncrementInt, &task_count), 10*i); } // After all the previous tasks have executed, enqueue an event that will // quit. // This relies on the fact that delayed tasks are executed in delay order. // That is verified in message_loop_unittest.cc. loop()->PostDelayedTask( - FROM_HERE, NewRunnableMethod(injector(), &EventInjector::AddEvent, - 10, MessageLoop::QuitClosure()), 150); + FROM_HERE, + base::Bind(&EventInjector::AddEvent, base::Unretained(injector()), 10, + MessageLoop::QuitClosure()), 150); loop()->Run(); ASSERT_EQ(10, task_count); EXPECT_EQ(1, injector()->processed_events()); @@ -278,9 +283,10 @@ TEST_F(MessagePumpGLibTest, TestEventsWhileWaitingForWork) { // After all the events have been processed, post a task that will check that // the events have been processed (note: the task executes after the event // that posted it has been handled, so we expect 11 at that point). - Task* check_task = NewRunnableFunction(ExpectProcessedEvents, injector(), 11); - Task* posted_task = NewRunnableFunction(PostMessageLoopTask, - FROM_HERE, check_task); + base::Closure check_task = + base::Bind(&ExpectProcessedEvents, base::Unretained(injector()), 11); + base::Closure posted_task = + base::Bind(&PostMessageLoopTask, FROM_HERE, check_task); injector()->AddEventAsTask(10, posted_task); // And then quit (relies on the condition tested by TestEventTaskInterleave). @@ -311,7 +317,7 @@ class ConcurrentHelper : public base::RefCounted<ConcurrentHelper> { MessageLoop::current()->Quit(); } else { MessageLoop::current()->PostTask( - FROM_HERE, NewRunnableMethod(this, &ConcurrentHelper::FromTask)); + FROM_HERE, base::Bind(&ConcurrentHelper::FromTask, this)); } } @@ -323,7 +329,7 @@ class ConcurrentHelper : public base::RefCounted<ConcurrentHelper> { MessageLoop::current()->Quit(); } else { injector_->AddEventAsTask( - 0, NewRunnableMethod(this, &ConcurrentHelper::FromEvent)); + 0, base::Bind(&ConcurrentHelper::FromEvent, this)); } } @@ -356,15 +362,15 @@ TEST_F(MessagePumpGLibTest, TestConcurrentEventPostedTask) { // Add 2 events to the queue to make sure it is always full (when we remove // the event before processing it). injector()->AddEventAsTask( - 0, NewRunnableMethod(helper.get(), &ConcurrentHelper::FromEvent)); + 0, base::Bind(&ConcurrentHelper::FromEvent, helper.get())); injector()->AddEventAsTask( - 0, NewRunnableMethod(helper.get(), &ConcurrentHelper::FromEvent)); + 0, base::Bind(&ConcurrentHelper::FromEvent, helper.get())); // Similarly post 2 tasks. loop()->PostTask( - FROM_HERE, NewRunnableMethod(helper.get(), &ConcurrentHelper::FromTask)); + FROM_HERE, base::Bind(&ConcurrentHelper::FromTask, helper.get())); loop()->PostTask( - FROM_HERE, NewRunnableMethod(helper.get(), &ConcurrentHelper::FromTask)); + FROM_HERE, base::Bind(&ConcurrentHelper::FromTask, helper.get())); loop()->Run(); EXPECT_EQ(0, helper->event_count()); @@ -381,8 +387,8 @@ void AddEventsAndDrainGLib(EventInjector* injector) { injector->AddEvent(0, MessageLoop::QuitClosure()); // Post a couple of dummy tasks - MessageLoop::current()->PostTask(FROM_HERE, NewRunnableFunction(DoNothing)); - MessageLoop::current()->PostTask(FROM_HERE, NewRunnableFunction(DoNothing)); + MessageLoop::current()->PostTask(FROM_HERE, base::Bind(&DoNothing)); + MessageLoop::current()->PostTask(FROM_HERE, base::Bind(&DoNothing)); // Drain the events while (g_main_context_pending(NULL)) { @@ -395,7 +401,8 @@ void AddEventsAndDrainGLib(EventInjector* injector) { TEST_F(MessagePumpGLibTest, TestDrainingGLib) { // Tests that draining events using GLib works. loop()->PostTask( - FROM_HERE, NewRunnableFunction(AddEventsAndDrainGLib, injector())); + FROM_HERE, + base::Bind(&AddEventsAndDrainGLib, base::Unretained(injector()))); loop()->Run(); EXPECT_EQ(3, injector()->processed_events()); @@ -413,8 +420,8 @@ void AddEventsAndDrainGtk(EventInjector* injector) { injector->AddEvent(0, MessageLoop::QuitClosure()); // Post a couple of dummy tasks - MessageLoop::current()->PostTask(FROM_HERE, NewRunnableFunction(DoNothing)); - MessageLoop::current()->PostTask(FROM_HERE, NewRunnableFunction(DoNothing)); + MessageLoop::current()->PostTask(FROM_HERE, base::Bind(&DoNothing)); + MessageLoop::current()->PostTask(FROM_HERE, base::Bind(&DoNothing)); // Drain the events while (gtk_events_pending()) { @@ -429,7 +436,8 @@ void AddEventsAndDrainGtk(EventInjector* injector) { TEST_F(MessagePumpGLibTest, TestDrainingGtk) { // Tests that draining events using Gtk works. loop()->PostTask( - FROM_HERE, NewRunnableFunction(AddEventsAndDrainGtk, injector())); + FROM_HERE, + base::Bind(&AddEventsAndDrainGtk, base::Unretained(injector()))); loop()->Run(); EXPECT_EQ(3, injector()->processed_events()); @@ -488,17 +496,17 @@ void TestGLibLoopInternal(EventInjector* injector) { injector->AddDummyEvent(0); // Post a couple of dummy tasks MessageLoop::current()->PostTask( - FROM_HERE, NewRunnableFunction(IncrementInt, &task_count)); + FROM_HERE, base::Bind(&IncrementInt, &task_count)); MessageLoop::current()->PostTask( - FROM_HERE, NewRunnableFunction(IncrementInt, &task_count)); + FROM_HERE, base::Bind(&IncrementInt, &task_count)); // Delayed events injector->AddDummyEvent(10); injector->AddDummyEvent(10); // Delayed work MessageLoop::current()->PostDelayedTask( - FROM_HERE, NewRunnableFunction(IncrementInt, &task_count), 30); + FROM_HERE, base::Bind(&IncrementInt, &task_count), 30); MessageLoop::current()->PostDelayedTask( - FROM_HERE, NewRunnableMethod(runner.get(), &GLibLoopRunner::Quit), 40); + FROM_HERE, base::Bind(&GLibLoopRunner::Quit, runner.get()), 40); // Run a nested, straight GLib message loop. runner->RunGLib(); @@ -519,17 +527,17 @@ void TestGtkLoopInternal(EventInjector* injector) { injector->AddDummyEvent(0); // Post a couple of dummy tasks MessageLoop::current()->PostTask( - FROM_HERE, NewRunnableFunction(IncrementInt, &task_count)); + FROM_HERE, base::Bind(&IncrementInt, &task_count)); MessageLoop::current()->PostTask( - FROM_HERE, NewRunnableFunction(IncrementInt, &task_count)); + FROM_HERE, base::Bind(&IncrementInt, &task_count)); // Delayed events injector->AddDummyEvent(10); injector->AddDummyEvent(10); // Delayed work MessageLoop::current()->PostDelayedTask( - FROM_HERE, NewRunnableFunction(IncrementInt, &task_count), 30); + FROM_HERE, base::Bind(&IncrementInt, &task_count), 30); MessageLoop::current()->PostDelayedTask( - FROM_HERE, NewRunnableMethod(runner.get(), &GLibLoopRunner::Quit), 40); + FROM_HERE, base::Bind(&GLibLoopRunner::Quit, runner.get()), 40); // Run a nested, straight Gtk message loop. runner->RunLoop(); @@ -542,21 +550,23 @@ void TestGtkLoopInternal(EventInjector* injector) { } // namespace TEST_F(MessagePumpGLibTest, TestGLibLoop) { - // Tests that events and posted tasks are correctly exectuted if the message + // Tests that events and posted tasks are correctly executed if the message // loop is not run by MessageLoop::Run() but by a straight GLib loop. // Note that in this case we don't make strong guarantees about niceness // between events and posted tasks. - loop()->PostTask(FROM_HERE, - NewRunnableFunction(TestGLibLoopInternal, injector())); + loop()->PostTask( + FROM_HERE, + base::Bind(&TestGLibLoopInternal, base::Unretained(injector()))); loop()->Run(); } TEST_F(MessagePumpGLibTest, TestGtkLoop) { - // Tests that events and posted tasks are correctly exectuted if the message + // Tests that events and posted tasks are correctly executed if the message // loop is not run by MessageLoop::Run() but by a straight Gtk loop. // Note that in this case we don't make strong guarantees about niceness // between events and posted tasks. - loop()->PostTask(FROM_HERE, - NewRunnableFunction(TestGtkLoopInternal, injector())); + loop()->PostTask( + FROM_HERE, + base::Bind(&TestGtkLoopInternal, base::Unretained(injector()))); loop()->Run(); } diff --git a/base/task.h b/base/task.h index b546af5..84dab97 100644 --- a/base/task.h +++ b/base/task.h @@ -304,12 +304,12 @@ struct RunnableMethodTraits { void ReleaseCallee(TypeName* manager) {} \ } -// RunnableMethod and RunnableFunction ----------------------------------------- +// RunnableMethod -------------------------------------------------------------- // // Runnable methods are a type of task that call a function on an object when -// they are run. We implement both an object and a set of NewRunnableMethod and -// NewRunnableFunction functions for convenience. These functions are -// overloaded and will infer the template types, simplifying calling code. +// they are run. We implement both an object and a set of NewRunnableMethod +// functions for convenience. These functions are overloaded and will infer the +// template types, simplifying calling code. // // The template definitions all use the following names: // T - the class type of the object you're supplying @@ -326,7 +326,6 @@ struct RunnableMethodTraits { // // Usage: // PostTask(FROM_HERE, NewRunnableMethod(object, &Object::method[, a[, b]]) -// PostTask(FROM_HERE, NewRunnableFunction(&function[, a[, b]]) // RunnableMethod and NewRunnableMethod implementation ------------------------- @@ -458,99 +457,6 @@ inline CancelableTask* NewRunnableMethod(T* object, Method method, g, h)); } -// RunnableFunction and NewRunnableFunction implementation --------------------- - -template <class Function, class Params> -class RunnableFunction : public Task { - public: - RunnableFunction(Function function, const Params& params) - : function_(function), params_(params) { - COMPILE_ASSERT( - (base::internal::ParamsUseScopedRefptrCorrectly<Params>::value), - badrunnablefunctionparams); - } - - ~RunnableFunction() { - function_ = reinterpret_cast<Function>(base::kDeadTask); - } - - virtual void Run() { - if (function_) - DispatchToFunction(function_, params_); - } - - private: - Function function_; - Params params_; -}; - -template <class Function> -inline Task* NewRunnableFunction(Function function) { - return new RunnableFunction<Function, Tuple0>(function, MakeTuple()); -} - -template <class Function, class A> -inline Task* NewRunnableFunction(Function function, const A& a) { - return new RunnableFunction<Function, Tuple1<A> >(function, MakeTuple(a)); -} - -template <class Function, class A, class B> -inline Task* NewRunnableFunction(Function function, const A& a, const B& b) { - return new RunnableFunction<Function, Tuple2<A, B> >(function, - MakeTuple(a, b)); -} - -template <class Function, class A, class B, class C> -inline Task* NewRunnableFunction(Function function, const A& a, const B& b, - const C& c) { - return new RunnableFunction<Function, Tuple3<A, B, C> >(function, - MakeTuple(a, b, c)); -} - -template <class Function, class A, class B, class C, class D> -inline Task* NewRunnableFunction(Function function, const A& a, const B& b, - const C& c, const D& d) { - return new RunnableFunction<Function, Tuple4<A, B, C, D> >(function, - MakeTuple(a, b, - c, d)); -} - -template <class Function, class A, class B, class C, class D, class E> -inline Task* NewRunnableFunction(Function function, const A& a, const B& b, - const C& c, const D& d, const E& e) { - return new RunnableFunction<Function, Tuple5<A, B, C, D, E> >(function, - MakeTuple(a, b, - c, d, - e)); -} - -template <class Function, class A, class B, class C, class D, class E, - class F> -inline Task* NewRunnableFunction(Function function, const A& a, const B& b, - const C& c, const D& d, const E& e, - const F& f) { - return new RunnableFunction<Function, Tuple6<A, B, C, D, E, F> >(function, - MakeTuple(a, b, c, d, e, f)); -} - -template <class Function, class A, class B, class C, class D, class E, - class F, class G> -inline Task* NewRunnableFunction(Function function, const A& a, const B& b, - const C& c, const D& d, const E& e, const F& f, - const G& g) { - return new RunnableFunction<Function, Tuple7<A, B, C, D, E, F, G> >(function, - MakeTuple(a, b, c, d, e, f, g)); -} - -template <class Function, class A, class B, class C, class D, class E, - class F, class G, class H> -inline Task* NewRunnableFunction(Function function, const A& a, const B& b, - const C& c, const D& d, const E& e, const F& f, - const G& g, const H& h) { - return new RunnableFunction<Function, Tuple8<A, B, C, D, E, F, G, H> >( - function, MakeTuple(a, b, c, d, e, f, g, h)); -} - namespace base { // ScopedTaskRunner is akin to scoped_ptr for Tasks. It ensures that the Task diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc index e040597..9e12ef5 100644 --- a/content/browser/browser_main_loop.cc +++ b/content/browser/browser_main_loop.cc @@ -408,8 +408,7 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() { // need to be able to perform IO. base::ThreadRestrictions::SetIOAllowed(true); BrowserThread::PostTask( - BrowserThread::IO, - FROM_HERE, + BrowserThread::IO, FROM_HERE, base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), true)); diff --git a/tools/valgrind/common.py b/tools/valgrind/common.py index 6365fec..05c8999 100644 --- a/tools/valgrind/common.py +++ b/tools/valgrind/common.py @@ -169,7 +169,6 @@ def BoringCallers(mangled, use_re_wildcards): ("MessageLoop::Run", "_ZN11MessageLoop3RunEv"), ("MessageLoop::RunTask", "_ZN11MessageLoop7RunTask*"), ("RunnableMethod*", "_ZN14RunnableMethod*"), - ("RunnableFunction*", "_ZN16RunnableFunction*"), ("DispatchToMethod*", "_Z*16DispatchToMethod*"), ("base::internal::Invoker*::DoInvoke*", "_ZN4base8internal8Invoker*DoInvoke*"), # Invoker{1,2,3} diff --git a/webkit/appcache/appcache_storage_impl.cc b/webkit/appcache/appcache_storage_impl.cc index e2a0b26..617bc27 100644 --- a/webkit/appcache/appcache_storage_impl.cc +++ b/webkit/appcache/appcache_storage_impl.cc @@ -44,7 +44,9 @@ static const FilePath::CharType kDiskCacheDirectoryName[] = namespace { -// Helper with no return value for use with NewRunnableFunction. +// Helper with no return value for use with base::Bind. +// TODO(jhawkins): Figure out why base::IgnoreResult does not work for +// file_util::Delete on Windows. void DeleteDirectory(const FilePath& path) { file_util::Delete(path, true); } |