Bug 1425614 P1 Make ClientThing::MaybeExecute() call an optional failure callback. r=asuth
authorBen Kelly <ben@wanderview.com>
Mon, 18 Dec 2017 16:42:10 -0500
changeset 448567 926123cda34755f06f7b5be385ac94a721aaf2a2
parent 448566 6f48edc3e6334a528db9db14127b3693e7955511
child 448568 10b24604cf6b3bafb2a6ba39b1e2a34281ebbe9e
push id8527
push userCallek@gmail.com
push dateThu, 11 Jan 2018 21:05:50 +0000
treeherdermozilla-beta@95342d212a7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersasuth
bugs1425614
milestone59.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 1425614 P1 Make ClientThing::MaybeExecute() call an optional failure callback. r=asuth
dom/clients/manager/ClientThing.h
--- a/dom/clients/manager/ClientThing.h
+++ b/dom/clients/manager/ClientThing.h
@@ -44,23 +44,25 @@ protected:
   IsShutdown() const
   {
     return mShutdown;
   }
 
   // Conditionally execute the given callable based on the current state.
   template<typename Callable>
   void
-  MaybeExecute(const Callable& aCallable)
+  MaybeExecute(const Callable& aSuccess,
+               const std::function<void()>& aFailure = []{})
   {
     if (mShutdown) {
+      aFailure();
       return;
     }
     MOZ_DIAGNOSTIC_ASSERT(mActor);
-    aCallable(mActor);
+    aSuccess(mActor);
   }
 
   // Attach activate the thing by attaching its underlying IPC actor.  This
   // will make the thing register as the actor's owner as well.  The actor
   // must call RevokeActor() to clear this weak back reference before its
   // destroyed.
   void
   ActivateThing(ActorType* aActor)