| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 170 |
| 171 char buffer[100 * 100 * 4]; | 171 char buffer[100 * 100 * 4]; |
| 172 m_generator->decodeAndScale(imageInfo(), 0, buffer, 100 * 4); | 172 m_generator->decodeAndScale(imageInfo(), 0, buffer, 100 * 4); |
| 173 EXPECT_EQ(1, m_decodeRequestCount); | 173 EXPECT_EQ(1, m_decodeRequestCount); |
| 174 EXPECT_EQ(0, m_decodersDestroyed); | 174 EXPECT_EQ(0, m_decodersDestroyed); |
| 175 | 175 |
| 176 // LocalFrame can now be decoded completely. | 176 // LocalFrame can now be decoded completely. |
| 177 setFrameStatus(ImageFrame::FrameComplete); | 177 setFrameStatus(ImageFrame::FrameComplete); |
| 178 addNewData(); | 178 addNewData(); |
| 179 OwnPtr<WebThread> thread = adoptPtr(Platform::current()->createThread("Decod
eThread")); | 179 OwnPtr<WebThread> thread = adoptPtr(Platform::current()->createThread("Decod
eThread")); |
| 180 thread->postTask(FROM_HERE, new Task(threadSafeBind(&decodeThreadMain, Allow
CrossThreadAccess(m_generator.get())))); | 180 thread->defaultTaskRunner()->postTask(FROM_HERE, new Task(threadSafeBind(&de
codeThreadMain, AllowCrossThreadAccess(m_generator.get())))); |
| 181 thread.clear(); | 181 thread.clear(); |
| 182 EXPECT_EQ(2, m_decodeRequestCount); | 182 EXPECT_EQ(2, m_decodeRequestCount); |
| 183 EXPECT_EQ(1, m_decodersDestroyed); | 183 EXPECT_EQ(1, m_decodersDestroyed); |
| 184 | 184 |
| 185 // Decoder created again. | 185 // Decoder created again. |
| 186 m_generator->decodeAndScale(imageInfo(), 0, buffer, 100 * 4); | 186 m_generator->decodeAndScale(imageInfo(), 0, buffer, 100 * 4); |
| 187 EXPECT_EQ(3, m_decodeRequestCount); | 187 EXPECT_EQ(3, m_decodeRequestCount); |
| 188 } | 188 } |
| 189 | 189 |
| 190 TEST_F(ImageFrameGeneratorTest, frameHasAlpha) | 190 TEST_F(ImageFrameGeneratorTest, frameHasAlpha) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 | 227 |
| 228 setFrameStatus(ImageFrame::FrameComplete); | 228 setFrameStatus(ImageFrame::FrameComplete); |
| 229 | 229 |
| 230 // Multi frame decoder should be removed. | 230 // Multi frame decoder should be removed. |
| 231 m_generator->decodeAndScale(imageInfo(), 2, buffer, 100 * 4); | 231 m_generator->decodeAndScale(imageInfo(), 2, buffer, 100 * 4); |
| 232 EXPECT_EQ(3, m_decodeRequestCount); | 232 EXPECT_EQ(3, m_decodeRequestCount); |
| 233 EXPECT_EQ(1, m_decodersDestroyed); | 233 EXPECT_EQ(1, m_decodersDestroyed); |
| 234 } | 234 } |
| 235 | 235 |
| 236 } // namespace blink | 236 } // namespace blink |
| OLD | NEW |