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

Unified Diff: src/pdf/SkPDFDevice.h

Issue 1774633002: SkPDF Create working move constructor for inner classes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | src/pdf/SkPDFDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFDevice.h
diff --git a/src/pdf/SkPDFDevice.h b/src/pdf/SkPDFDevice.h
index d38f282bb0702c6bcbd31201f363eba662a65a1e..310807d86ec4e54c1525519c2e7959e9599cadc0 100644
--- a/src/pdf/SkPDFDevice.h
+++ b/src/pdf/SkPDFDevice.h
@@ -202,18 +202,30 @@ protected:
private:
struct RectWithData {
SkRect rect;
- SkData* data;
+ sk_sp<SkData> data;
RectWithData(const SkRect& rect, SkData* data)
: rect(rect), data(SkRef(data)) {}
- ~RectWithData() { data->unref(); }
+ RectWithData(RectWithData&& other)
reed1 2016/03/07 20:47:42 Seems like these are explicitly written (as oppose
+ : rect(other.rect), data(std::move(other.data)) {}
+ RectWithData& operator=(RectWithData&& other) {
+ rect = other.rect;
+ data = std::move(other.data);
+ return *this;
+ }
};
struct NamedDestination {
- SkData* nameData;
+ sk_sp<SkData> nameData;
SkPoint point;
NamedDestination(SkData* nameData, const SkPoint& point)
: nameData(SkRef(nameData)), point(point) {}
- ~NamedDestination() { nameData->unref(); }
+ NamedDestination(NamedDestination&& other)
+ : nameData(std::move(other.nameData)), point(other.point) {}
+ NamedDestination& operator=(NamedDestination&& other) {
+ nameData = std::move(other.nameData);
+ point = other.point;
+ return *this;
+ }
};
// TODO(vandebo): push most of SkPDFDevice's state into a core object in
« no previous file with comments | « no previous file | src/pdf/SkPDFDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698