(No bug) - Improve comment in IDecodingTask.cpp. r=me
authorSeth Fowler <mark.seth.fowler@gmail.com>
Mon, 01 Aug 2016 15:33:13 -0700
changeset 307588 7cfbd0d2d797490a88bff3fd1094683eaad3692e
parent 307587 4c6dc34d653dfcf789e1782e0ead3c7d1c50d81d
child 307589 2597f37b8acce63ef950714efd9b7d162467518f
push id80140
push userseth.bugzilla@blackhail.net
push dateTue, 02 Aug 2016 00:51:30 +0000
treeherdermozilla-inbound@bed21227876d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
milestone51.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
(No bug) - Improve comment in IDecodingTask.cpp. r=me
image/IDecodingTask.cpp
--- a/image/IDecodingTask.cpp
+++ b/image/IDecodingTask.cpp
@@ -19,16 +19,22 @@ namespace image {
 // Helpers for sending notifications to the image associated with a decoder.
 ///////////////////////////////////////////////////////////////////////////////
 
 static void
 NotifyProgress(NotNull<Decoder*> aDecoder)
 {
   MOZ_ASSERT(aDecoder->HasProgress() && !aDecoder->IsMetadataDecode());
 
+  // Capture the decoder's state. If we need to notify asynchronously, it's
+  // important that we don't wait until the lambda actually runs to capture the
+  // state that we're going to notify. That would both introduce data races on
+  // the decoder's state and cause inconsistencies between the NotifyProgress()
+  // calls we make off-main-thread and the notifications that RasterImage
+  // actually receives, which would cause bugs.
   Progress progress = aDecoder->TakeProgress();
   IntRect invalidRect = aDecoder->TakeInvalidRect();
   Maybe<uint32_t> frameCount = aDecoder->TakeCompleteFrameCount();
   SurfaceFlags surfaceFlags = aDecoder->GetSurfaceFlags();
 
   // Synchronously notify if we can.
   if (NS_IsMainThread() &&
       !(aDecoder->GetDecoderFlags() & DecoderFlags::ASYNC_NOTIFY)) {