summaryrefslogtreecommitdiffstats
path: root/base/gfx
diff options
context:
space:
mode:
authorjoshia@google.com <joshia@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-12 01:17:15 +0000
committerjoshia@google.com <joshia@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-12 01:17:15 +0000
commitb6e4beca3a071606c537af2d55eba21d99769cb0 (patch)
treefa20b394752eb03839814b409a31c01601c9ebb9 /base/gfx
parent799edbdbd3aadc8044bccf4e10bf6a3ebfef1d6b (diff)
downloadchromium_src-b6e4beca3a071606c537af2d55eba21d99769cb0.zip
chromium_src-b6e4beca3a071606c537af2d55eba21d99769cb0.tar.gz
chromium_src-b6e4beca3a071606c537af2d55eba21d99769cb0.tar.bz2
Prevent crash due to DIB allocation failure
Change the way we capture tab thumbnail images so that the capturing code can deal with failure. BUG=3795 Review URL: http://codereview.chromium.org/9717 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5244 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/gfx')
-rwxr-xr-xbase/gfx/platform_canvas_mac.cc16
-rwxr-xr-xbase/gfx/platform_canvas_mac.h3
2 files changed, 10 insertions, 9 deletions
diff --git a/base/gfx/platform_canvas_mac.cc b/base/gfx/platform_canvas_mac.cc
index 102655c..2777dee 100755
--- a/base/gfx/platform_canvas_mac.cc
+++ b/base/gfx/platform_canvas_mac.cc
@@ -14,7 +14,7 @@ PlatformCanvasMac::PlatformCanvasMac() : SkCanvas() {
PlatformCanvasMac::PlatformCanvasMac(int width, int height, bool is_opaque)
: SkCanvas() {
- initialize(width, height, is_opaque, NULL);
+ initialize(width, height, is_opaque);
}
PlatformCanvasMac::PlatformCanvasMac(int width,
@@ -22,20 +22,22 @@ PlatformCanvasMac::PlatformCanvasMac(int width,
bool is_opaque,
CGContextRef context)
: SkCanvas() {
- initialize(width, height, is_opaque, context);
+ initialize(width, height, is_opaque);
}
PlatformCanvasMac::~PlatformCanvasMac() {
}
-void PlatformCanvasMac::initialize(int width,
+bool PlatformCanvasMac::initialize(int width,
int height,
- bool is_opaque,
- CGContextRef context) {
- SkDevice* device =
- createPlatformDevice(width, height, is_opaque, context);
+ bool is_opaque) {
+ SkDevice* device = createPlatformDevice(width, height, is_opaque, NULL);
+ if (!device)
+ return false;
+
setDevice(device);
device->unref(); // was created with refcount 1, and setDevice also refs
+ return true;
}
CGContextRef PlatformCanvasMac::beginPlatformPaint() {
diff --git a/base/gfx/platform_canvas_mac.h b/base/gfx/platform_canvas_mac.h
index 562b1a0..3f79fb3 100755
--- a/base/gfx/platform_canvas_mac.h
+++ b/base/gfx/platform_canvas_mac.h
@@ -28,8 +28,7 @@ class PlatformCanvasMac : public SkCanvas {
virtual ~PlatformCanvasMac();
// For two-part init, call if you use the no-argument constructor above
- void initialize(int width, int height, bool is_opaque, CGContextRef context);
-
+ bool initialize(int width, int height, bool is_opaque);
// These calls should surround calls to platform drawing routines. The CG
// context returned by beginPlatformPaint is the one that can be used to