| Index: third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
|
| diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
|
| index f0c2f5bb0e85aca9b5f2d33dc1db886b48a4252b..e0d7ecd15cd8b5de150248e383c2d993bd1a458f 100644
|
| --- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
|
| +++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
|
| @@ -436,7 +436,7 @@ void HTMLCanvasElement::notifyListenersCanvasChanged()
|
|
|
| if (listenerNeedsNewFrameCapture) {
|
| SourceImageStatus status;
|
| - RefPtr<Image> sourceImage = getSourceImageForCanvas(&status, PreferAcceleration);
|
| + RefPtr<Image> sourceImage = getSourceImageForCanvas(&status, PreferNoAcceleration, SnapshotReasonCanvasListenerCapture);
|
| if (status != NormalSourceImageStatus)
|
| return;
|
| RefPtr<SkImage> image = sourceImage->imageForCurrentFrame();
|
| @@ -517,7 +517,7 @@ void HTMLCanvasElement::prepareSurfaceForPaintingIfNeeded() const
|
| m_imageBuffer->prepareSurfaceForPaintingIfNeeded();
|
| }
|
|
|
| -ImageData* HTMLCanvasElement::toImageData(SourceDrawingBuffer sourceBuffer) const
|
| +ImageData* HTMLCanvasElement::toImageData(SourceDrawingBuffer sourceBuffer, SnapshotReason reason) const
|
| {
|
| ImageData* imageData;
|
| if (is3D()) {
|
| @@ -528,7 +528,7 @@ ImageData* HTMLCanvasElement::toImageData(SourceDrawingBuffer sourceBuffer) cons
|
|
|
| m_context->paintRenderingResultsToCanvas(sourceBuffer);
|
| imageData = ImageData::create(m_size);
|
| - RefPtr<SkImage> snapshot = buffer()->newSkImageSnapshot(PreferNoAcceleration);
|
| + RefPtr<SkImage> snapshot = buffer()->newSkImageSnapshot(PreferNoAcceleration, reason);
|
| if (snapshot) {
|
| SkImageInfo imageInfo = SkImageInfo::Make(width(), height(), kRGBA_8888_SkColorType, kUnpremul_SkAlphaType);
|
| snapshot->readPixels(imageInfo, imageData->data()->data(), imageInfo.minRowBytes(), 0, 0);
|
| @@ -542,7 +542,7 @@ ImageData* HTMLCanvasElement::toImageData(SourceDrawingBuffer sourceBuffer) cons
|
| return imageData;
|
|
|
| ASSERT(m_context->is2d());
|
| - RefPtr<SkImage> snapshot = buffer()->newSkImageSnapshot(PreferNoAcceleration);
|
| + RefPtr<SkImage> snapshot = buffer()->newSkImageSnapshot(PreferNoAcceleration, reason);
|
| if (snapshot) {
|
| SkImageInfo imageInfo = SkImageInfo::Make(width(), height(), kRGBA_8888_SkColorType, kUnpremul_SkAlphaType);
|
| snapshot->readPixels(imageInfo, imageData->data()->data(), imageInfo.minRowBytes(), 0, 0);
|
| @@ -558,7 +558,7 @@ String HTMLCanvasElement::toDataURLInternal(const String& mimeType, const double
|
|
|
| String encodingMimeType = toEncodingMimeType(mimeType);
|
|
|
| - ImageData* imageData = toImageData(sourceBuffer);
|
| + ImageData* imageData = toImageData(sourceBuffer, SnapshotReasonToDataURL);
|
| ScopedDisposal<ImageData> disposer(imageData);
|
|
|
| return ImageDataBuffer(imageData->size(), imageData->data()->data()).toDataURL(encodingMimeType, quality);
|
| @@ -603,7 +603,7 @@ void HTMLCanvasElement::toBlob(BlobCallback* callback, const String& mimeType, c
|
|
|
| String encodingMimeType = toEncodingMimeType(mimeType);
|
|
|
| - ImageData* imageData = toImageData(BackBuffer);
|
| + ImageData* imageData = toImageData(BackBuffer, SnapshotReasonToBlob);
|
| // imageData unref its data, which we still keep alive for the async toBlob thread
|
| ScopedDisposal<ImageData> disposer(imageData);
|
| // Add a ref to keep image data alive until completion of encoding
|
| @@ -853,10 +853,10 @@ SkCanvas* HTMLCanvasElement::drawingCanvas() const
|
| return buffer() ? m_imageBuffer->canvas() : nullptr;
|
| }
|
|
|
| -void HTMLCanvasElement::disableDeferral() const
|
| +void HTMLCanvasElement::disableDeferral(DisableDeferralReason reason) const
|
| {
|
| if (buffer())
|
| - m_imageBuffer->disableDeferral();
|
| + m_imageBuffer->disableDeferral(reason);
|
| }
|
|
|
| SkCanvas* HTMLCanvasElement::existingDrawingCanvas() const
|
| @@ -966,7 +966,7 @@ void HTMLCanvasElement::didMoveToNewDocument(Document& oldDocument)
|
| HTMLElement::didMoveToNewDocument(oldDocument);
|
| }
|
|
|
| -PassRefPtr<Image> HTMLCanvasElement::getSourceImageForCanvas(SourceImageStatus* status, AccelerationHint hint) const
|
| +PassRefPtr<Image> HTMLCanvasElement::getSourceImageForCanvas(SourceImageStatus* status, AccelerationHint hint, SnapshotReason reason) const
|
| {
|
| if (!width() || !height()) {
|
| *status = ZeroSizeCanvasSourceImageStatus;
|
| @@ -987,7 +987,7 @@ PassRefPtr<Image> HTMLCanvasElement::getSourceImageForCanvas(SourceImageStatus*
|
| m_context->paintRenderingResultsToCanvas(BackBuffer);
|
| }
|
|
|
| - RefPtr<SkImage> image = buffer()->newSkImageSnapshot(hint);
|
| + RefPtr<SkImage> image = buffer()->newSkImageSnapshot(hint, reason);
|
| if (image) {
|
| *status = NormalSourceImageStatus;
|
| return StaticBitmapImage::create(image.release());
|
|
|