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

Side by Side Diff: skia/ext/platform_canvas_win.cc

Issue 9416017: Optionally clear PlatformCanvas instances. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Address style issues. Created 8 years, 10 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <windows.h> 5 #include <windows.h>
6 #include <psapi.h> 6 #include <psapi.h>
7 7
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "skia/ext/bitmap_platform_device_win.h" 9 #include "skia/ext/bitmap_platform_device_win.h"
10 #include "skia/ext/platform_canvas.h" 10 #include "skia/ext/platform_canvas.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 // unlike its cousin CrashForBitmapAllocationFailure() it tries to detect if 66 // unlike its cousin CrashForBitmapAllocationFailure() it tries to detect if
67 // the issue was a non-valid shared bitmap handle. 67 // the issue was a non-valid shared bitmap handle.
68 void CrashIfInvalidSection(HANDLE shared_section) { 68 void CrashIfInvalidSection(HANDLE shared_section) {
69 DWORD handle_info = 0; 69 DWORD handle_info = 0;
70 COF(8, ::GetHandleInformation(shared_section, &handle_info) == TRUE); 70 COF(8, ::GetHandleInformation(shared_section, &handle_info) == TRUE);
71 } 71 }
72 72
73 // Restore the optimization options. 73 // Restore the optimization options.
74 #pragma optimize("", on) 74 #pragma optimize("", on)
75 75
76 PlatformCanvas::PlatformCanvas(int width, int height, bool is_opaque) { 76 PlatformCanvas::PlatformCanvas(int width, int height, int flags) {
77 TRACE_EVENT2("skia", "PlatformCanvas::PlatformCanvas", 77 TRACE_EVENT2("skia", "PlatformCanvas::PlatformCanvas",
78 "width", width, "height", height); 78 "width", width, "height", height);
79 initialize(width, height, is_opaque, NULL); 79 initialize(width, height, flags, NULL);
80 } 80 }
81 81
82 PlatformCanvas::PlatformCanvas(int width, 82 PlatformCanvas::PlatformCanvas(int width,
83 int height, 83 int height,
84 bool is_opaque, 84 int flags,
85 HANDLE shared_section) { 85 HANDLE shared_section) {
86 TRACE_EVENT2("skia", "PlatformCanvas::PlatformCanvas", 86 TRACE_EVENT2("skia", "PlatformCanvas::PlatformCanvas",
87 "width", width, "height", height); 87 "width", width, "height", height);
88 initialize(width, height, is_opaque, shared_section); 88 initialize(width, height, flags, shared_section);
89 } 89 }
90 90
91 PlatformCanvas::~PlatformCanvas() { 91 PlatformCanvas::~PlatformCanvas() {
92 } 92 }
93 93
94 bool PlatformCanvas::initialize(int width, 94 bool PlatformCanvas::initialize(int width,
95 int height, 95 int height,
96 bool is_opaque, 96 int flags,
97 HANDLE shared_section) { 97 HANDLE shared_section) {
98 if (initializeWithDevice(BitmapPlatformDevice::create(width, 98 if (initializeWithDevice(BitmapPlatformDevice::create(width,
99 height, 99 height,
100 is_opaque, 100 flags,
101 shared_section))) 101 shared_section)))
102 return true; 102 return true;
103 // Investigate we failed. If we know the reason, crash in a specific place. 103 // Investigate we failed. If we know the reason, crash in a specific place.
104 unsigned int error = GetLastError(); 104 unsigned int error = GetLastError();
105 if (shared_section) 105 if (shared_section)
106 CrashIfInvalidSection(shared_section); 106 CrashIfInvalidSection(shared_section);
107 CrashForBitmapAllocationFailure(width, height, error); 107 CrashForBitmapAllocationFailure(width, height, error);
108 return false; 108 return false;
109 } 109 }
110 110
111 } // namespace skia 111 } // namespace skia
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698