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

Unified Diff: bench/DeferredSurfaceCopyBench.cpp

Issue 622063003: check for newSurface failure (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/DeferredSurfaceCopyBench.cpp
diff --git a/bench/DeferredSurfaceCopyBench.cpp b/bench/DeferredSurfaceCopyBench.cpp
index cbf98ec8a195c313835d3ebd2b1e552dc3ab2c75..e92e0446e2defbe618c07943c7bb4395def8b058 100644
--- a/bench/DeferredSurfaceCopyBench.cpp
+++ b/bench/DeferredSurfaceCopyBench.cpp
@@ -38,6 +38,12 @@ protected:
const SkRect fullCanvasRect = SkRect::MakeWH(
SkIntToScalar(kSurfaceWidth), SkIntToScalar(kSurfaceHeight));
SkAutoTUnref<SkSurface> surface(canvas->newSurface(info));
+
+ // newSurface() can return NULL for several reasons, so we need to check
+ if (NULL == surface.get()) {
+ return; // should we signal the caller that we hit an error?
mtklein 2014/10/02 19:43:08 Can't hurt to at least log it? SkDebugf("Surface
reed1 2014/10/02 19:53:27 Done.
+ }
+
SkAutoTUnref<SkDeferredCanvas> drawingCanvas(SkDeferredCanvas::Create(surface));
for (int iteration = 0; iteration < loops; iteration++) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698