summaryrefslogtreecommitdiffstats
path: root/content/renderer/skia_benchmarking_extension.cc
diff options
context:
space:
mode:
authorfmalita@chromium.org <fmalita@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-31 23:39:26 +0000
committerfmalita@chromium.org <fmalita@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-31 23:39:26 +0000
commit5d554870185442f18e633269a15beb83888446e4 (patch)
treed54e116b940b87ae9b8f73dfe9d14ef8da68b780 /content/renderer/skia_benchmarking_extension.cc
parent21bf3f72a90f043e703f141cd2f130d330a2d1b2 (diff)
downloadchromium_src-5d554870185442f18e633269a15beb83888446e4.zip
chromium_src-5d554870185442f18e633269a15beb83888446e4.tar.gz
chromium_src-5d554870185442f18e633269a15beb83888446e4.tar.bz2
[SkiaBenchmarkingExtension] Handle empty pictures gracefully.
Skia's SkDebugCanvas::drawTo() asserts that the command vector is not empty. We should catch this condition in Rasterize() to avoid crashing on debug builds. BUG=(trace-viewer:493) R=piman@chromium.org, nduca, piman Review URL: https://codereview.chromium.org/47913005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@232236 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/skia_benchmarking_extension.cc')
-rw-r--r--content/renderer/skia_benchmarking_extension.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/content/renderer/skia_benchmarking_extension.cc b/content/renderer/skia_benchmarking_extension.cc
index 3890e98..42ae3b4 100644
--- a/content/renderer/skia_benchmarking_extension.cc
+++ b/content/renderer/skia_benchmarking_extension.cc
@@ -195,10 +195,12 @@ class SkiaBenchmarkingWrapper : public v8::Extension {
// Raster the requested command subset into the bitmap-backed canvas.
int last_index = debug_canvas.getSize() - 1;
- debug_canvas.setOverdrawViz(overdraw);
- debug_canvas.drawTo(&canvas, stop_index < 0
- ? last_index
- : std::min(last_index, stop_index));
+ if (last_index >= 0) {
+ debug_canvas.setOverdrawViz(overdraw);
+ debug_canvas.drawTo(&canvas, stop_index < 0
+ ? last_index
+ : std::min(last_index, stop_index));
+ }
WebKit::WebArrayBuffer buffer =
WebKit::WebArrayBuffer::create(bitmap.getSize(), 1);