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

Unified Diff: bench/DeferredSurfaceCopyBench.cpp

Issue 622063003: check for newSurface failure (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add debugf 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..e1c3e3b50683bf6a69abe028646cc61b72d7057c 100644
--- a/bench/DeferredSurfaceCopyBench.cpp
+++ b/bench/DeferredSurfaceCopyBench.cpp
@@ -38,6 +38,13 @@ 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()) {
+ SkDebugf("DeferredSurfaceCopyBench newSurface failed, bench results are meaningless\n");
+ return; // should we signal the caller that we hit an error?
+ }
+
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