Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(424)

Unified Diff: third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp

Issue 1964183004: Revert of Move DOMArrayBuffer, DOMArrayBufferViews and DataView to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp
diff --git a/third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp b/third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp
index 77c2e8c50bd6d22f91ac79a7f28990a7f4af5f8e..2bda28d22764fee3abb96059c5f7c175e588a1e5 100644
--- a/third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp
+++ b/third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp
@@ -191,12 +191,11 @@
void ImageBitmapFactories::ImageBitmapLoader::didFinishLoading()
{
- DOMArrayBuffer* arrayBuffer = m_loader.arrayBufferResult();
- if (!arrayBuffer) {
+ if (!m_loader.arrayBufferResult()) {
rejectPromise();
return;
}
- scheduleAsyncImageBitmapDecoding(arrayBuffer);
+ scheduleAsyncImageBitmapDecoding();
}
void ImageBitmapFactories::ImageBitmapLoader::didFail(FileError::ErrorCode)
@@ -204,23 +203,21 @@
rejectPromise();
}
-void ImageBitmapFactories::ImageBitmapLoader::scheduleAsyncImageBitmapDecoding(DOMArrayBuffer* arrayBuffer)
+void ImageBitmapFactories::ImageBitmapLoader::scheduleAsyncImageBitmapDecoding()
{
// For a 4000*4000 png image where each 10*10 tile is filled in by a random RGBA value,
// the byteLength is around 2M, and it typically takes around 4.5ms to decode on a
// current model of Linux desktop.
const int longTaskByteLengthThreshold = 2000000;
- BackgroundTaskRunner::TaskSize taskSize = BackgroundTaskRunner::TaskSizeShortRunningTask;
- if (arrayBuffer->byteLength() >= longTaskByteLengthThreshold)
- taskSize = BackgroundTaskRunner::TaskSizeLongRunningTask;
+ BackgroundTaskRunner::TaskSize taskSize = (m_loader.arrayBufferResult()->byteLength() >= longTaskByteLengthThreshold) ? BackgroundTaskRunner::TaskSizeLongRunningTask : BackgroundTaskRunner::TaskSizeShortRunningTask;
WebTaskRunner* taskRunner = Platform::current()->currentThread()->getWebTaskRunner();
- BackgroundTaskRunner::postOnBackgroundThread(BLINK_FROM_HERE, threadSafeBind(&ImageBitmapFactories::ImageBitmapLoader::decodeImageOnDecoderThread, AllowCrossThreadAccess(this), AllowCrossThreadAccess(taskRunner), AllowCrossThreadAccess(arrayBuffer)), taskSize);
-}
-
-void ImageBitmapFactories::ImageBitmapLoader::decodeImageOnDecoderThread(WebTaskRunner* taskRunner, DOMArrayBuffer* arrayBuffer)
+ BackgroundTaskRunner::postOnBackgroundThread(BLINK_FROM_HERE, threadSafeBind(&ImageBitmapFactories::ImageBitmapLoader::decodeImageOnDecoderThread, AllowCrossThreadAccess(this), AllowCrossThreadAccess(taskRunner)), taskSize);
+}
+
+void ImageBitmapFactories::ImageBitmapLoader::decodeImageOnDecoderThread(WebTaskRunner* taskRunner)
{
ASSERT(!isMainThread());
- RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(static_cast<char*>(arrayBuffer->data()), static_cast<size_t>(arrayBuffer->byteLength()));
+ RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create((char*)m_loader.arrayBufferResult()->data(), static_cast<size_t>(m_loader.arrayBufferResult()->byteLength()));
ImageDecoder::AlphaOption alphaOp = ImageDecoder::AlphaPremultiplied;
if (m_options.premultiplyAlpha() == "none")

Powered by Google App Engine
This is Rietveld 408576698