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

Unified Diff: Source/core/html/ImageData.cpp

Issue 1084313004: Oilpan: keep ImageData on the heap by default. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Ensure timely disposal of temporary ImageData buffers Created 5 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
« no previous file with comments | « Source/core/html/ImageData.h ('k') | Source/core/html/ImageData.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/ImageData.cpp
diff --git a/Source/core/html/ImageData.cpp b/Source/core/html/ImageData.cpp
index 45de50a575022064f03582ba98d8c658bb9f848b..66b62ffe04950d7400cb242a80871f4918dcdb2a 100644
--- a/Source/core/html/ImageData.cpp
+++ b/Source/core/html/ImageData.cpp
@@ -36,7 +36,7 @@
namespace blink {
-PassRefPtrWillBeRawPtr<ImageData> ImageData::create(const IntSize& size)
+ImageData* ImageData::create(const IntSize& size)
{
Checked<int, RecordOverflow> dataSize = 4;
dataSize *= size.width();
@@ -44,10 +44,10 @@ PassRefPtrWillBeRawPtr<ImageData> ImageData::create(const IntSize& size)
if (dataSize.hasOverflowed())
return nullptr;
- return adoptRefWillBeNoop(new ImageData(size));
+ return new ImageData(size);
}
-PassRefPtrWillBeRawPtr<ImageData> ImageData::create(const IntSize& size, PassRefPtr<DOMUint8ClampedArray> byteArray)
+ImageData* ImageData::create(const IntSize& size, PassRefPtr<DOMUint8ClampedArray> byteArray)
{
Checked<int, RecordOverflow> dataSize = 4;
dataSize *= size.width();
@@ -59,10 +59,10 @@ PassRefPtrWillBeRawPtr<ImageData> ImageData::create(const IntSize& size, PassRef
|| static_cast<unsigned>(dataSize.unsafeGet()) > byteArray->length())
return nullptr;
- return adoptRefWillBeNoop(new ImageData(size, byteArray));
+ return new ImageData(size, byteArray);
}
-PassRefPtrWillBeRawPtr<ImageData> ImageData::create(unsigned width, unsigned height, ExceptionState& exceptionState)
+ImageData* ImageData::create(unsigned width, unsigned height, ExceptionState& exceptionState)
{
if (!RuntimeEnabledFeatures::imageDataConstructorEnabled()) {
exceptionState.throwTypeError("Illegal constructor");
@@ -81,7 +81,7 @@ PassRefPtrWillBeRawPtr<ImageData> ImageData::create(unsigned width, unsigned hei
return nullptr;
}
- return adoptRefWillBeNoop(new ImageData(IntSize(width, height)));
+ return new ImageData(IntSize(width, height));
}
bool ImageData::validateConstructorArguments(DOMUint8ClampedArray* data, unsigned width, unsigned& lengthInPixels, ExceptionState& exceptionState)
@@ -109,7 +109,7 @@ bool ImageData::validateConstructorArguments(DOMUint8ClampedArray* data, unsigne
return true;
}
-PassRefPtrWillBeRawPtr<ImageData> ImageData::create(DOMUint8ClampedArray* data, unsigned width, ExceptionState& exceptionState)
+ImageData* ImageData::create(DOMUint8ClampedArray* data, unsigned width, ExceptionState& exceptionState)
{
if (!RuntimeEnabledFeatures::imageDataConstructorEnabled()) {
exceptionState.throwTypeError("Illegal constructor");
@@ -122,10 +122,10 @@ PassRefPtrWillBeRawPtr<ImageData> ImageData::create(DOMUint8ClampedArray* data,
}
ASSERT(lengthInPixels && width);
unsigned height = lengthInPixels / width;
- return adoptRefWillBeNoop(new ImageData(IntSize(width, height), data));
+ return new ImageData(IntSize(width, height), data);
}
-PassRefPtrWillBeRawPtr<ImageData> ImageData::create(DOMUint8ClampedArray* data, unsigned width, unsigned height, ExceptionState& exceptionState)
+ImageData* ImageData::create(DOMUint8ClampedArray* data, unsigned width, unsigned height, ExceptionState& exceptionState)
{
if (!RuntimeEnabledFeatures::imageDataConstructorEnabled()) {
exceptionState.throwTypeError("Illegal constructor");
@@ -141,7 +141,7 @@ PassRefPtrWillBeRawPtr<ImageData> ImageData::create(DOMUint8ClampedArray* data,
exceptionState.throwDOMException(IndexSizeError, "The input data byte length is not equal to (4 * width * height).");
return nullptr;
}
- return adoptRefWillBeNoop(new ImageData(IntSize(width, height), data));
+ return new ImageData(IntSize(width, height), data);
}
v8::Local<v8::Object> ImageData::associateWithWrapper(v8::Isolate* isolate, const WrapperTypeInfo* wrapperType, v8::Local<v8::Object> wrapper)
@@ -172,4 +172,9 @@ ImageData::ImageData(const IntSize& size, PassRefPtr<DOMUint8ClampedArray> byteA
ASSERT_WITH_SECURITY_IMPLICATION(static_cast<unsigned>(size.width() * size.height() * 4) <= m_data->length());
}
+void ImageData::dispose()
+{
+ m_data.clear();
+}
+
} // namespace blink
« no previous file with comments | « Source/core/html/ImageData.h ('k') | Source/core/html/ImageData.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698