Bug 1110487 P4 Allow Cache Action objects to be canceled more than once. r=ehsan
authorBen Kelly <ben@wanderview.com>
Mon, 23 Mar 2015 22:23:45 -0400
changeset 264063 fa8fa3aa9ea63588dfad9dcaf70f0ba0a163758f
parent 264062 1a468067441b53e56717df11f868125d6e144638
child 264064 07234a94ed48b08fbcfa4fefe0d2dedb01c27c40
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1110487
milestone39.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 1110487 P4 Allow Cache Action objects to be canceled more than once. r=ehsan
dom/cache/Action.cpp
dom/cache/Action.h
--- a/dom/cache/Action.cpp
+++ b/dom/cache/Action.cpp
@@ -9,17 +9,19 @@
 namespace mozilla {
 namespace dom {
 namespace cache {
 
 void
 Action::CancelOnInitiatingThread()
 {
   NS_ASSERT_OWNINGTHREAD(Action);
-  MOZ_ASSERT(!mCanceled);
+  // It is possible for cancellation to be duplicated.  For example, an
+  // individual Cache could have its Actions canceled and then shutdown
+  // could trigger a second action.
   mCanceled = true;
 }
 
 Action::Action()
   : mCanceled(false)
 {
 }
 
--- a/dom/cache/Action.h
+++ b/dom/cache/Action.h
@@ -44,16 +44,19 @@ public:
   // responsible for calling Resolver::Resolve() as normal; either with a
   // normal error code or NS_ERROR_ABORT.  If CancelOnInitiatingThread() is
   // called after Resolve() has already occurred, then the cancel can be
   // ignored.
   //
   // Cancellation is a best effort to stop processing as soon as possible, but
   // does not guarantee the Action will not run.
   //
+  // CancelOnInitiatingThread() may be called more than once.  Subsequent
+  // calls should have no effect.
+  //
   // Default implementation sets an internal cancellation flag that can be
   // queried with IsCanceled().
   virtual void CancelOnInitiatingThread();
 
   // Executed on the initiating thread and is passed the nsresult given to
   // Resolver::Resolve().
   virtual void CompleteOnInitiatingThread(nsresult aRv) { }