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

Unified Diff: cc/playback/image_hijack_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
« no previous file with comments | « no previous file | cc/playback/raster_source.cc » ('j') | skia/ext/benchmarking_canvas.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/playback/image_hijack_canvas.cc
diff --git a/cc/playback/image_hijack_canvas.cc b/cc/playback/image_hijack_canvas.cc
index f0fc139ed6d32b821141bdcdc41c368e2e498a1b..79460b56e88d608e1379b2ece5094d685810b8cd 100644
--- a/cc/playback/image_hijack_canvas.cc
+++ b/cc/playback/image_hijack_canvas.cc
@@ -4,9 +4,9 @@
#include "cc/playback/image_hijack_canvas.h"
+#include "base/optional.h"
#include "cc/playback/discardable_image_map.h"
#include "cc/tiles/image_decode_controller.h"
-#include "third_party/skia/include/core/SkTLazy.h"
namespace cc {
namespace {
@@ -32,9 +32,10 @@ class ScopedDecodedImageLock {
decoded_draw_image_(
image_decode_controller_->GetDecodedImageForDraw(draw_image_)) {
DCHECK(draw_image_.image()->isLazyGenerated());
- if (paint)
- decoded_paint_.set(*paint)->setFilterQuality(
- decoded_draw_image_.filter_quality());
+ if (paint) {
+ decoded_paint_ = *paint;
+ decoded_paint_->setFilterQuality(decoded_draw_image_.filter_quality());
+ }
}
~ScopedDecodedImageLock() {
@@ -43,14 +44,15 @@ class ScopedDecodedImageLock {
}
const DecodedDrawImage& decoded_image() const { return decoded_draw_image_; }
- const SkPaint* decoded_paint() const { return decoded_paint_.getMaybeNull(); }
+ const SkPaint* decoded_paint() const {
+ return decoded_paint_ ? &(*decoded_paint_) : nullptr;
bungeman-chromium 2016/04/27 19:59:34 danakj wanted this to just look like &*decoded_pai
+ }
private:
ImageDecodeController* image_decode_controller_;
DrawImage draw_image_;
DecodedDrawImage decoded_draw_image_;
- // TODO(fmalita): use base::Optional when it becomes available
- SkTLazy<SkPaint> decoded_paint_;
+ base::Optional<SkPaint> decoded_paint_;
};
} // namespace
« no previous file with comments | « no previous file | cc/playback/raster_source.cc » ('j') | skia/ext/benchmarking_canvas.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698