[Task Migration][Extensions] Update SandboxedUnpacker

Update the SandboxedUnpacker class to use the new task scheduling API.

Also remove a call to IsShutdownInProgress() by the SandboxedUnpacker.
This was added to fix https://crbug.com/235525, which was seemingly
caused by tasks to write image files being aborted mid-execution. With
the new task scheduling API, we can solve this by using
TaskShutdownBehavior::SKIP_ON_SHUTDOWN, which will ensure that either
the task will not run, or the task will run until completion.

Since this was the last usage of
SequencedWorkerPool::IsShutdownInProgress(), remove the method in its
entirety.

Bug: 689520

Change-Id: I7d518230a13f92b1824371f228a7639ef19a5b9d
Reviewed-on: https://chromium-review.googlesource.com/594632
Reviewed-by: Gabriel Charette <[email protected]>
Reviewed-by: Istiaque Ahmed <[email protected]>
Commit-Queue: Devlin <[email protected]>
Cr-Commit-Position: refs/heads/master@{#493212}
diff --git a/extensions/browser/sandboxed_unpacker.h b/extensions/browser/sandboxed_unpacker.h
index c8bb78b..10ed871c 100644
--- a/extensions/browser/sandboxed_unpacker.h
+++ b/extensions/browser/sandboxed_unpacker.h
@@ -94,6 +94,14 @@
   // passing the |location| and |creation_flags| to Extension::Create. The
   // |extensions_dir| parameter should specify the directory under which we'll
   // create a subdirectory to write the unpacked extension contents.
+  // Note: Because this requires disk I/O, the task runner passed should use
+  // TaskShutdownBehavior::SKIP_ON_SHUTDOWN to ensure that either the task is
+  // fully run (if initiated before shutdown) or not run at all (if shutdown is
+  // initiated first). See crbug.com/235525.
+  // TODO(devlin): We should probably just have SandboxedUnpacker use the common
+  // ExtensionFileTaskRunner, and not pass in a separate one.
+  // TODO(devlin): SKIP_ON_SHUTDOWN is also not quite sufficient for this. We
+  // should probably instead be using base::ImportantFileWriter or similar.
   SandboxedUnpacker(
       Manifest::Location location,
       int creation_flags,
@@ -160,7 +168,7 @@
     INVALID_PATH_FOR_BITMAP_IMAGE,
     ERROR_RE_ENCODING_THEME_IMAGE,
     ERROR_SAVING_THEME_IMAGE,
-    ABORTED_DUE_TO_SHUTDOWN,
+    DEPRECATED_ABORTED_DUE_TO_SHUTDOWN,  // No longer used; kept for UMA.
 
     // SandboxedUnpacker::RewriteCatalogFiles()
     COULD_NOT_READ_CATALOG_DATA_FROM_DISK,