OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 } | 242 } |
243 scheduleAsyncImageBitmapDecoding(arrayBuffer); | 243 scheduleAsyncImageBitmapDecoding(arrayBuffer); |
244 } | 244 } |
245 | 245 |
246 void ImageBitmapFactories::ImageBitmapLoader::didFail(FileError::ErrorCode) { | 246 void ImageBitmapFactories::ImageBitmapLoader::didFail(FileError::ErrorCode) { |
247 rejectPromise(); | 247 rejectPromise(); |
248 } | 248 } |
249 | 249 |
250 void ImageBitmapFactories::ImageBitmapLoader::scheduleAsyncImageBitmapDecoding( | 250 void ImageBitmapFactories::ImageBitmapLoader::scheduleAsyncImageBitmapDecoding( |
251 DOMArrayBuffer* arrayBuffer) { | 251 DOMArrayBuffer* arrayBuffer) { |
252 // For a 4000*4000 png image where each 10*10 tile is filled in by a random RG
BA value, | 252 // For a 4000*4000 png image where each 10*10 tile is filled in by a random |
253 // the byteLength is around 2M, and it typically takes around 4.5ms to decode
on a | 253 // RGBA value, the byteLength is around 2M, and it typically takes around |
254 // current model of Linux desktop. | 254 // 4.5ms to decode on a current model of Linux desktop. |
255 const int longTaskByteLengthThreshold = 2000000; | 255 const int longTaskByteLengthThreshold = 2000000; |
256 BackgroundTaskRunner::TaskSize taskSize = | 256 BackgroundTaskRunner::TaskSize taskSize = |
257 BackgroundTaskRunner::TaskSizeShortRunningTask; | 257 BackgroundTaskRunner::TaskSizeShortRunningTask; |
258 if (arrayBuffer->byteLength() >= longTaskByteLengthThreshold) | 258 if (arrayBuffer->byteLength() >= longTaskByteLengthThreshold) |
259 taskSize = BackgroundTaskRunner::TaskSizeLongRunningTask; | 259 taskSize = BackgroundTaskRunner::TaskSizeLongRunningTask; |
260 WebTaskRunner* taskRunner = | 260 WebTaskRunner* taskRunner = |
261 Platform::current()->currentThread()->getWebTaskRunner(); | 261 Platform::current()->currentThread()->getWebTaskRunner(); |
262 BackgroundTaskRunner::postOnBackgroundThread( | 262 BackgroundTaskRunner::postOnBackgroundThread( |
263 BLINK_FROM_HERE, | 263 BLINK_FROM_HERE, |
264 crossThreadBind( | 264 crossThreadBind( |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 } | 317 } |
318 m_factory->didFinishLoading(this); | 318 m_factory->didFinishLoading(this); |
319 } | 319 } |
320 | 320 |
321 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader) { | 321 DEFINE_TRACE(ImageBitmapFactories::ImageBitmapLoader) { |
322 visitor->trace(m_factory); | 322 visitor->trace(m_factory); |
323 visitor->trace(m_resolver); | 323 visitor->trace(m_resolver); |
324 } | 324 } |
325 | 325 |
326 } // namespace blink | 326 } // namespace blink |
OLD | NEW |