Commit Graph

13 Commits

Author SHA1 Message Date
mtklein
36352bf5e3 C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla}
NOPRESUBMIT=true

BUG=skia:
DOCS_PREVIEW= https://skia.org/?cl=1037793002

Review URL: https://codereview.chromium.org/1037793002
2015-03-25 18:17:32 -07:00
scroggo
a1193e4b0e Make SkStream *not* ref counted.
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
2015-01-21 12:09:53 -08:00
mtklein
72c9faab45 Fix up all the easy virtual ... SK_OVERRIDE cases.
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
2015-01-09 10:06:40 -08:00
scroggo
3ceef9a66a 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.

Make SkStreamToCGImageSource handle an empty stream better.

Review URL: https://codereview.chromium.org/641813009
2014-10-24 06:55:07 -07:00
mtklein
404eb87993 Revert of Add test for new FrontBufferedStream behavior. (patchset #1 id:1 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
2014-10-23 12:08:03 -07:00
scroggo
da59f05c67 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.

Review URL: https://codereview.chromium.org/641813009
2014-10-23 10:21:28 -07:00
commit-bot@chromium.org
6d254ee4ac Use SkToBool to fix a warning.
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
2014-02-10 22:46:08 +00:00
commit-bot@chromium.org
74b88b70b8 Allow buffered stream to work with an offset.
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
2014-02-10 22:03:21 +00:00
tfarina@chromium.org
8f6884aab8 Cleanup: Sanitize the order of includes under tests/
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
2014-01-24 20:56:26 +00:00
commit-bot@chromium.org
e2eac8b2fd Move macros from TestClassDef.h to Test.h
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
2014-01-14 21:04:37 +00:00
tfarina@chromium.org
e4fafb146e Use DEFINE_TESTCLASS_SHORT macro in tests.
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
2013-12-12 21:11:12 +00:00
scroggo@google.com
09a5383adc Hide implementation details: SkFrontBufferedStream
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
2013-11-12 20:53:05 +00:00
scroggo@google.com
83fd2c7c43 Add a buffered SkStream class.
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
2013-09-26 21:35:39 +00:00