aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkStream.h
Commit message (Collapse)AuthorAge
* SkWStream::writeText inlined.Gravatar halcanary2016-04-11
| | | | | | | | | | | | | | | | | | | | | | | | | | Motivation: This function is used throughout SkPDF. Note that the compiler can usually inline the result of strlen() for literal strings. Before: out/Release/nanobench -m WStreamWriteText -q Timer overhead: 24.2ns ! -> high variance, ? -> moderate variance micros bench 6.10 WStreamWriteText nonrendering After: out/Release/nanobench -m WStreamWriteText -q Timer overhead: 23.9ns ! -> high variance, ? -> moderate variance micros bench 2.51 WStreamWriteText nonrendering PDF runtime change: -0.8% ±0.04%. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1844343004 Review URL: https://codereview.chromium.org/1844343004
* add missing APIGravatar caryclark2016-03-16
| | | | | | | | | SkMemoryWStream needs SK_API to be accessible from PDFium. R=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1808683002 Review URL: https://codereview.chromium.org/1808683002
* Make sp variants for SkDataGravatar reed2016-03-11
| | | | Review URL: https://codereview.chromium.org/1779263003
* add fsync to try to get complete skps from webpage picture captureGravatar caryclark2015-12-16
| | | | | | | | R=reed@google.com,mtklein@google.com BUG=skia:4691 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1530783003 Review URL: https://codereview.chromium.org/1530783003
* Allow SkStream::peek() to partially succeedGravatar scroggo2015-12-07
| | | | | | | | | | | | | | | | | | | | If the stream can peek less than requested, peek that amount. Return the number of bytes peeked. This simplifies crrev.com/1472123002. For a stream that is smaller than 14 bytes, it can successfully peek, meaning the client will not need to fall back to read() + rewind(), which may fail if the stream can peek but not rewind. This CL revives code from patch set 3 of crrev.com/1044953002, where I initially introduced peek() (including tests). Add a test for SkFrontBufferedStream that verifies that peeking does not make rewind() fail (i.e. by reading past the internal buffer). BUG=skia:3257 Review URL: https://codereview.chromium.org/1490923005
* Eliminate SkFILE: it always is the same as FILE.Gravatar halcanary2015-11-20
| | | | Review URL: https://codereview.chromium.org/1467533003
* remove SkInstCntGravatar mtklein2015-06-26
| | | | | | | | | | | | | | It's been outclassed by Valgrind and leak sanitizer, and it seems to be causing problems for external folks building Skia. I'm not sure why our own builds seem unaffected. Latest thread: https://groups.google.com/forum/#!topic/skia-discuss/oj9FsQwwSF0 BUG=skia: Review URL: https://codereview.chromium.org/1217573002
* Add a method to read a stream without advancing it.Gravatar scroggo2015-04-02
| | | | | | | | | | | | | | | | | | | | | Add a virtual method on SkStream which will do a "peek" some bytes, so that those bytes are read, but the next call to read will be unaffected. Implement peek for SkMemoryStream, where the implementation is simple and obvious. Implement peek on SkFrontBufferedStream. Add tests. Motivated by decoding streams which cannot be rewound. TBR=reed@google.com BUG=skia:3257 Review URL: https://codereview.chromium.org/1044953002
* Remove SkMemoryStream::peek()Gravatar scroggo2015-03-27
| | | | | | | | | | | | | | | | | | | | | | | | I'd like to add a new API to SkStream for peeking - i.e. reading some bytes without advancing the stream. This will be implemented for the streams where it makes sense. I think the function should look something like the following: size_t peek(void* buffer, size_t bytesToRead) { return this->onPeek(buffer, bytesToRead); } virtual size_t onPeek(void* buffer, size_t bytesToRead) { return 0; // unimplemented base class. } In order to avoid confusion, I'd like to remove SkMemoryStream::peek(), which is not currently used internally, by Chrome, or by Android as far as I can tell. There is also another function does the same thing: getPosition(). BUG=skia:3257 Review URL: https://codereview.chromium.org/1039373002
* C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla}Gravatar mtklein2015-03-25
| | | | | | | | | NOPRESUBMIT=true BUG=skia: DOCS_PREVIEW= https://skia.org/?cl=1037793002 Review URL: https://codereview.chromium.org/1037793002
* SkStream: Add SkDynamicMemoryWStream::writeToStream(SkWStream*)Gravatar halcanary2015-02-23
| | | | Review URL: https://codereview.chromium.org/943423002
* Remove staging SkStream::unref().Gravatar bungeman2015-01-22
| | | | | | | | | SkStream::unref() was added to ease transitioning off of SkStream deriving from SkRefCnt. It is no longer needed, remove it. TBR=reed@google.com Review URL: https://codereview.chromium.org/861413002
* Make SkStream *not* ref counted.Gravatar scroggo2015-01-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SkStream is a stateful object, so it does not make sense for it to have multiple owners. Make SkStream inherit directly from SkNoncopyable. Update methods which previously called SkStream::ref() (e.g. SkImageDecoder::buildTileIndex() and SkFrontBufferedStream::Create(), which required the existing owners to call SkStream::unref()) to take ownership of their SkStream parameters and delete when done (including on failure). Switch all SkAutoTUnref<SkStream>s to SkAutoTDelete<SkStream>s. In some cases this means heap allocating streams that were previously stack allocated. Respect ownership rules of SkTypeface::CreateFromStream() and SkImageDecoder::buildTileIndex(). Update the comments for exceptional methods which do not affect the ownership of their SkStream parameters (e.g. SkPicture::CreateFromStream() and SkTypeface::Deserialize()) to be explicit about ownership. Remove test_stream_life, which tested that buildTileIndex() behaved correctly when SkStream was a ref counted object. The test does not make sense now that it is not. In SkPDFStream, remove the SkMemoryStream member. Instead of using it, create a new SkMemoryStream to pass to fDataStream (which is now an SkAutoTDelete). Make other pdf rasterizers behave like SkPDFDocumentToBitmap. SkPDFDocumentToBitmap delete the SkStream, so do the same in the following pdf rasterizers: SkPopplerRasterizePDF SkNativeRasterizePDF SkNoRasterizePDF Requires a change to Android, which currently treats SkStreams as ref counted objects. Review URL: https://codereview.chromium.org/849103004
* Simplify SkInstCntGravatar mtklein2015-01-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This code requires fewer macros to use it (just one), has less code in macro definitions, and has simpler synchronization code (just atomic ints, no SkOnce, no SkMutex, etc.) A minor downside, we lose indentation and reverse-ordering in the final report: Leaked SkRefCntBase: 7 Leaked SkFontMgr: 1 Leaked SkWeakRefCnt: 1 Leaked SkTypeface: 1 Leaked SkFlattenable: 3 Leaked SkXfermode: 3 Leaked SkPathRef: 1 Leaked SkPixelRef: 1 Leaked SkMallocPixelRef: 1 becomes Leaked SkXfermode: 3 Leaked SkMallocPixelRef: 1 Leaked SkPixelRef: 1 Leaked SkPathRef: 1 Leaked SkFlattenable: 3 Leaked SkTypeface: 1 Leaked SkWeakRefCnt: 1 Leaked SkFontMgr: 1 Leaked SkRefCntBase: 7 This is motivated by wanting to land https://codereview.chromium.org/806473006/, which makes sure all static use of SkOnce are in global scope. The current implementation of SkInstCnt uses them in function scope, which isn't safe. BUG=skia: No public API changes. TBR=reed@google.com Review URL: https://codereview.chromium.org/841263004
* Fix up all the easy virtual ... SK_OVERRIDE cases.Gravatar mtklein2015-01-09
| | | | | | | | | | | | This fixes every case where virtual and SK_OVERRIDE were on the same line, which should be the bulk of cases. We'll have to manually clean up the rest over time unless I level up in regexes. for f in (find . -type f); perl -p -i -e 's/virtual (.*)SK_OVERRIDE/\1SK_OVERRIDE/g' $f; end BUG=skia: Review URL: https://codereview.chromium.org/806653007
* Enable unused param checking for public includes.Gravatar djsollen2014-11-14
| | | | | | | | | | This CL cleans up the existing violations and enables the build time check to ensure that we don't regress. The motiviation behind this change is to allow clients who include our headers to be able to build with this warning enabled. Review URL: https://codereview.chromium.org/726923002
* remove confusing/unused stream methodsGravatar reed2014-09-12
| | | | | | | | | BUG=skia: R=bungeman@google.com, djsollen@google.com Author: reed@google.com Review URL: https://codereview.chromium.org/563273003
* Add size_t bytesWritten() const to SkWStream.Gravatar commit-bot@chromium.org2014-03-06
| | | | | | | | | | | BUG=skia: R=reed@google.com, mtklein@google.com, robertphillips@google.com, bungeman@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/187653003 git-svn-id: http://skia.googlecode.com/svn/trunk@13684 2bbb7eff-a529-9590-31e7-b0007b416f81
* This CL is motivated by the desire to make the skpinfo tool work a bit ↵Gravatar commit-bot@chromium.org2014-03-05
| | | | | | | | | | | | better. The main concern is that the assumptions made w.r.t. written bytes may not be valid for all SkWStream sub-classes. R=bungeman@gmail.com, bungeman@google.com, reed@google.com, mtklein@google.com Author: robertphillips@google.com Review URL: https://codereview.chromium.org/182733008 git-svn-id: http://skia.googlecode.com/svn/trunk@13673 2bbb7eff-a529-9590-31e7-b0007b416f81
* DM: read image files without an extra copyGravatar commit-bot@chromium.org2014-03-05
| | | | | | | | | | | BUG=skia: R=halcanary@google.com, reed@google.com, bsalomon@google.com, mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/185263012 git-svn-id: http://skia.googlecode.com/svn/trunk@13669 2bbb7eff-a529-9590-31e7-b0007b416f81
* Remove backward compatibility shims from SkStream.h.Gravatar bungeman@google.com2013-11-13
| | | | | | | | R=reed@google.com Review URL: https://codereview.chromium.org/68773009 git-svn-id: http://skia.googlecode.com/svn/trunk@12275 2bbb7eff-a529-9590-31e7-b0007b416f81
* Clean up SkTypes.h.Gravatar bungeman@google.com2013-10-11
| | | | | | | | | | | | | | | | | | | This change removes sk_stdint.h since it is only needed for vs2008 and earlier. This change removes SK_MMAP_SUPPORT define since it is no longer used. This change removes the stdio.h include from SkTypes.h since on many systems this is a very large header, few Skia files actually use it, it is available everywhere standard, and SkDebugf should be used instead. After this change there is no need for external users to put Skia's include/config into their own list of includes, saving the headache of having two header files of the same name and sometimes getting the wrong one depending on include order. R=bsalomon@google.com, djsollen@google.com Review URL: https://codereview.chromium.org/27044002 git-svn-id: http://skia.googlecode.com/svn/trunk@11738 2bbb7eff-a529-9590-31e7-b0007b416f81
* Handle SkStream::rewind properly.Gravatar scroggo@google.com2013-08-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | include/core/SkStream.h: Update documentation to state that rewinding a stream at the beginning should return true. This is important because our decoders fail if rewind returns false, assuming that the stream is not at the beginning. src/images/SkImageDecoder_libpng.cpp: If rewind fails, call png_error. src/images/SkImageDecoder_libwebp.cpp: If rewind fails, report an error and return false. src/images/SkImageRef.cpp: If rewind fails report an error and return false. FIXME: Need to handle flattening properly. Should I perhaps move writeStream into SkOrderedWriteBuffer? src/images/SkJpegUtility.cpp: Report a jpeg error on failure to rewind. BUG=https://b.corp.google.com/issue?id=8432093 R=bungeman@google.com, djsollen@google.com, reed@google.com Review URL: https://codereview.chromium.org/22861028 git-svn-id: http://skia.googlecode.com/svn/trunk@10977 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add a detachAsStream to SkDynamicMemoryWStream.Gravatar bungeman@google.com2013-07-19
| | | | | | | | | | | | R=reed@google.com Committed: https://code.google.com/p/skia/source/detail?r=10171 Committed: https://code.google.com/p/skia/source/detail?r=10178 Review URL: https://codereview.chromium.org/19677002 git-svn-id: http://skia.googlecode.com/svn/trunk@10218 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add a detachAsStream to SkDynamicMemoryWStream.Gravatar bungeman@google.com2013-07-19
| | | | | | | | | | R=reed@google.com Committed: https://code.google.com/p/skia/source/detail?r=10171 Review URL: https://codereview.chromium.org/19677002 git-svn-id: http://skia.googlecode.com/svn/trunk@10178 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert r10171 due to test failure in StreamTestGravatar robertphillips@google.com2013-07-18
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@10172 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add a detachAsStream to SkDynamicMemoryWStream.Gravatar bungeman@google.com2013-07-18
| | | | | | | | R=reed@google.com Review URL: https://codereview.chromium.org/19677002 git-svn-id: http://skia.googlecode.com/svn/trunk@10171 2bbb7eff-a529-9590-31e7-b0007b416f81
* Change SkStream.Gravatar bungeman@google.com2013-05-29
| | | | | | | https://codereview.chromium.org/15298009/ git-svn-id: http://skia.googlecode.com/svn/trunk@9312 2bbb7eff-a529-9590-31e7-b0007b416f81
* Sanitizing source files in Housekeeper-NightlyGravatar skia.committer@gmail.com2013-05-08
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@9051 2bbb7eff-a529-9590-31e7-b0007b416f81
* add block comment describing sync nature of SkStreamGravatar reed@google.com2013-05-07
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@9039 2bbb7eff-a529-9590-31e7-b0007b416f81
* comments only: update docs for SkStream::readData(), SkWStream::writeData()Gravatar epoger@google.com2013-03-20
| | | | | | | BUG=https://code.google.com/p/skia/issues/detail?id=1167 Review URL: https://codereview.chromium.org/12604012 git-svn-id: http://skia.googlecode.com/svn/trunk@8260 2bbb7eff-a529-9590-31e7-b0007b416f81
* Sanitizing source files in Skia_Periodic_House_KeepingGravatar skia.committer@gmail.com2013-03-19
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@8211 2bbb7eff-a529-9590-31e7-b0007b416f81
* reland 8200 w/ fix for android (use fullpath instead of path)Gravatar reed@google.com2013-03-18
| | | | | | Review URL: https://codereview.chromium.org/12921003 git-svn-id: http://skia.googlecode.com/svn/trunk@8206 2bbb7eff-a529-9590-31e7-b0007b416f81
* revert 8204 -- what is happening???Gravatar reed@google.com2013-03-18
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@8205 2bbb7eff-a529-9590-31e7-b0007b416f81
* reland 8200 w/ fix for android (need fullpath instead of path)Gravatar reed@google.com2013-03-18
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@8204 2bbb7eff-a529-9590-31e7-b0007b416f81
* revert 8200 to figure out android breakGravatar reed@google.com2013-03-18
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@8201 2bbb7eff-a529-9590-31e7-b0007b416f81
* move SK_MMAP_SUPPORT into SkPreConfig, so we can know about its availabilityGravatar reed@google.com2013-03-18
| | | | | | | | | | | throughout the code. Add SkData::NewFromMMap() help factory. Refactor (now gone) SkMMapStream into SkStream::NewFromFile() factory Review URL: https://codereview.chromium.org/12919013 git-svn-id: http://skia.googlecode.com/svn/trunk@8200 2bbb7eff-a529-9590-31e7-b0007b416f81
* Sanitizing source files in Skia_Periodic_House_KeepingGravatar skia.committer@gmail.com2013-03-06
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@8003 2bbb7eff-a529-9590-31e7-b0007b416f81
* add SK_API to more stream subclasses (for shared library use)Gravatar reed@google.com2013-03-05
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@7986 2bbb7eff-a529-9590-31e7-b0007b416f81
* Ensure that SkMemoryStream does not crash dereferencing fData.Gravatar scroggo@google.com2013-01-09
| | | | | | | | | | | | SkMemoryStream attempts to dereference fData in multiple places. Instead of allowing it to be NULL, resulting in a crash, set it to SkData::NewEmpty(). Add a test for SkStream that will crash when its SkData is set to NULL. Review URL: https://codereview.appspot.com/7061059 git-svn-id: http://skia.googlecode.com/svn/trunk@7111 2bbb7eff-a529-9590-31e7-b0007b416f81
* Show the paint's typeface information in the details pane of the debugger.Gravatar humper@google.com2013-01-07
| | | | | | | | Also add a convenience constructor for SkMemoryStream that takes the SkData directly (instead of having to construct an empty one and call setData). Review URL: https://codereview.appspot.com/7065045 git-svn-id: http://skia.googlecode.com/svn/trunk@7048 2bbb7eff-a529-9590-31e7-b0007b416f81
* Result of running tools/sanitize_source_files.py (which was added in ↵Gravatar rmistry@google.com2012-08-23
| | | | | | | | | https://codereview.appspot.com/6465078/) This CL is part I of IV (I broke down the 1280 files into 4 CLs). Review URL: https://codereview.appspot.com/6485054 git-svn-id: http://skia.googlecode.com/svn/trunk@5262 2bbb7eff-a529-9590-31e7-b0007b416f81
* Exported SkFILEWStream class so that it can be used in Chrome.Gravatar alokp@chromium.org2012-07-17
| | | | | | Review URL: https://codereview.appspot.com/6409052 git-svn-id: http://skia.googlecode.com/svn/trunk@4643 2bbb7eff-a529-9590-31e7-b0007b416f81
* add read/write SkData methodsGravatar reed@google.com2012-07-02
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@4427 2bbb7eff-a529-9590-31e7-b0007b416f81
* stick SkInstCnt in more classes, to help track down leaksGravatar reed@google.com2012-06-26
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@4341 2bbb7eff-a529-9590-31e7-b0007b416f81
* Expanded distribution of instance countingGravatar robertphillips@google.com2012-06-21
| | | | | | | | http://codereview.appspot.com/6300114/ git-svn-id: http://skia.googlecode.com/svn/trunk@4291 2bbb7eff-a529-9590-31e7-b0007b416f81
* Adding more unit testing for SkCanvas and derived classes.Gravatar junov@chromium.org2012-02-22
| | | | | | | | | | BUG=http://code.google.com/p/skia/issues/detail?id=481 REVIEW=http://codereview.appspot.com/5674077/ TEST=unit test CanvasTest git-svn-id: http://skia.googlecode.com/svn/trunk@3228 2bbb7eff-a529-9590-31e7-b0007b416f81
* Use SK_OVERRIDE to add a little extra robustness against name changes.Gravatar tomhudson@google.com2011-10-03
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@2395 2bbb7eff-a529-9590-31e7-b0007b416f81
* Automatic update of all copyright notices to reflect new license terms.Gravatar epoger@google.com2011-07-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I have manually examined all of these diffs and restored a few files that seem to require manual adjustment. The following files still need to be modified manually, in a separate CL: android_sample/SampleApp/AndroidManifest.xml android_sample/SampleApp/res/layout/layout.xml android_sample/SampleApp/res/menu/sample.xml android_sample/SampleApp/res/values/strings.xml android_sample/SampleApp/src/com/skia/sampleapp/SampleApp.java android_sample/SampleApp/src/com/skia/sampleapp/SampleView.java experimental/CiCarbonSampleMain.c experimental/CocoaDebugger/main.m experimental/FileReaderApp/main.m experimental/SimpleCocoaApp/main.m experimental/iOSSampleApp/Shared/SkAlertPrompt.h experimental/iOSSampleApp/Shared/SkAlertPrompt.m experimental/iOSSampleApp/SkiOSSampleApp-Base.xcconfig experimental/iOSSampleApp/SkiOSSampleApp-Debug.xcconfig experimental/iOSSampleApp/SkiOSSampleApp-Release.xcconfig gpu/src/android/GrGLDefaultInterface_android.cpp gyp/common.gypi gyp_skia include/ports/SkHarfBuzzFont.h include/views/SkOSWindow_wxwidgets.h make.bat make.py src/opts/memset.arm.S src/opts/memset16_neon.S src/opts/memset32_neon.S src/opts/opts_check_arm.cpp src/ports/SkDebug_brew.cpp src/ports/SkMemory_brew.cpp src/ports/SkOSFile_brew.cpp src/ports/SkXMLParser_empty.cpp src/utils/ios/SkImageDecoder_iOS.mm src/utils/ios/SkOSFile_iOS.mm src/utils/ios/SkStream_NSData.mm tests/FillPathTest.cpp Review URL: http://codereview.appspot.com/4816058 git-svn-id: http://skia.googlecode.com/svn/trunk@1982 2bbb7eff-a529-9590-31e7-b0007b416f81
* replace detach/getStream apis on dynamicwstream with SkDataGravatar reed@google.com2011-06-24
| | | | | | | | http://codereview.appspot.com/4657046/ git-svn-id: http://skia.googlecode.com/svn/trunk@1714 2bbb7eff-a529-9590-31e7-b0007b416f81