image/src/DecodeStrategy.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/image/src/DecodeStrategy.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,36 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + *
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +/** @file
    1.11 + * An enumeration used by RasterImage and Decoder to specify which 'strategy' to
    1.12 + * use for image decoding - synchronous or asynchronous.
    1.13 + */
    1.14 +
    1.15 +#ifndef mozilla_imagelib_DecodeStrategy_h_
    1.16 +#define mozilla_imagelib_DecodeStrategy_h_
    1.17 +
    1.18 +namespace mozilla {
    1.19 +namespace image {
    1.20 +
    1.21 +enum DecodeStrategy {
    1.22 +  // DECODE_SYNC requests a synchronous decode, which will continue decoding
    1.23 +  // frames as long as it has more source data. It returns to the caller only
    1.24 +  // once decoding is complete (or until it needs more source data before
    1.25 +  // continuing). Because DECODE_SYNC can involve allocating new imgFrames, it
    1.26 +  // can only be run on the main thread.
    1.27 +  DECODE_SYNC,
    1.28 +
    1.29 +  // DECODE_ASYNC requests an asynchronous decode, which will continue decoding
    1.30 +  // until it either finishes a frame or runs out of source data. Because
    1.31 +  // DECODE_ASYNC does not allocate new imgFrames, it can be safely run off the
    1.32 +  // main thread. (And hence workers in the decode pool always use it.)
    1.33 +  DECODE_ASYNC
    1.34 +};
    1.35 +
    1.36 +} // namespace image
    1.37 +} // namespace mozilla
    1.38 +
    1.39 +#endif

mercurial