Fix visual bench memory leak
BUG=skia: Review URL: https://codereview.chromium.org/1239103002
This commit is contained in:
parent
ef14cb397c
commit
47d280d3b0
@ -163,10 +163,7 @@ bool VisualBench::advanceRecordIfNecessary(SkCanvas* canvas) {
|
||||
return true;
|
||||
}
|
||||
|
||||
while ((fBenchmark = fBenchmarkStream->next()) &&
|
||||
(SkCommandLineFlags::ShouldSkip(FLAGS_match, fBenchmark->getUniqueName()) ||
|
||||
!fBenchmark->isSuitableFor(Benchmark::kGPU_Backend))) {}
|
||||
|
||||
fBenchmark.reset(fBenchmarkStream->next());
|
||||
if (!fBenchmark) {
|
||||
return false;
|
||||
}
|
||||
@ -238,7 +235,7 @@ void VisualBench::draw(SkCanvas* canvas) {
|
||||
fState = kPreWarmLoops_State;
|
||||
this->printStats();
|
||||
fBenchmark->perCanvasPostDraw(canvas);
|
||||
fBenchmark = NULL;
|
||||
fBenchmark.reset(NULL);
|
||||
fCurrentSample = 0;
|
||||
fFlushes = 1;
|
||||
fLoops = 1;
|
||||
|
@ -68,7 +68,7 @@ private:
|
||||
WallTimer fTimer;
|
||||
State fState;
|
||||
SkAutoTDelete<VisualBenchmarkStream> fBenchmarkStream;
|
||||
Benchmark* fBenchmark;
|
||||
SkAutoTUnref<Benchmark> fBenchmark;
|
||||
|
||||
// support framework
|
||||
SkAutoTUnref<SkSurface> fSurface;
|
||||
|
@ -68,7 +68,9 @@ Benchmark* VisualBenchmarkStream::next() {
|
||||
Benchmark* bench;
|
||||
// skips non matching benches
|
||||
while ((bench = this->innerNext()) &&
|
||||
SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getUniqueName())) {
|
||||
(SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getUniqueName()) ||
|
||||
!bench->isSuitableFor(Benchmark::kGPU_Backend))) {
|
||||
bench->unref();
|
||||
}
|
||||
return bench;
|
||||
}
|
||||
@ -82,6 +84,7 @@ Benchmark* VisualBenchmarkStream::innerNext() {
|
||||
fBenchType = "micro";
|
||||
return bench;
|
||||
}
|
||||
bench->unref();
|
||||
}
|
||||
|
||||
while (fGMs) {
|
||||
|
Loading…
Reference in New Issue
Block a user