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() |