OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 178 |
179 char buffer[100 * 100 * 4]; | 179 char buffer[100 * 100 * 4]; |
180 m_generator->decodeAndScale(m_segmentReader.get(), false, 0, imageInfo(), bu
ffer, 100 * 4); | 180 m_generator->decodeAndScale(m_segmentReader.get(), false, 0, imageInfo(), bu
ffer, 100 * 4); |
181 EXPECT_EQ(1, m_decodeRequestCount); | 181 EXPECT_EQ(1, m_decodeRequestCount); |
182 EXPECT_EQ(0, m_decodersDestroyed); | 182 EXPECT_EQ(0, m_decodersDestroyed); |
183 | 183 |
184 // LocalFrame can now be decoded completely. | 184 // LocalFrame can now be decoded completely. |
185 setFrameStatus(ImageFrame::FrameComplete); | 185 setFrameStatus(ImageFrame::FrameComplete); |
186 addNewData(); | 186 addNewData(); |
187 OwnPtr<WebThread> thread = adoptPtr(Platform::current()->createThread("Decod
eThread")); | 187 OwnPtr<WebThread> thread = adoptPtr(Platform::current()->createThread("Decod
eThread")); |
188 thread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&decode
ThreadMain, AllowCrossThreadAccess(m_generator.get()), AllowCrossThreadAccess(m_
segmentReader.get()))); | 188 thread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&decode
ThreadMain, m_generator, m_segmentReader)); |
189 thread.clear(); | 189 thread.clear(); |
190 EXPECT_EQ(2, m_decodeRequestCount); | 190 EXPECT_EQ(2, m_decodeRequestCount); |
191 EXPECT_EQ(1, m_decodersDestroyed); | 191 EXPECT_EQ(1, m_decodersDestroyed); |
192 | 192 |
193 // Decoder created again. | 193 // Decoder created again. |
194 m_generator->decodeAndScale(m_segmentReader.get(), false, 0, imageInfo(), bu
ffer, 100 * 4); | 194 m_generator->decodeAndScale(m_segmentReader.get(), false, 0, imageInfo(), bu
ffer, 100 * 4); |
195 EXPECT_EQ(3, m_decodeRequestCount); | 195 EXPECT_EQ(3, m_decodeRequestCount); |
196 | 196 |
197 addNewData(); | 197 addNewData(); |
198 | 198 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 // Decoding the last frame of a multi-frame images should trigger clearing | 245 // Decoding the last frame of a multi-frame images should trigger clearing |
246 // all the frame data, but not destroying the decoder. See comments in | 246 // all the frame data, but not destroying the decoder. See comments in |
247 // ImageFrameGenerator::tryToResumeDecode(). | 247 // ImageFrameGenerator::tryToResumeDecode(). |
248 m_generator->decodeAndScale(m_segmentReader.get(), true, 2, imageInfo(), buf
fer, 100 * 4); | 248 m_generator->decodeAndScale(m_segmentReader.get(), true, 2, imageInfo(), buf
fer, 100 * 4); |
249 EXPECT_EQ(3, m_decodeRequestCount); | 249 EXPECT_EQ(3, m_decodeRequestCount); |
250 EXPECT_EQ(0, m_decodersDestroyed); | 250 EXPECT_EQ(0, m_decodersDestroyed); |
251 EXPECT_EQ(kNotFound, m_requestedClearExceptFrame); | 251 EXPECT_EQ(kNotFound, m_requestedClearExceptFrame); |
252 } | 252 } |
253 | 253 |
254 } // namespace blink | 254 } // namespace blink |
OLD | NEW |