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

Side by Side Diff: include/core/SkStream.h

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 unified diff | Download patch
« no previous file with comments | « dm/DMSrcSink.cpp ('k') | include/core/SkTypeface.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkStream_DEFINED 8 #ifndef SkStream_DEFINED
9 #define SkStream_DEFINED 9 #define SkStream_DEFINED
10 10
(...skipping 22 matching lines...) Expand all
33 * always return all N bytes of the request if possible. If they return fewer 33 * always return all N bytes of the request if possible. If they return fewer
34 * (the read() call returns the number of bytes read) then that means there is 34 * (the read() call returns the number of bytes read) then that means there is
35 * no more data (at EOF or hit an error). The caller should *not* call again 35 * no more data (at EOF or hit an error). The caller should *not* call again
36 * in hopes of fulfilling more of the request. 36 * in hopes of fulfilling more of the request.
37 */ 37 */
38 class SK_API SkStream : public SkNoncopyable { 38 class SK_API SkStream : public SkNoncopyable {
39 public: 39 public:
40 virtual ~SkStream() {} 40 virtual ~SkStream() {}
41 41
42 /** 42 /**
43 * Attempts to open the specified file, and return a stream to it (using 43 * Attempts to open the specified file as a stream, returns nullptr on fail ure.
44 * mmap if available). On success, the caller is responsible for deleting.
45 * On failure, returns NULL.
46 */ 44 */
47 static SkStreamAsset* NewFromFile(const char path[]); 45 static std::unique_ptr<SkStreamAsset> MakeFromFile(const char path[]);
48 46
49 /** Reads or skips size number of bytes. 47 /** Reads or skips size number of bytes.
50 * If buffer == NULL, skip size bytes, return how many were skipped. 48 * If buffer == NULL, skip size bytes, return how many were skipped.
51 * If buffer != NULL, copy size bytes into buffer, return how many were cop ied. 49 * If buffer != NULL, copy size bytes into buffer, return how many were cop ied.
52 * @param buffer when NULL skip size bytes, otherwise copy size bytes into buffer 50 * @param buffer when NULL skip size bytes, otherwise copy size bytes into buffer
53 * @param size the number of bytes to skip or copy 51 * @param size the number of bytes to skip or copy
54 * @return the number of bytes actually read. 52 * @return the number of bytes actually read.
55 */ 53 */
56 virtual size_t read(void* buffer, size_t size) = 0; 54 virtual size_t read(void* buffer, size_t size) = 0;
57 55
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 458
461 private: 459 private:
462 size_t fBytesWritten; 460 size_t fBytesWritten;
463 typedef SkWStream INHERITED; 461 typedef SkWStream INHERITED;
464 }; 462 };
465 463
466 // for now 464 // for now
467 typedef SkFILEStream SkURLStream; 465 typedef SkFILEStream SkURLStream;
468 466
469 #endif 467 #endif
OLDNEW
« no previous file with comments | « dm/DMSrcSink.cpp ('k') | include/core/SkTypeface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698