summaryrefslogtreecommitdiffstats
path: root/chrome/plugin
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-27 16:13:48 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-27 16:13:48 +0000
commit5e2ce9a6e9a7f5a352ba7de02947beb86d06f1d5 (patch)
treef43722217213fe93c229c9b025ecf89487862733 /chrome/plugin
parent8b386cede11a8a5c907b5a75271c7edee12f1774 (diff)
downloadchromium_src-5e2ce9a6e9a7f5a352ba7de02947beb86d06f1d5.zip
chromium_src-5e2ce9a6e9a7f5a352ba7de02947beb86d06f1d5.tar.gz
chromium_src-5e2ce9a6e9a7f5a352ba7de02947beb86d06f1d5.tar.bz2
Make the web plugin proxy tolerant of windowless bitmap memory mapping failures.
These seem to be happening at a low frequency, and can be a result of being out of memory or using too many GDI resources (I think). By catching the error and clearing the canvas pointers, we won't crash and will just skip drawing the plugin. TEST=none BUG=25689 Review URL: http://codereview.chromium.org/332033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30201 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/plugin')
-rw-r--r--chrome/plugin/webplugin_proxy.cc39
1 files changed, 26 insertions, 13 deletions
diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc
index 4e86173..16fb1ee 100644
--- a/chrome/plugin/webplugin_proxy.cc
+++ b/chrome/plugin/webplugin_proxy.cc
@@ -455,20 +455,33 @@ void WebPluginProxy::UpdateGeometry(
void WebPluginProxy::SetWindowlessBuffer(
const TransportDIB::Handle& windowless_buffer,
const TransportDIB::Handle& background_buffer) {
- // Create a canvas that will reference the shared bits.
- windowless_canvas_.reset(new skia::PlatformCanvas(
- delegate_->GetRect().width(),
- delegate_->GetRect().height(),
- true,
- win_util::GetSectionFromProcess(windowless_buffer,
- channel_->renderer_handle(), false)));
+ // Create a canvas that will reference the shared bits. We have to handle
+ // errors here since we're mapping a large amount of memory that may not fit
+ // in our address space, or go wrong in some other way.
+ windowless_canvas_.reset(new skia::PlatformCanvas);
+ if (!windowless_canvas_->initialize(
+ delegate_->GetRect().width(),
+ delegate_->GetRect().height(),
+ true,
+ win_util::GetSectionFromProcess(windowless_buffer,
+ channel_->renderer_handle(), false))) {
+ windowless_canvas_.reset();
+ background_canvas_.reset();
+ return;
+ }
+
if (background_buffer) {
- background_canvas_.reset(new skia::PlatformCanvas(
- delegate_->GetRect().width(),
- delegate_->GetRect().height(),
- true,
- win_util::GetSectionFromProcess(background_buffer,
- channel_->renderer_handle(), false)));
+ background_canvas_.reset(new skia::PlatformCanvas);
+ if (!background_canvas_->initialize(
+ delegate_->GetRect().width(),
+ delegate_->GetRect().height(),
+ true,
+ win_util::GetSectionFromProcess(background_buffer,
+ channel_->renderer_handle(), false))) {
+ windowless_canvas_.reset();
+ background_canvas_.reset();
+ return;
+ }
}
}