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

Unified Diff: samplecode/SampleAnimator.cpp

Issue 2339273002: SkFontData to use smart pointers. (Closed)
Patch Set: SkStream::MakeFromFile as well. Created 4 years, 3 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
Index: samplecode/SampleAnimator.cpp
diff --git a/samplecode/SampleAnimator.cpp b/samplecode/SampleAnimator.cpp
index d4a4cdd2887f150c405310f742b67f65c9ec494e..a3ec83afe673968e45d09a91824eb8552e8ce1de 100644
--- a/samplecode/SampleAnimator.cpp
+++ b/samplecode/SampleAnimator.cpp
@@ -12,6 +12,8 @@
#include "SkStream.h"
#include "SkDOM.h"
+#include <memory>
+
///////////////////////////////////////////////////////////////////////////////
class SkAnimatorView : public SkView {
@@ -50,8 +52,8 @@ void SkAnimatorView::setURIBase(const char dir[]) {
}
bool SkAnimatorView::decodeFile(const char path[]) {
- SkAutoTDelete<SkStream> is(SkStream::NewFromFile(path));
- return is.get() != nullptr && this->decodeStream(is);
+ std::unique_ptr<SkStream> is = SkStream::MakeFromFile(path);
+ return is && this->decodeStream(is.get());
}
bool SkAnimatorView::decodeMemory(const void* buffer, size_t size) {

Powered by Google App Engine
This is Rietveld 408576698