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

Unified Diff: skia/ext/benchmarking_canvas.cc

Issue 1925433002: Replace SkTLazy with base::Optional (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: No Optional Created 4 years, 8 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
« cc/playback/image_hijack_canvas.cc ('K') | « cc/playback/raster_source.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« cc/playback/image_hijack_canvas.cc ('K') | « cc/playback/raster_source.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698