Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2734)

Unified Diff: base/gfx/platform_canvas_win.h

Issue 9459: Make canvas code a bit more resilient to crashes.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/gfx/bitmap_platform_device_win.cc ('k') | base/gfx/platform_canvas_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/gfx/platform_canvas_win.h
===================================================================
--- base/gfx/platform_canvas_win.h (revision 4621)
+++ base/gfx/platform_canvas_win.h (working copy)
@@ -29,7 +29,7 @@
virtual ~PlatformCanvasWin();
// For two-part init, call if you use the no-argument constructor above
- void initialize(int width, int height, bool is_opaque, HANDLE shared_section);
+ bool initialize(int width, int height, bool is_opaque, HANDLE shared_section);
// These calls should surround calls to platform drawing routines, the DC
// returned by beginPlatformPaint is the DC that can be used to draw into.
@@ -93,11 +93,14 @@
template <class T>
class CanvasPaintT : public T {
public:
- CanvasPaintT(HWND hwnd) : hwnd_(hwnd), for_paint_(true) {
+ CanvasPaintT(HWND hwnd) : hwnd_(hwnd), paint_dc_(NULL), for_paint_(true) {
+ memset(&ps_, 0, sizeof(ps_));
initPaint(true);
}
- CanvasPaintT(HWND hwnd, bool opaque) : hwnd_(hwnd), for_paint_(true) {
+ CanvasPaintT(HWND hwnd, bool opaque) : hwnd_(hwnd), paint_dc_(NULL),
+ for_paint_(true) {
+ memset(&ps_, 0, sizeof(ps_));
initPaint(opaque);
}
@@ -163,8 +166,12 @@
// painting by one pixel so that the boundaries will be correct (ClearType
// text can depend on the adjacent pixel). Then we would paint just the
// inset pixels to the screen.
- initialize(ps_.rcPaint.right - ps_.rcPaint.left,
- ps_.rcPaint.bottom - ps_.rcPaint.top, opaque, NULL);
+ const int width = ps_.rcPaint.right - ps_.rcPaint.left;
+ const int height = ps_.rcPaint.bottom - ps_.rcPaint.top;
+ if (!initialize(width, height, opaque, NULL)) {
+ // Cause a deliberate crash;
+ *(char*) 0 = 0;
+ }
// This will bring the canvas into the screen coordinate system for the
// dirty rect
« no previous file with comments | « base/gfx/bitmap_platform_device_win.cc ('k') | base/gfx/platform_canvas_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698