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

Unified Diff: tools/bbh_shootout.cpp

Issue 19780004: Fix segfault in bbh_shootout (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 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: tools/bbh_shootout.cpp
diff --git a/tools/bbh_shootout.cpp b/tools/bbh_shootout.cpp
index 4a3d7650aed560e8950d9a7fa263d16a649a1e66..24d7b865006e484e82e5bc5a68fbfad8c2e79926 100644
--- a/tools/bbh_shootout.cpp
+++ b/tools/bbh_shootout.cpp
@@ -14,6 +14,7 @@
#include "SkGraphics.h"
#include "SkStream.h"
#include "SkString.h"
+#include "SkTArray.h"
#include "TimerData.h"
static const int kNumNormalRecordings = SkBENCHLOOP(10);
@@ -265,8 +266,7 @@ static bool benchmark_loop(
int argc,
char **argv,
const BenchmarkControl& benchControl,
- Histogram** histogram) {
-
+ SkTArray<Histogram>& histogram) {
static const SkString timeFormat("%f");
TimerData timerData(timeFormat, timeFormat);
for (int index = 1; index < argc; ++index) {
@@ -280,8 +280,8 @@ static bool benchmark_loop(
benchControl.fFunction(benchControl.fType, benchControl.fTileSize, path, pic, &timer);
timerData.appendTimes(&timer, argc - 1 == index);
- histogram[index - 1]->fPath = path;
- histogram[index - 1]->fCpuTime = SkDoubleToScalar(timer.fCpu);
+ histogram[index - 1].fPath = path;
+ histogram[index - 1].fCpuTime = SkDoubleToScalar(timer.fCpu);
}
const SkString timerResult = timerData.getResult(
@@ -321,14 +321,14 @@ int tool_main(int argc, char** argv) {
return -1;
}
- Histogram* histograms[kNumBenchmarks];
+ SkTArray<Histogram> histograms[kNumBenchmarks];
for (size_t i = 0; i < kNumBenchmarks; ++i) {
- histograms[i] = SkNEW_ARRAY(Histogram, argc - 1);
+ histograms[i].reset(argc - 1);
bool success = benchmark_loop(
argc, argv,
BenchmarkControl::Make(i),
- &histograms[i]);
+ histograms[i]);
if (!success) {
SkDebugf("benchmark_loop failed at index %d", i);
}
« 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