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

Unified Diff: src/utils/mac/SkStream_mac.cpp

Issue 2339273002: SkFontData to use smart pointers. (Closed)
Patch Set: Add trivial bodies to the trivial implementations. 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
« no previous file with comments | « src/utils/mac/SkCreateCGImageRef.cpp ('k') | tests/BadIcoTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/mac/SkStream_mac.cpp
diff --git a/src/utils/mac/SkStream_mac.cpp b/src/utils/mac/SkStream_mac.cpp
index 36e5194a1990b3e65bdbf0fe3654bcff5659b167..e878c97244151f52d8f2d4dfdf027cb791e9f4a2 100644
--- a/src/utils/mac/SkStream_mac.cpp
+++ b/src/utils/mac/SkStream_mac.cpp
@@ -48,14 +48,14 @@ static void release_info_proc(void* info) {
delete (SkStream*)info;
}
-CGDataProviderRef SkCreateDataProviderFromStream(SkStream* stream) {
+CGDataProviderRef SkCreateDataProviderFromStream(std::unique_ptr<SkStreamRewindable> stream) {
// TODO: Replace with SkStream::getData() when that is added. Then we only
// have one version of CGDataProviderCreateWithData (i.e. same release proc)
const void* addr = stream->getMemoryBase();
if (addr) {
// special-case when the stream is just a block of ram
- return CGDataProviderCreateWithData(stream, addr, stream->getLength(),
- delete_stream_proc);
+ size_t size = stream->getLength();
+ return CGDataProviderCreateWithData(stream.release(), addr, size, delete_stream_proc);
}
CGDataProviderSequentialCallbacks rec;
@@ -65,17 +65,17 @@ CGDataProviderRef SkCreateDataProviderFromStream(SkStream* stream) {
rec.skipForward = skip_forward_proc;
rec.rewind = rewind_proc;
rec.releaseInfo = release_info_proc;
- return CGDataProviderCreateSequential(stream, &rec);
+ return CGDataProviderCreateSequential(stream.release(), &rec);
}
///////////////////////////////////////////////////////////////////////////////
#include "SkData.h"
-CGDataProviderRef SkCreateDataProviderFromData(SkData* data) {
- data->ref();
- return CGDataProviderCreateWithData(data, data->data(), data->size(),
- unref_proc);
+CGDataProviderRef SkCreateDataProviderFromData(sk_sp<SkData> data) {
+ const void* addr = data->data();
+ size_t size = data->size();
+ return CGDataProviderCreateWithData(data.release(), addr, size, unref_proc);
}
#endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
« no previous file with comments | « src/utils/mac/SkCreateCGImageRef.cpp ('k') | tests/BadIcoTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698