Bug 1260806: Remove some more dead MessageLoop code. r=jld
authorKyle Huey <khuey@kylehuey.com>
Fri, 01 Apr 2016 11:28:53 -0700
changeset 291242 8f29950faaa3c187b19aeffe12359cdbd86dc2d4
parent 291241 37bfc8717cf31701af941d3fd72153a8531d4bce
child 291243 288b6ba19e644cec4aa6a3c2cf609cf8c7e975f8
push id74532
push userkhuey@mozilla.com
push dateFri, 01 Apr 2016 18:29:13 +0000
treeherdermozilla-inbound@8f29950faaa3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjld
bugs1260806
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1260806: Remove some more dead MessageLoop code. r=jld
ipc/chromium/src/base/message_loop.cc
ipc/chromium/src/base/message_loop.h
ipc/chromium/src/base/task.h
--- a/ipc/chromium/src/base/message_loop.cc
+++ b/ipc/chromium/src/base/message_loop.cc
@@ -198,22 +198,16 @@ void MessageLoop::RemoveDestructionObser
   destruction_observers_.RemoveObserver(obs);
 }
 
 void MessageLoop::Run() {
   AutoRunState save_state(this);
   RunHandler();
 }
 
-void MessageLoop::RunAllPending() {
-  AutoRunState save_state(this);
-  state_->quit_received = true;  // Means run until we would otherwise block.
-  RunHandler();
-}
-
 // Runs the loop in two different SEH modes:
 // enable_SEH_restoration_ = false : any unhandled exception goes to the last
 // one that calls SetUnhandledExceptionFilter().
 // enable_SEH_restoration_ = true : any unhandled exception goes to the filter
 // that was existed before the loop was run.
 void MessageLoop::RunHandler() {
 #if defined(OS_WIN)
   if (exception_restoration_) {
@@ -261,32 +255,22 @@ void MessageLoop::Quit() {
     state_->quit_received = true;
   } else {
     NOTREACHED() << "Must be inside Run to call Quit";
   }
 }
 
 void MessageLoop::PostTask(
     const tracked_objects::Location& from_here, Task* task) {
-  PostTask_Helper(from_here, task, 0, true);
+  PostTask_Helper(from_here, task, 0);
 }
 
 void MessageLoop::PostDelayedTask(
     const tracked_objects::Location& from_here, Task* task, int delay_ms) {
-  PostTask_Helper(from_here, task, delay_ms, true);
-}
-
-void MessageLoop::PostNonNestableTask(
-    const tracked_objects::Location& from_here, Task* task) {
-  PostTask_Helper(from_here, task, 0, false);
-}
-
-void MessageLoop::PostNonNestableDelayedTask(
-    const tracked_objects::Location& from_here, Task* task, int delay_ms) {
-  PostTask_Helper(from_here, task, delay_ms, false);
+  PostTask_Helper(from_here, task, delay_ms);
 }
 
 void MessageLoop::PostIdleTask(
     const tracked_objects::Location& from_here, Task* task) {
   DCHECK(current() == this);
 
 #ifdef MOZ_TASK_TRACER
   task = mozilla::tasktracer::CreateTracedTask(task);
@@ -295,27 +279,26 @@ void MessageLoop::PostIdleTask(
 
   task->SetBirthPlace(from_here);
   PendingTask pending_task(task, false);
   deferred_non_nestable_work_queue_.push(pending_task);
 }
 
 // Possibly called on a background thread!
 void MessageLoop::PostTask_Helper(
-    const tracked_objects::Location& from_here, Task* task, int delay_ms,
-    bool nestable) {
+    const tracked_objects::Location& from_here, Task* task, int delay_ms) {
 
 #ifdef MOZ_TASK_TRACER
   task = mozilla::tasktracer::CreateTracedTask(task);
   (static_cast<mozilla::tasktracer::TracedTask*>(task))->DispatchTask(delay_ms);
 #endif
 
   task->SetBirthPlace(from_here);
 
-  PendingTask pending_task(task, nestable);
+  PendingTask pending_task(task, true);
 
   if (delay_ms > 0) {
     pending_task.delayed_run_time =
         TimeTicks::Now() + TimeDelta::FromMilliseconds(delay_ms);
   } else {
     DCHECK(delay_ms == 0) << "delay should not be negative";
   }
 
--- a/ipc/chromium/src/base/message_loop.h
+++ b/ipc/chromium/src/base/message_loop.h
@@ -112,62 +112,23 @@ public:
   // on the thread that executes MessageLoop::Run().
 
   B2G_ACL_EXPORT void PostTask(
       const tracked_objects::Location& from_here, Task* task);
 
   void PostDelayedTask(
       const tracked_objects::Location& from_here, Task* task, int delay_ms);
 
-  void PostNonNestableTask(
-      const tracked_objects::Location& from_here, Task* task);
-
-  void PostNonNestableDelayedTask(
-      const tracked_objects::Location& from_here, Task* task, int delay_ms);
-
   // PostIdleTask is not thread safe and should be called on this thread
   void PostIdleTask(
       const tracked_objects::Location& from_here, Task* task);
 
-  // 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().  If this is not the same
-  // as the thread that calls PostDelayedTask(FROM_HERE, ), then T MUST inherit
-  // from RefCountedThreadSafe<T>!
-  template <class T>
-  void DeleteSoon(const tracked_objects::Location& from_here, T* object) {
-    PostNonNestableTask(from_here, new DeleteTask<T>(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.
-  //
-  // 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
-  // PostDelayedTask(FROM_HERE, ), then T MUST inherit from
-  // RefCountedThreadSafe<T>!
-  template <class T>
-  void ReleaseSoon(const tracked_objects::Location& from_here, T* object) {
-    PostNonNestableTask(from_here, new ReleaseTask<T>(object));
-  }
-
   // Run the message loop.
   void Run();
 
-  // Process all pending tasks, windows messages, etc., but don't wait/sleep.
-  // Return as soon as all items that can be run are taken care of.
-  void RunAllPending();
-
   // Signals the Run method to return after it is done processing all pending
   // messages.  This method may only be called on the same thread that called
   // Run, and Run must still be on the call stack.
   //
   // Use QuitTask if you need to Quit another thread's MessageLoop, but note
   // that doing so is fairly dangerous if the target thread makes nested calls
   // to MessageLoop::Run.  The problem being that you won't know which nested
   // run loop you are quiting, so be careful!
@@ -390,17 +351,17 @@ public:
 
   // Delete tasks that haven't run yet without running them.  Used in the
   // destructor to make sure all the task's destructors get called.  Returns
   // true if some work was done.
   bool DeletePendingTasks();
 
   // Post a task to our incomming queue.
   void PostTask_Helper(const tracked_objects::Location& from_here, Task* task,
-                       int delay_ms, bool nestable);
+                       int delay_ms);
 
   // base::MessagePump::Delegate methods:
   virtual bool DoWork() override;
   virtual bool DoDelayedWork(base::TimeTicks* next_delayed_work_time) override;
   virtual bool DoIdleWork() override;
 
   Type type_;
   int32_t id_;
--- a/ipc/chromium/src/base/task.h
+++ b/ipc/chromium/src/base/task.h
@@ -209,34 +209,16 @@ class DeleteTask : public CancelableTask
   virtual void Cancel() {
     obj_ = NULL;
   }
  private:
   T* MOZ_UNSAFE_REF("The validity of this pointer must be enforced by "
                     "external factors.") obj_;
 };
 
-// Task to Release() an object
-template<class T>
-class ReleaseTask : public CancelableTask {
- public:
-  explicit ReleaseTask(T* obj) : obj_(obj) {
-  }
-  virtual void Run() {
-    if (obj_)
-      obj_->Release();
-  }
-  virtual void Cancel() {
-    obj_ = NULL;
-  }
- private:
-  T* MOZ_UNSAFE_REF("The validity of this pointer must be enforced by "
-                    "external factors.") obj_;
-};
-
 // RunnableMethodTraits --------------------------------------------------------
 //
 // This traits-class is used by RunnableMethod to manage the lifetime of the
 // callee object.  By default, it is assumed that the callee supports AddRef
 // and Release methods.  A particular class can specialize this template to
 // define other lifetime management.  For example, if the callee is known to
 // live longer than the RunnableMethod object, then a RunnableMethodTraits
 // struct could be defined with empty RetainCallee and ReleaseCallee methods.