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

Unified Diff: third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp

Issue 1878463002: Move DOMArrayBuffer, DOMArrayBufferViews and DataView to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tidy Created 4 years, 8 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 3ac37fa822ea04c66bc7d3d31c126f620417f9ca..7cf1fdaf454d2dc6744af55e75924bde384aa464 100644
--- a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp
+++ b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp
@@ -34,13 +34,12 @@ bool isDeadlineNearOrPassed(double deadlineSeconds)
} // anonymous namespace
-PassRefPtr<CanvasAsyncBlobCreator> CanvasAsyncBlobCreator::create(PassRefPtr<DOMUint8ClampedArray> unpremultipliedRGBAImageData, const String& mimeType, const IntSize& size, BlobCallback* callback)
+CanvasAsyncBlobCreator* CanvasAsyncBlobCreator::create(DOMUint8ClampedArray* unpremultipliedRGBAImageData, const String& mimeType, const IntSize& size, BlobCallback* callback)
{
- RefPtr<CanvasAsyncBlobCreator> asyncBlobCreator = adoptRef(new CanvasAsyncBlobCreator(unpremultipliedRGBAImageData, mimeType, size, callback));
- return asyncBlobCreator.release();
+ return new CanvasAsyncBlobCreator(unpremultipliedRGBAImageData, mimeType, size, callback);
}
-CanvasAsyncBlobCreator::CanvasAsyncBlobCreator(PassRefPtr<DOMUint8ClampedArray> data, const String& mimeType, const IntSize& size, BlobCallback* callback)
+CanvasAsyncBlobCreator::CanvasAsyncBlobCreator(DOMUint8ClampedArray* data, const String& mimeType, const IntSize& size, BlobCallback* callback)
: m_data(data)
, m_size(size)
, m_mimeType(mimeType)
@@ -62,7 +61,7 @@ void CanvasAsyncBlobCreator::scheduleAsyncBlobCreation(bool canUseIdlePeriodSche
ASSERT(isMainThread());
// Make self-reference to keep this object alive until the final task completes
- m_selfRef = this;
+ m_keepAlive = this;
haraken 2016/04/11 04:34:33 Isn't the |this| object kept alive by the persiste
sof 2016/04/11 05:14:21 I believe that's correct, but https://code.google.
// 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.
@@ -83,7 +82,7 @@ void CanvasAsyncBlobCreator::initiateJpegEncoding(const double& quality)
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_selfRef.clear();
+ m_keepAlive.clear();
return;
}
BackgroundTaskRunner::TaskSize taskSize = (m_size.height() * m_size.width() >= LongTaskImageSizeThreshold) ? BackgroundTaskRunner::TaskSizeLongRunningTask : BackgroundTaskRunner::TaskSizeShortRunningTask;
@@ -96,7 +95,7 @@ void CanvasAsyncBlobCreator::initiatePngEncoding(double deadlineSeconds)
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_selfRef.clear();
+ m_keepAlive.clear();
return;
}
@@ -164,7 +163,7 @@ void CanvasAsyncBlobCreator::clearSelfReference()
// 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_selfRef.clear();
+ m_keepAlive.clear();
}
void CanvasAsyncBlobCreator::scheduleCreateBlobAndCallOnMainThread()

Powered by Google App Engine
This is Rietveld 408576698