Title: [125605] trunk/Source/WebCore
Revision
125605
Author
commit-qu...@webkit.org
Date
2012-08-14 14:20:01 -0700 (Tue, 14 Aug 2012)

Log Message

[BlackBerry] Don't crash on OOM in AC
https://bugs.webkit.org/show_bug.cgi?id=93999

Patch by Filip Spacek <fspa...@rim.com> on 2012-08-14
Reviewed by George Staikos.

Internally reviewed by George Staikos.

Fail gracefully in case we fail to allocate the bitmap
for the AC layer contents.

* platform/graphics/blackberry/InstrumentedPlatformCanvas.h:
(WebCore::InstrumentedPlatformCanvas::InstrumentedPlatformCanvas):
* platform/graphics/blackberry/LayerWebKitThread.cpp:
(WebCore::LayerWebKitThread::paintContents):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (125604 => 125605)


--- trunk/Source/WebCore/ChangeLog	2012-08-14 21:16:08 UTC (rev 125604)
+++ trunk/Source/WebCore/ChangeLog	2012-08-14 21:20:01 UTC (rev 125605)
@@ -1,3 +1,20 @@
+2012-08-14  Filip Spacek  <fspa...@rim.com>
+
+        [BlackBerry] Don't crash on OOM in AC
+        https://bugs.webkit.org/show_bug.cgi?id=93999
+
+        Reviewed by George Staikos.
+
+        Internally reviewed by George Staikos.
+
+        Fail gracefully in case we fail to allocate the bitmap
+        for the AC layer contents.
+
+        * platform/graphics/blackberry/InstrumentedPlatformCanvas.h:
+        (WebCore::InstrumentedPlatformCanvas::InstrumentedPlatformCanvas):
+        * platform/graphics/blackberry/LayerWebKitThread.cpp:
+        (WebCore::LayerWebKitThread::paintContents):
+
 2012-08-14  Lauro Neto  <lauro.n...@openbossa.org>
 
         Convert signals/slots to Q_* macros.

Modified: trunk/Source/WebCore/platform/graphics/blackberry/InstrumentedPlatformCanvas.h (125604 => 125605)


--- trunk/Source/WebCore/platform/graphics/blackberry/InstrumentedPlatformCanvas.h	2012-08-14 21:16:08 UTC (rev 125604)
+++ trunk/Source/WebCore/platform/graphics/blackberry/InstrumentedPlatformCanvas.h	2012-08-14 21:20:01 UTC (rev 125605)
@@ -36,12 +36,12 @@
 
 class InstrumentedPlatformCanvas : public SkCanvas {
 public:
-    InstrumentedPlatformCanvas(int width, int height)
-        : m_size(width, height)
+    InstrumentedPlatformCanvas(const SkBitmap& bitmap)
+        : m_size(bitmap.width(), bitmap.height())
         , m_isSolidColor(true)
         , m_solidColor(0, 0, 0, 0)
     {
-        setDevice(new SkDevice(SkBitmap::kARGB_8888_Config, width, height))->unref();
+        setDevice(new SkDevice(bitmap))->unref();
     }
 
     virtual ~InstrumentedPlatformCanvas() { }

Modified: trunk/Source/WebCore/platform/graphics/blackberry/LayerWebKitThread.cpp (125604 => 125605)


--- trunk/Source/WebCore/platform/graphics/blackberry/LayerWebKitThread.cpp	2012-08-14 21:16:08 UTC (rev 125604)
+++ trunk/Source/WebCore/platform/graphics/blackberry/LayerWebKitThread.cpp	2012-08-14 21:20:01 UTC (rev 125605)
@@ -110,7 +110,14 @@
     if (drawsContent()) { // Layer contents must be drawn into a canvas.
         IntRect untransformedContentsRect = contentsRect;
 
-        canvas = adoptPtr(new InstrumentedPlatformCanvas(contentsRect.width(), contentsRect.height()));
+        SkBitmap canvasBitmap;
+        canvasBitmap.setConfig(SkBitmap::kARGB_8888_Config, contentsRect.width(), contentsRect.height());
+        if (!canvasBitmap.allocPixels())
+            return SkBitmap();
+        canvasBitmap.setIsOpaque(false);
+        canvasBitmap.eraseColor(0);
+
+        canvas = adoptPtr(new InstrumentedPlatformCanvas(canvasBitmap));
         PlatformContextSkia skiaContext(canvas.get());
 
         GraphicsContext graphicsContext(&skiaContext);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to