|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
|
2 * |
|
3 * This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 /** @file |
|
8 * An enumeration used by RasterImage and Decoder to specify which 'strategy' to |
|
9 * use for image decoding - synchronous or asynchronous. |
|
10 */ |
|
11 |
|
12 #ifndef mozilla_imagelib_DecodeStrategy_h_ |
|
13 #define mozilla_imagelib_DecodeStrategy_h_ |
|
14 |
|
15 namespace mozilla { |
|
16 namespace image { |
|
17 |
|
18 enum DecodeStrategy { |
|
19 // DECODE_SYNC requests a synchronous decode, which will continue decoding |
|
20 // frames as long as it has more source data. It returns to the caller only |
|
21 // once decoding is complete (or until it needs more source data before |
|
22 // continuing). Because DECODE_SYNC can involve allocating new imgFrames, it |
|
23 // can only be run on the main thread. |
|
24 DECODE_SYNC, |
|
25 |
|
26 // DECODE_ASYNC requests an asynchronous decode, which will continue decoding |
|
27 // until it either finishes a frame or runs out of source data. Because |
|
28 // DECODE_ASYNC does not allocate new imgFrames, it can be safely run off the |
|
29 // main thread. (And hence workers in the decode pool always use it.) |
|
30 DECODE_ASYNC |
|
31 }; |
|
32 |
|
33 } // namespace image |
|
34 } // namespace mozilla |
|
35 |
|
36 #endif |