Modified: trunk/Source/WebCore/ChangeLog (193911 => 193912)
--- trunk/Source/WebCore/ChangeLog 2015-12-10 17:41:45 UTC (rev 193911)
+++ trunk/Source/WebCore/ChangeLog 2015-12-10 18:03:52 UTC (rev 193912)
@@ -1,3 +1,17 @@
+2015-12-10 Commit Queue <commit-qu...@webkit.org>
+
+ Unreviewed, rolling out r193500.
+ https://bugs.webkit.org/show_bug.cgi?id=152143
+
+ do not want to have to disable canvas-to-large-to-draw test
+ (Requested by bfulgham on #webkit).
+
+ Reverted changeset:
+
+ "Place an upper bound on canvas pixel count"
+ https://bugs.webkit.org/show_bug.cgi?id=151825
+ http://trac.webkit.org/changeset/193500
+
2015-12-10 Brady Eidson <beid...@apple.com>
Followup for:
Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (193911 => 193912)
--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp 2015-12-10 17:41:45 UTC (rev 193911)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp 2015-12-10 18:03:52 UTC (rev 193912)
@@ -47,7 +47,6 @@
#include "ScriptController.h"
#include "Settings.h"
#include <math.h>
-#include <wtf/RAMSize.h>
#include <runtime/JSCInlines.h>
#include <runtime/JSLock.h>
@@ -76,8 +75,6 @@
static const unsigned MaxCanvasArea = 16384 * 16384;
#endif
-static size_t activePixelMemory = 0;
-
HTMLCanvasElement::HTMLCanvasElement(const QualifiedName& tagName, Document& document)
: HTMLElement(tagName, document)
, m_size(DefaultWidth, DefaultHeight)
@@ -100,25 +97,12 @@
return adoptRef(*new HTMLCanvasElement(tagName, document));
}
-static void removeFromActivePixelMemory(size_t pixelsReleased)
-{
- if (!pixelsReleased)
- return;
-
- if (pixelsReleased < activePixelMemory)
- activePixelMemory -= pixelsReleased;
- else
- activePixelMemory = 0;
-}
-
HTMLCanvasElement::~HTMLCanvasElement()
{
for (auto& observer : m_observers)
observer->canvasDestroyed(*this);
m_context = nullptr; // Ensure this goes away before the ImageBuffer.
-
- releaseImageBufferAndContext();
}
void HTMLCanvasElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
@@ -195,16 +179,6 @@
}
#endif
-static inline size_t maxActivePixelMemory()
-{
- static size_t maxPixelMemory;
- static std::once_flag onceFlag;
- std::call_once(onceFlag, [] {
- maxPixelMemory = std::max(ramSize() / 4, 1024 * MB);
- });
- return maxPixelMemory;
-}
-
CanvasRenderingContext* HTMLCanvasElement::getContext(const String& type, CanvasContextAttributes* attrs)
{
// A Canvas can either be "2D" or "webgl" but never both. If you request a 2D canvas and the existing
@@ -224,10 +198,6 @@
if (Settings* settings = document().settings())
usesDashbardCompatibilityMode = settings->usesDashboardBackwardCompatibilityMode();
#endif
- size_t requestedPixelMemory = 4 * width() * height();
- if (activePixelMemory + requestedPixelMemory > maxActivePixelMemory())
- return nullptr;
-
m_context = std::make_unique<CanvasRenderingContext2D>(this, document().inQuirksMode(), usesDashbardCompatibilityMode);
#if USE(IOSURFACE_CANVAS_BACKING_STORE) || ENABLE(ACCELERATED_2D_CANVAS)
// Need to make sure a RenderLayer and compositing layer get created for the Canvas
@@ -456,17 +426,12 @@
m_presentedImage = nullptr;
}
-void HTMLCanvasElement::releaseImageBufferAndContext()
-{
- m_contextStateSaver = nullptr;
- setImageBuffer(nullptr);
-}
-
void HTMLCanvasElement::setSurfaceSize(const IntSize& size)
{
m_size = size;
m_hasCreatedImageBuffer = false;
- releaseImageBufferAndContext();
+ m_contextStateSaver = nullptr;
+ m_imageBuffer.reset();
clearCopiedImage();
}
@@ -606,25 +571,13 @@
document().addConsoleMessage(MessageSource::JS, MessageLevel::Warning, stringBuilder.toString());
return;
}
-
- // Make sure we don't use more pixel memory than the system can support.
- size_t requestedPixelMemory = 4 * width() * height();
- if (activePixelMemory + requestedPixelMemory > maxActivePixelMemory()) {
- StringBuilder stringBuilder;
- stringBuilder.appendLiteral("Total canvas memory use exceeds the maximum limit (");
- stringBuilder.appendNumber(maxActivePixelMemory() / 1024 / 1024);
- stringBuilder.appendLiteral(" MB).");
- document().addConsoleMessage(MessageSource::JS, MessageLevel::Warning, stringBuilder.toString());
- return;
- }
IntSize bufferSize(deviceSize.width(), deviceSize.height());
if (!bufferSize.width() || !bufferSize.height())
return;
RenderingMode renderingMode = shouldAccelerate(bufferSize) ? Accelerated : Unaccelerated;
-
- setImageBuffer(ImageBuffer::create(size(), renderingMode));
+ m_imageBuffer = ImageBuffer::create(size(), renderingMode);
if (!m_imageBuffer)
return;
m_imageBuffer->context().setShadowsIgnoreTransforms(true);
@@ -644,15 +597,6 @@
#endif
}
-void HTMLCanvasElement::setImageBuffer(std::unique_ptr<ImageBuffer> buffer) const
-{
- removeFromActivePixelMemory(memoryCost());
-
- m_imageBuffer = WTF::move(buffer);
-
- activePixelMemory += memoryCost();
-}
-
GraphicsContext* HTMLCanvasElement::drawingContext() const
{
return buffer() ? &m_imageBuffer->context() : nullptr;
Modified: trunk/Source/WebCore/html/HTMLCanvasElement.h (193911 => 193912)
--- trunk/Source/WebCore/html/HTMLCanvasElement.h 2015-12-10 17:41:45 UTC (rev 193911)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.h 2015-12-10 18:03:52 UTC (rev 193912)
@@ -152,8 +152,6 @@
void clearImageBuffer() const;
void setSurfaceSize(const IntSize&);
- void setImageBuffer(std::unique_ptr<ImageBuffer>) const;
- void releaseImageBufferAndContext();
bool paintsIntoCanvasBuffer() const;