Chromium Code Reviews| Index: skia/ext/benchmarking_canvas.cc |
| diff --git a/skia/ext/benchmarking_canvas.cc b/skia/ext/benchmarking_canvas.cc |
| index 1160b18cb77299841a2ce194880feb82096ad5b1..de92097a91852fed1f9a6ab61f7cf7b5a1851fea 100644 |
| --- a/skia/ext/benchmarking_canvas.cc |
| +++ b/skia/ext/benchmarking_canvas.cc |
| @@ -18,7 +18,6 @@ |
| #include "third_party/skia/include/core/SkRRect.h" |
| #include "third_party/skia/include/core/SkRegion.h" |
| #include "third_party/skia/include/core/SkString.h" |
| -#include "third_party/skia/include/core/SkTLazy.h" |
| #include "third_party/skia/include/core/SkTextBlob.h" |
| #include "third_party/skia/include/core/SkXfermode.h" |
| @@ -453,14 +452,13 @@ namespace skia { |
| class BenchmarkingCanvas::AutoOp { |
| public: |
| + // AutoOp objects are always scoped within draw call frames, |
| + // so the paint is guaranteed to be valid for their lifetime. |
| AutoOp(BenchmarkingCanvas* canvas, const char op_name[], |
| const SkPaint* paint = nullptr) |
| : canvas_(canvas) |
| , op_record_(new base::DictionaryValue()) |
| - , op_params_(new base::ListValue()) |
| - // AutoOp objects are always scoped within draw call frames, |
| - // so the paint is guaranteed to be valid for their lifetime. |
| - , paint_(paint) { |
| + , op_params_(new base::ListValue()) { |
| DCHECK(canvas); |
| DCHECK(op_name); |
| @@ -468,15 +466,19 @@ public: |
| op_record_->SetString("cmd_string", op_name); |
| op_record_->Set("info", op_params_); |
| - if (paint) |
| + if (paint) { |
| this->addParam("paint", AsValue(*paint)); |
| + filtered_paint_ = *paint; |
| + } else { |
| + filtered_paint_ = SkPaint(); |
|
bungeman-chromium
2016/04/27 19:59:34
I don't think we need this else clause, the filter
|
| + } |
| + |
| if (canvas->flags_ & kOverdrawVisualization_Flag) { |
| DCHECK(canvas->overdraw_xfermode_); |
| - paint_ = paint ? filtered_paint_.set(*paint) : filtered_paint_.init(); |
| - filtered_paint_.get()->setXfermode(canvas->overdraw_xfermode_); |
| - filtered_paint_.get()->setAntiAlias(false); |
| + filtered_paint_.setXfermode(canvas->overdraw_xfermode_); |
| + filtered_paint_.setAntiAlias(false); |
| } |
| start_ticks_ = base::TimeTicks::Now(); |
| @@ -496,7 +498,7 @@ public: |
| op_params_->Append(param.release()); |
| } |
| - const SkPaint* paint() const { return paint_; } |
| + const SkPaint* paint() const { return &filtered_paint_; } |
| private: |
| BenchmarkingCanvas* canvas_; |
| @@ -504,8 +506,7 @@ private: |
| base::ListValue* op_params_; |
| base::TimeTicks start_ticks_; |
| - const SkPaint* paint_; |
| - SkTLazy<SkPaint> filtered_paint_; |
| + SkPaint filtered_paint_; |
| }; |
| BenchmarkingCanvas::BenchmarkingCanvas(SkCanvas* canvas, unsigned flags) |