| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Apple Computer, Inc. | 2 * Copyright (C) 2006 Apple Computer, Inc. |
| 3 * | 3 * |
| 4 * Portions are Copyright (C) 2001-6 mozilla.org | 4 * Portions are Copyright (C) 2001-6 mozilla.org |
| 5 * | 5 * |
| 6 * Other contributors: | 6 * Other contributors: |
| 7 * Stuart Parmenter <stuart@mozilla.com> | 7 * Stuart Parmenter <stuart@mozilla.com> |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Lesser General Public | 10 * modify it under the terms of the GNU Lesser General Public |
| (...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 990 return true; | 990 return true; |
| 991 | 991 |
| 992 return decoder->frameIsCompleteAtIndex(0); | 992 return decoder->frameIsCompleteAtIndex(0); |
| 993 } | 993 } |
| 994 | 994 |
| 995 void JPEGImageDecoder::decode(bool onlySize) { | 995 void JPEGImageDecoder::decode(bool onlySize) { |
| 996 if (failed()) | 996 if (failed()) |
| 997 return; | 997 return; |
| 998 | 998 |
| 999 if (!m_reader) { | 999 if (!m_reader) { |
| 1000 m_reader = makeUnique<JPEGImageReader>(this); | 1000 m_reader = WTF::makeUnique<JPEGImageReader>(this); |
| 1001 m_reader->setData(m_data.get()); | 1001 m_reader->setData(m_data.get()); |
| 1002 } | 1002 } |
| 1003 | 1003 |
| 1004 // If we couldn't decode the image but have received all the data, decoding | 1004 // If we couldn't decode the image but have received all the data, decoding |
| 1005 // has failed. | 1005 // has failed. |
| 1006 if (!m_reader->decode(onlySize) && isAllDataReceived()) | 1006 if (!m_reader->decode(onlySize) && isAllDataReceived()) |
| 1007 setFailed(); | 1007 setFailed(); |
| 1008 | 1008 |
| 1009 // If decoding is done or failed, we don't need the JPEGImageReader anymore. | 1009 // If decoding is done or failed, we don't need the JPEGImageReader anymore. |
| 1010 if (isComplete(this, onlySize) || failed()) | 1010 if (isComplete(this, onlySize) || failed()) |
| 1011 m_reader.reset(); | 1011 m_reader.reset(); |
| 1012 } | 1012 } |
| 1013 | 1013 |
| 1014 } // namespace blink | 1014 } // namespace blink |
| OLD | NEW |