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

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

Issue 1696753002: Change createImageBitmap(Blob) to use ImageDecoder instead of ImageSource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 10 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
« no previous file with comments | « third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 21db9ff08622bddf49c80f48ba5fc0973e705242..02727da7ee256e918825bde7839a54c0f3bc07c8 100644
--- a/third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp
+++ b/third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp
@@ -44,7 +44,7 @@
#include "core/workers/WorkerGlobalScope.h"
#include "platform/SharedBuffer.h"
#include "platform/ThreadSafeFunctional.h"
-#include "platform/graphics/ImageSource.h"
+#include "platform/image-decoders/ImageDecoder.h"
#include "platform/threading/BackgroundTaskRunner.h"
#include "public/platform/Platform.h"
#include "public/platform/WebThread.h"
@@ -219,15 +219,19 @@ void ImageBitmapFactories::ImageBitmapLoader::decodeImageOnDecoderThread(WebTask
ASSERT(!isMainThread());
RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create((char*)m_loader.arrayBufferResult()->data(), static_cast<size_t>(m_loader.arrayBufferResult()->byteLength()));
- OwnPtr<ImageSource> source = adoptPtr(new ImageSource());
- source->setData(*sharedBuffer, true);
-
- taskRunner->postTask(BLINK_FROM_HERE, threadSafeBind(&ImageBitmapFactories::ImageBitmapLoader::resolvePromiseOnOriginalThread, AllowCrossThreadAccess(this), source.release()));
+ OwnPtr<ImageDecoder> decoder(ImageDecoder::create(*sharedBuffer, ImageDecoder::AlphaPremultiplied, ImageDecoder::GammaAndColorProfileApplied));
+ if (decoder)
+ decoder->setData(sharedBuffer.get(), true);
+ taskRunner->postTask(BLINK_FROM_HERE, threadSafeBind(&ImageBitmapFactories::ImageBitmapLoader::resolvePromiseOnOriginalThread, AllowCrossThreadAccess(this), decoder.release()));
}
-void ImageBitmapFactories::ImageBitmapLoader::resolvePromiseOnOriginalThread(PassOwnPtr<ImageSource> source)
+void ImageBitmapFactories::ImageBitmapLoader::resolvePromiseOnOriginalThread(PassOwnPtr<ImageDecoder> decoder)
{
- RefPtr<SkImage> frame = source->createFrameAtIndex(0);
+ if (!decoder) {
+ rejectPromise();
+ return;
+ }
+ RefPtr<SkImage> frame = ImageBitmap::getSkImageFromDecoder(decoder);
ASSERT(!frame || (frame->width() && frame->height()));
if (!frame) {
rejectPromise();
« no previous file with comments | « third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698