aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/FrontBufferedStreamTest.cpp
Commit message (Collapse)AuthorAge
* Revert "Revert "use unique_ptr for stream api""Gravatar Mike Reed2017-09-16
| | | | | | | | | | This reverts commit 7031b247c9fe0cb8fa32129f9bc24fea2043cee2. Bug: skia: Change-Id: I24c34bbee703f02994be8e206bcb9c10b5427d84 Reviewed-on: https://skia-review.googlesource.com/47541 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
* Revert "use unique_ptr for stream api"Gravatar Mike Reed2017-09-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 49f1f34438d3431f6d7e32847accd2ba96948a73. Reason for revert: broke win-chrome ../../third_party/skia/src/ports/SkFontMgr_win_dw.cpp(89): error C2228: left of '.release' must have class/struct/union ../../third_party/skia/src/ports/SkFontMgr_win_dw.cpp(89): note: type is 'SkStreamAsset *' ../../third_party/skia/src/ports/SkFontMgr_win_dw.cpp(89): note: did you intend to use '->' instead? Original change's description: > use unique_ptr for stream api > > Bug: skia:6888 > Change-Id: I3459b4913982a7cae1c0061697c82cc65ad9a2d8 > Reviewed-on: https://skia-review.googlesource.com/26740 > Reviewed-by: Mike Klein <mtklein@chromium.org> > Commit-Queue: Mike Reed <reed@google.com> TBR=mtklein@chromium.org,mtklein@google.com,bungeman@google.com,reed@google.com Change-Id: Ic1e4af557317abd06b7f6b7f5056645df7e469f0 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia:6888 Reviewed-on: https://skia-review.googlesource.com/47440 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
* use unique_ptr for stream apiGravatar Mike Reed2017-09-15
| | | | | | | | Bug: skia:6888 Change-Id: I3459b4913982a7cae1c0061697c82cc65ad9a2d8 Reviewed-on: https://skia-review.googlesource.com/26740 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Reed <reed@google.com>
* use unique_ptr for codec factoriesGravatar Mike Reed2017-07-25
| | | | | | | | | | Will need guards for android (at least) Bug: skia: Change-Id: I2bb8e656997984489ef1f2e41cd3d301c4e7b947 Reviewed-on: https://skia-review.googlesource.com/26040 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Reed <reed@google.com>
* SkTypes.h : move SkAutoMalloc into SkAutoMalloc.hGravatar Hal Canary2017-01-11
| | | | | | | | | | | | | | | | * SkAutoFree moved to SkTemplates.h (now implmented with unique_ptr). * SkAutoMalloc and SkAutoSMalloc moved to SkAutoMalloc.h * "SkAutoFree X(sk_malloc_throw(N));" --> "SkAutoMalloc X(N);" Revert "Revert 'SkTypes.h : move SkAutoMalloc into SkAutoMalloc.h'" This reverts commit c456b73fef9589bbdc5eb83eaa83e53c357bb3da. Change-Id: Ie2c1a17c20134b8ceab85a68b3ae3e61c24fbaab Reviewed-on: https://skia-review.googlesource.com/6886 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* Revert "SkTypes.h : move SkAutoMalloc into SkAutoMalloc.h"Gravatar Kevin Lubick2017-01-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit a5494f117086d712855e4b6289c58c92d1549bcf. Reason for revert: Broke Google3 Original change's description: > SkTypes.h : move SkAutoMalloc into SkAutoMalloc.h > > * SkAutoFree moved to SkTemplates.h (now implmented with unique_ptr). > > * SkAutoMalloc and SkAutoSMalloc moved to SkAutoMalloc.h > > * "SkAutoFree X(sk_malloc_throw(N));" --> "SkAutoMalloc X(N);" > > Change-Id: Idacd86ca09e22bf092422228599ae0d9bedded88 > Reviewed-on: https://skia-review.googlesource.com/4543 > Reviewed-by: Ben Wagner <bungeman@google.com> > Reviewed-by: Mike Reed <reed@google.com> > Commit-Queue: Hal Canary <halcanary@google.com> > TBR=halcanary@google.com,bungeman@google.com,reed@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: Ie8bd176121c3ee83c110d66c0d0ac65e09bfc9c5 Reviewed-on: https://skia-review.googlesource.com/6884 Commit-Queue: Kevin Lubick <kjlubick@google.com> Reviewed-by: Kevin Lubick <kjlubick@google.com>
* SkTypes.h : move SkAutoMalloc into SkAutoMalloc.hGravatar Hal Canary2017-01-11
| | | | | | | | | | | | | | * SkAutoFree moved to SkTemplates.h (now implmented with unique_ptr). * SkAutoMalloc and SkAutoSMalloc moved to SkAutoMalloc.h * "SkAutoFree X(sk_malloc_throw(N));" --> "SkAutoMalloc X(N);" Change-Id: Idacd86ca09e22bf092422228599ae0d9bedded88 Reviewed-on: https://skia-review.googlesource.com/4543 Reviewed-by: Ben Wagner <bungeman@google.com> Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* Remove SkAutoTDelete.Gravatar Ben Wagner2016-11-03
| | | | | | | | | Replace with std::unique_ptr. Change-Id: I5806cfbb30515fcb20e5e66ce13fb5f3b8728176 Reviewed-on: https://skia-review.googlesource.com/4381 Commit-Queue: Ben Wagner <bungeman@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
* detach -> releaseGravatar mtklein2016-03-16
| | | | | | | | | | | | | The C++ standard library uses the name "release" for the operation we call "detach". Rewriting each "detach(" to "release(" brings us a step closer to using standard library types directly (e.g. std::unique_ptr instead of SkAutoTDelete). This was a fairly blind transformation. There may have been unintentional conversions in here, but it's probably for the best to have everything uniformly say "release". BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1809733002 Review URL: https://codereview.chromium.org/1809733002
* Fix FrontBufferedStreamTestGravatar msarett2016-03-01
| | | | | | | | | TBR=scroggo@google.com BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1747423002 Review URL: https://codereview.chromium.org/1747423002
* Fix bug in SkGifCodec / Switch SkImageDec tests to use CodecGravatar msarett2016-03-01
| | | | | | | | | | | | SkImageDecoder is still used throughout tests, tools, gms etc. Deleting it from tests is an easy first step. Bonus is that we add tests of SkCodec. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1733863003 Review URL: https://codereview.chromium.org/1733863003
* Remove position from FrontBufferedStreamGravatar scroggo2016-02-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When FrontBufferedStream was written, it implemented getPosition() and returned true for hasPosition(). The CL that introduced it (crrev.com/23717055) does not have any indication why, but I'm guessing it was because it was easy to implement. None of our decoders rely on this (only some tests do). Now that we have a decoder (SkRawCodec) that expects to be able to seek a stream if it has a position (which makes sense - SkStream.h associates that with SkStreamSeekable, and there is no other way to check to see if a stream is seekable), it is failing because FrontBufferedStream reports it has a position and the decoder tries to seek. Remove FrontBufferedStream::hasPosition() (reverting to the default, false) and ::getPosition() (so it will return 0). Fix tests - do not call FrontBufferedStream::getPosition() Update CodexTest to test using an FrontBufferedStream, like Android does. BUG=b/27218441 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1703293002 Review URL: https://codereview.chromium.org/1703293002
* Style Change: SkNEW->new; SkDELETE->deleteGravatar halcanary2015-08-26
| | | | | | DOCS_PREVIEW= https://skia.org/?cl=1316123003 Review URL: https://codereview.chromium.org/1316123003
* 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
* 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
* 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
* Add test for new FrontBufferedStream behavior.Gravatar scroggo2014-10-24
| | | | | | | | | | | Test for https://skia.googlesource.com/skia/+/dd5a1e094c19fa10202c37c50a1f799e5af5dac0 Verify that FrontBufferedStream does not attempt to read beyond the end of its underlying stream. Make SkStreamToCGImageSource handle an empty stream better. Review URL: https://codereview.chromium.org/641813009
* Revert of Add test for new FrontBufferedStream behavior. (patchset #1 id:1 ↵Gravatar mtklein2014-10-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of https://codereview.chromium.org/641813009/) Reason for revert: Test is SkASSERTing on Macs, e.g: http://chromegw.corp.google.com/i/client.skia/builders/Test-Mac10.6-MacMini4.1-GeForce320M-x86_64-Debug/builds/257/steps/dm/logs/stdio 210 tasks left 1737M peak 1ms test FrontBufferedStream../../src/ports/SkImageDecoder_CG.cpp:43: failed assertion "data" Signal 11: _sigtramp (+0x1a) SkStreamToCGImageSource(SkStream*) (+0x62) SkImageDecoder_CG::onDecode(SkStream*, SkBitmap*, SkImageDecoder::Mode) (+0x2e) SkImageDecoder::decode(SkStream*, SkBitmap*, SkColorType, SkImageDecoder::Mode) (+0x81) SkImageDecoder::DecodeStream(SkStreamRewindable*, SkBitmap*, SkColorType, SkImageDecoder::Mode, SkImageDecoder::Format*) (+0xff) SkImageDecoder::DecodeStream(SkStreamRewindable*, SkBitmap*) (+0x31) test_ShortFrontBufferedStream(skiatest::Reporter*) (+0x97) skiatest::ShortFrontBufferedStreamClass::onRun(skiatest::Reporter*) (+0x19) skiatest::Test::run() (+0x7c) DM::CpuTestTask::draw() (+0x5a) DM::CpuTask::run() (+0x9e) non-virtual thunk to DM::CpuTask::run() (+0x1c) (anonymous namespace)::ThreadPool::Loop(void*) (+0xf4) thread_start(void*) (+0x54) _pthread_start (+0x14b) Original issue's description: > Add test for new FrontBufferedStream behavior. > > Test for https://skia.googlesource.com/skia/+/dd5a1e094c19fa10202c37c50a1f799e5af5dac0 > > Verify that FrontBufferedStream does not attempt to read beyond the > end of its underlying stream. > > Committed: https://skia.googlesource.com/skia/+/da59f05c6738dbb9a92cad21c608cdfae53a76b2 TBR=reed@google.com,scroggo@google.com NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/649553003
* Add test for new FrontBufferedStream behavior.Gravatar scroggo2014-10-23
| | | | | | | | | Test for https://skia.googlesource.com/skia/+/dd5a1e094c19fa10202c37c50a1f799e5af5dac0 Verify that FrontBufferedStream does not attempt to read beyond the end of its underlying stream. Review URL: https://codereview.chromium.org/641813009
* Use SkToBool to fix a warning.Gravatar commit-bot@chromium.org2014-02-10
| | | | | | | | | | | NOTRY=true TBR=djsollen@google.com Author: scroggo@google.com Review URL: https://codereview.chromium.org/159333002 git-svn-id: http://skia.googlecode.com/svn/trunk@13389 2bbb7eff-a529-9590-31e7-b0007b416f81
* Allow buffered stream to work with an offset.Gravatar commit-bot@chromium.org2014-02-10
| | | | | | | | | | | | | | If the stream being buffered is buffered from somewhere other than the start, the SkFrontBufferedStream needs to take that into account when reporting its length. R=djsollen@google.com, bungeman@google.com, reed@google.com Author: scroggo@google.com Review URL: https://codereview.chromium.org/157103002 git-svn-id: http://skia.googlecode.com/svn/trunk@13388 2bbb7eff-a529-9590-31e7-b0007b416f81
* Cleanup: Sanitize the order of includes under tests/Gravatar tfarina@chromium.org2014-01-24
| | | | | | | | | | | | | | | | Initially this was to make sure Test.h appeared after the Sk*.h includes. Patch generated by the following command line: $ ~/chromium/src/tools/sort-headers.py tests/*.cpp BUG=None TEST=tests R=robertphillips@google.com Review URL: https://codereview.chromium.org/145313004 git-svn-id: http://skia.googlecode.com/svn/trunk@13177 2bbb7eff-a529-9590-31e7-b0007b416f81
* Move macros from TestClassDef.h to Test.hGravatar commit-bot@chromium.org2014-01-14
| | | | | | | | | | | | | | Motivation: those macros don't make any sense without the definitions in Test.h. BUG= R=mtklein@google.com Author: halcanary@google.com Review URL: https://codereview.chromium.org/138563004 git-svn-id: http://skia.googlecode.com/svn/trunk@13074 2bbb7eff-a529-9590-31e7-b0007b416f81
* Use DEFINE_TESTCLASS_SHORT macro in tests.Gravatar tfarina@chromium.org2013-12-12
| | | | | | | | | | | | | The three version of DEFINE_TESTCLASS macro is deprecated and thus just use the simple, short one. BUG=None TEST=out/Debug/tests R=mtklein@google.com, bsalomon@google.com, robertphillips@google.com Review URL: https://codereview.chromium.org/100113004 git-svn-id: http://skia.googlecode.com/svn/trunk@12653 2bbb7eff-a529-9590-31e7-b0007b416f81
* Hide implementation details: SkFrontBufferedStreamGravatar scroggo@google.com2013-11-12
| | | | | | | | R=reed@google.com Review URL: https://codereview.chromium.org/25581002 git-svn-id: http://skia.googlecode.com/svn/trunk@12256 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add a buffered SkStream class.Gravatar scroggo@google.com2013-09-26
This is used by Android to buffer an input stream which may not otherwise be able to rewind. Add a test for the new class. R=bungeman@google.com, mtklein@google.com, reed@google.com Review URL: https://codereview.chromium.org/23717055 git-svn-id: http://skia.googlecode.com/svn/trunk@11488 2bbb7eff-a529-9590-31e7-b0007b416f81