Bug 1287691 (Part 2) - Yield after each frame in the GIF decoder. r=edwin
authorSeth Fowler <mark.seth.fowler@gmail.com>
Mon, 18 Jul 2016 23:48:11 -0700
changeset 330822 1bd6857c728d4345f870ecc9ba896c3568690d71
parent 330821 77a8e7ea0fe57ebc175e6765075ecda3bb5e9793
child 330823 2fd2f3d22e5d391cd2cfaa2a3cefa0978e0fc8a5
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersedwin
bugs1287691
milestone50.0a1
Bug 1287691 (Part 2) - Yield after each frame in the GIF decoder. r=edwin
image/decoders/nsGIFDecoder2.cpp
image/decoders/nsGIFDecoder2.h
--- a/image/decoders/nsGIFDecoder2.cpp
+++ b/image/decoders/nsGIFDecoder2.cpp
@@ -470,16 +470,18 @@ nsGIFDecoder2::DoDecode(SourceBufferIter
       case State::SCREEN_DESCRIPTOR:
         return ReadScreenDescriptor(aData);
       case State::GLOBAL_COLOR_TABLE:
         return ReadGlobalColorTable(aData, aLength);
       case State::FINISHED_GLOBAL_COLOR_TABLE:
         return FinishedGlobalColorTable();
       case State::BLOCK_HEADER:
         return ReadBlockHeader(aData);
+      case State::BLOCK_HEADER_AFTER_YIELD:
+        return Transition::To(State::BLOCK_HEADER, BLOCK_HEADER_LEN);
       case State::EXTENSION_HEADER:
         return ReadExtensionHeader(aData);
       case State::GRAPHIC_CONTROL_EXTENSION:
         return ReadGraphicControlExtension(aData);
       case State::APPLICATION_IDENTIFIER:
         return ReadApplicationIdentifier(aData);
       case State::NETSCAPE_EXTENSION_SUB_BLOCK:
         return ReadNetscapeExtensionSubBlock(aData);
@@ -970,17 +972,17 @@ nsGIFDecoder2::ReadImageDataBlock(const 
 
 LexerTransition<nsGIFDecoder2::State>
 nsGIFDecoder2::ReadImageDataSubBlock(const char* aData)
 {
   const uint8_t subBlockLength = aData[0];
   if (subBlockLength == 0) {
     // We hit the block terminator.
     EndImageFrame();
-    return Transition::To(State::BLOCK_HEADER, BLOCK_HEADER_LEN);
+    return Transition::ToAfterYield(State::BLOCK_HEADER_AFTER_YIELD);
   }
 
   if (mGIFStruct.pixels_remaining == 0) {
     // We've already written to the entire image; we should've hit the block
     // terminator at this point. This image is corrupt, but we'll tolerate it.
 
     if (subBlockLength == GIF_TRAILER) {
       // This GIF is missing the block terminator for the final block; we'll put
--- a/image/decoders/nsGIFDecoder2.h
+++ b/image/decoders/nsGIFDecoder2.h
@@ -75,16 +75,17 @@ private:
   {
     FAILURE,
     SUCCESS,
     GIF_HEADER,
     SCREEN_DESCRIPTOR,
     GLOBAL_COLOR_TABLE,
     FINISHED_GLOBAL_COLOR_TABLE,
     BLOCK_HEADER,
+    BLOCK_HEADER_AFTER_YIELD,
     EXTENSION_HEADER,
     GRAPHIC_CONTROL_EXTENSION,
     APPLICATION_IDENTIFIER,
     NETSCAPE_EXTENSION_SUB_BLOCK,
     NETSCAPE_EXTENSION_DATA,
     IMAGE_DESCRIPTOR,
     LOCAL_COLOR_TABLE,
     FINISHED_LOCAL_COLOR_TABLE,