summaryrefslogtreecommitdiffstats
path: root/webkit/tools/test_shell/test_shell_win.cc
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 /webkit/tools/test_shell/test_shell_win.cc
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 'webkit/tools/test_shell/test_shell_win.cc')
-rw-r--r--webkit/tools/test_shell/test_shell_win.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/webkit/tools/test_shell/test_shell_win.cc b/webkit/tools/test_shell/test_shell_win.cc
index 0ca297ab..bd0d557 100644
--- a/webkit/tools/test_shell/test_shell_win.cc
+++ b/webkit/tools/test_shell/test_shell_win.cc
@@ -116,8 +116,11 @@ ATOM TestShell::RegisterWindowClass() {
// static
std::string TestShell::DumpImage(WebFrame* web_frame,
const std::wstring& file_name) {
- gfx::BitmapPlatformDevice device(web_frame->CaptureImage(true));
- const SkBitmap& src_bmp = device.accessBitmap(false);
+ scoped_ptr<gfx::BitmapPlatformDevice> device;
+ if (!web_frame->CaptureImage(&device, true))
+ return std::string();
+
+ const SkBitmap& src_bmp = device->accessBitmap(false);
// Encode image.
std::vector<unsigned char> png;