summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/webplugin_delegate_proxy.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 /chrome/renderer/webplugin_delegate_proxy.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 'chrome/renderer/webplugin_delegate_proxy.cc')
-rw-r--r--chrome/renderer/webplugin_delegate_proxy.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc
index 67dcce2..efceffb 100644
--- a/chrome/renderer/webplugin_delegate_proxy.cc
+++ b/chrome/renderer/webplugin_delegate_proxy.cc
@@ -400,12 +400,18 @@ bool WebPluginDelegateProxy::CreateBitmap(
scoped_ptr<SharedMemory>* memory,
scoped_ptr<gfx::PlatformCanvasWin>* canvas) {
size_t size = GetPaintBufSize(plugin_rect_);
- memory->reset(new SharedMemory());
- if (!(*memory)->Create(L"", false, true, size))
+ scoped_ptr<SharedMemory> new_shared_memory(new SharedMemory());
+ if (!new_shared_memory->Create(L"", false, true, size))
return false;
- canvas->reset(new gfx::PlatformCanvasWin(
- plugin_rect_.width(), plugin_rect_.height(), true, (*memory)->handle()));
+ scoped_ptr<gfx::PlatformCanvasWin> new_canvas(new gfx::PlatformCanvasWin);
+ if (!new_canvas->initialize(plugin_rect_.width(), plugin_rect_.height(),
+ true, new_shared_memory->handle())) {
+ return false;
+ }
+
+ memory->swap(new_shared_memory);
+ canvas->swap(new_canvas);
return true;
}