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

Unified Diff: third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.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/html/canvas/CanvasAsyncBlobCreator.cpp
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp
index 7cf1fdaf454d2dc6744af55e75924bde384aa464..3ac37fa822ea04c66bc7d3d31c126f620417f9ca 100644
--- a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp
+++ b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp
@@ -34,12 +34,13 @@
} // anonymous namespace
-CanvasAsyncBlobCreator* CanvasAsyncBlobCreator::create(DOMUint8ClampedArray* unpremultipliedRGBAImageData, const String& mimeType, const IntSize& size, BlobCallback* callback)
+PassRefPtr<CanvasAsyncBlobCreator> CanvasAsyncBlobCreator::create(PassRefPtr<DOMUint8ClampedArray> unpremultipliedRGBAImageData, const String& mimeType, const IntSize& size, BlobCallback* callback)
{
- return new CanvasAsyncBlobCreator(unpremultipliedRGBAImageData, mimeType, size, callback);
+ RefPtr<CanvasAsyncBlobCreator> asyncBlobCreator = adoptRef(new CanvasAsyncBlobCreator(unpremultipliedRGBAImageData, mimeType, size, callback));
+ return asyncBlobCreator.release();
}
-CanvasAsyncBlobCreator::CanvasAsyncBlobCreator(DOMUint8ClampedArray* data, const String& mimeType, const IntSize& size, BlobCallback* callback)
+CanvasAsyncBlobCreator::CanvasAsyncBlobCreator(PassRefPtr<DOMUint8ClampedArray> data, const String& mimeType, const IntSize& size, BlobCallback* callback)
: m_data(data)
, m_size(size)
, m_mimeType(mimeType)
@@ -61,7 +62,7 @@
ASSERT(isMainThread());
// Make self-reference to keep this object alive until the final task completes
- m_keepAlive = this;
+ m_selfRef = this;
// At the time being, progressive encoding is only applicable to png image format,
// and thus idle tasks scheduling can only be applied to png image format.
@@ -82,7 +83,7 @@
m_jpegEncoderState = JPEGImageEncoderState::create(m_size, quality, m_encodedImage.get());
if (!m_jpegEncoderState) {
Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, bind(&BlobCallback::handleEvent, m_callback, nullptr));
- m_keepAlive.clear();
+ m_selfRef.clear();
return;
}
BackgroundTaskRunner::TaskSize taskSize = (m_size.height() * m_size.width() >= LongTaskImageSizeThreshold) ? BackgroundTaskRunner::TaskSizeLongRunningTask : BackgroundTaskRunner::TaskSizeShortRunningTask;
@@ -95,7 +96,7 @@
m_pngEncoderState = PNGImageEncoderState::create(m_size, m_encodedImage.get());
if (!m_pngEncoderState) {
Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, bind(&BlobCallback::handleEvent, m_callback, nullptr));
- m_keepAlive.clear();
+ m_selfRef.clear();
return;
}
@@ -163,7 +164,7 @@
// Some persistent members in CanvasAsyncBlobCreator can only be destroyed
// on the thread that creates them. In this case, it's the main thread.
ASSERT(isMainThread());
- m_keepAlive.clear();
+ m_selfRef.clear();
}
void CanvasAsyncBlobCreator::scheduleCreateBlobAndCallOnMainThread()

Powered by Google App Engine
This is Rietveld 408576698