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

Unified Diff: base/message_loop/message_loop.h

Issue 2354053002: Delete MessageLoop::PostTask/PostDelayedTask/DeleteSoon/ReleaseSoon. (Closed)
Patch Set: Created 4 years, 3 months 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 | « no previous file | base/message_loop/message_loop.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop/message_loop.h
diff --git a/base/message_loop/message_loop.h b/base/message_loop/message_loop.h
index 1957b99d74648fc9f8abb1658e3ef59c25357838..56565fa37afe32331f213159a6859fbc8a4ce090 100644
--- a/base/message_loop/message_loop.h
+++ b/base/message_loop/message_loop.h
@@ -13,7 +13,6 @@
#include "base/callback_forward.h"
#include "base/debug/task_annotator.h"
#include "base/gtest_prod_util.h"
-#include "base/location.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/message_loop/incoming_task_queue.h"
@@ -22,10 +21,8 @@
#include "base/message_loop/timer_slack.h"
#include "base/observer_list.h"
#include "base/pending_task.h"
-#include "base/sequenced_task_runner_helpers.h"
#include "base/synchronization/lock.h"
#include "base/time/time.h"
-#include "base/tracking_info.h"
#include "build/build_config.h"
// TODO(sky): these includes should not be necessary. Nuke them.
@@ -57,8 +54,8 @@ class WaitableEvent;
// A MessageLoop is used to process events for a particular thread. There is
// at most one MessageLoop instance per thread.
//
-// Events include at a minimum Task instances submitted to PostTask and its
-// variants. Depending on the type of message pump used by the MessageLoop
+// Events include at a minimum Task instances submitted to the MessageLoop's
+// TaskRunner. Depending on the type of message pump used by the MessageLoop
// other events such as UI messages may be processed. On Windows APC calls (as
// time permits) and signals sent to a registered set of HANDLEs may also be
// processed.
@@ -181,79 +178,6 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate {
void AddNestingObserver(NestingObserver* observer);
void RemoveNestingObserver(NestingObserver* observer);
-#if !(defined(OS_MACOSX) && !defined(OS_IOS))
- // NOTE: Deprecated; prefer task_runner() and the TaskRunner interfaces.
- // TODO(skyostil): Remove these functions (crbug.com/465354).
- //
- // The "PostTask" family of methods call the task's Run method asynchronously
- // from within a message loop at some point in the future.
- //
- // With the PostTask variant, tasks are invoked in FIFO order, inter-mixed
- // with normal UI or IO event processing. With the PostDelayedTask variant,
- // tasks are called after at least approximately 'delay_ms' have elapsed.
- //
- // The NonNestable variants work similarly except that they promise never to
- // dispatch the task from a nested invocation of MessageLoop::Run. Instead,
- // such tasks get deferred until the top-most MessageLoop::Run is executing.
- //
- // The MessageLoop takes ownership of the Task, and deletes it after it has
- // been Run().
- //
- // PostTask(from_here, task) is equivalent to
- // PostDelayedTask(from_here, task, 0).
- //
- // NOTE: These methods may be called on any thread. The Task will be invoked
- // on the thread that executes MessageLoop::Run().
- void PostTask(const tracked_objects::Location& from_here,
- const Closure& task);
-
- void PostDelayedTask(const tracked_objects::Location& from_here,
- const Closure& task,
- TimeDelta delay);
-
- // A variant on PostTask that deletes the given object. This is useful
- // if the object needs to live until the next run of the MessageLoop (for
- // example, deleting a RenderProcessHost from within an IPC callback is not
- // good).
- //
- // NOTE: This method may be called on any thread. The object will be deleted
- // on the thread that executes MessageLoop::Run().
- template <class T>
- void DeleteSoon(const tracked_objects::Location& from_here, const T* object) {
- base::subtle::DeleteHelperInternal<T, void>::DeleteViaSequencedTaskRunner(
- this, from_here, object);
- }
-
- // A variant on PostTask that releases the given reference counted object
- // (by calling its Release method). This is useful if the object needs to
- // live until the next run of the MessageLoop, or if the object needs to be
- // released on a particular thread.
- //
- // A common pattern is to manually increment the object's reference count
- // (AddRef), clear the pointer, then issue a ReleaseSoon. The reference count
- // is incremented manually to ensure clearing the pointer does not trigger a
- // delete and to account for the upcoming decrement (ReleaseSoon). For
- // example:
- //
- // scoped_refptr<Foo> foo = ...
- // foo->AddRef();
- // Foo* raw_foo = foo.get();
- // foo = NULL;
- // message_loop->ReleaseSoon(raw_foo);
- //
- // NOTE: This method may be called on any thread. The object will be
- // released (and thus possibly deleted) on the thread that executes
- // MessageLoop::Run(). If this is not the same as the thread that calls
- // ReleaseSoon(FROM_HERE, ), then T MUST inherit from
- // RefCountedThreadSafe<T>!
- template <class T>
- void ReleaseSoon(const tracked_objects::Location& from_here,
- const T* object) {
- base::subtle::ReleaseHelperInternal<T, void>::ReleaseViaSequencedTaskRunner(
- this, from_here, object);
- }
-#endif // !(defined(OS_MACOSX) && !defined(OS_IOS))
-
#if defined(OS_MACOSX) && !defined(OS_IOS)
protected:
#endif // defined(OS_MACOSX) && !defined(OS_IOS)
@@ -568,18 +492,6 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate {
// MessageLoop is bound to its thread and constant forever after.
PlatformThreadId thread_id_;
-#if !(defined(OS_MACOSX) && !defined(OS_IOS))
- template <class T, class R> friend class base::subtle::DeleteHelperInternal;
- template <class T, class R> friend class base::subtle::ReleaseHelperInternal;
-
- void DeleteSoonInternal(const tracked_objects::Location& from_here,
- void(*deleter)(const void*),
- const void* object);
- void ReleaseSoonInternal(const tracked_objects::Location& from_here,
- void(*releaser)(const void*),
- const void* object);
-#endif // !(defined(OS_MACOSX) && !defined(OS_IOS))
-
DISALLOW_COPY_AND_ASSIGN(MessageLoop);
};
« no previous file with comments | « no previous file | base/message_loop/message_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698