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

Issue 195223003: Fixing SkPicture serialization (Closed)

Created:
6 years, 9 months ago by sugoi1
Modified:
6 years, 9 months ago
CC:
skia-review_googlegroups.com
Base URL:
https://skia.googlesource.com/skia.git@master
Visibility:
Public.

Description

Fixing SkPicture serialization Fixed a few issues while attempting to use the new serialization path for SkPicture inside a fuzzer: - SkReadBuffer and SkValidatingReadBuffer both had a fReader member instead of sharing the same member, which leads to problems if a base class function is used - In SkPicture, a header is now written as a single chunk of data, so it also has to be read as a single chunk of data - In the SkPicturePlayback destructor, a bad deserialization would lead to a crash if we don't safely unref fOpData - Also in SkPicturePlayback, if we only use a ReadBuffer for the whole deserialization, additional tags must be added to parseBufferTag() - SkValidatingReadBuffer::readBitmap() was broken, but this path wasn't usen't since the only use case for SkValidatingReadBuffer is currently image filters and bitmaps are unflattened as part of the deserialization of SkBitmapSource - SkPictureImageFilter was not deserializable. Added it to SkGlobalInitialization* - Added a test that exercises the SkPicture serialization / deserialization code BUG=skia: Committed: http://code.google.com/p/skia/source/detail?r=13764

Patch Set 1 #

Total comments: 8

Patch Set 2 : Fixed comments #

Total comments: 4

Patch Set 3 : Including fMagic into SkPictInfo #

Total comments: 2

Patch Set 4 : Fixed nits #

Unified diffs Side-by-side diffs Delta from patch set Stats (+151 lines, -36 lines) Patch
M include/core/SkPicture.h View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download
M include/core/SkReadBuffer.h View 1 chunk +3 lines, -1 line 0 comments Download
M src/core/SkPicture.cpp View 1 2 3 5 chunks +22 lines, -29 lines 0 comments Download
M src/core/SkPicturePlayback.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M src/core/SkPicturePlayback.cpp View 1 2 chunks +36 lines, -1 line 0 comments Download
M src/core/SkValidatingReadBuffer.h View 1 chunk +0 lines, -1 line 0 comments Download
M src/core/SkValidatingReadBuffer.cpp View 1 1 chunk +2 lines, -2 lines 0 comments Download
M src/ports/SkGlobalInitialization_chromium.cpp View 2 chunks +2 lines, -0 lines 0 comments Download
M src/ports/SkGlobalInitialization_default.cpp View 2 chunks +2 lines, -0 lines 0 comments Download
M tests/SerializationTest.cpp View 4 chunks +81 lines, -1 line 0 comments Download

Messages

Total messages: 21 (0 generated)
sugoi1
Multiple fixes around the new (still unused) path for SkPicture deserialization through SkReadBuffer (as opposed ...
6 years, 9 months ago (2014-03-11 17:12:05 UTC) #1
Stephen White
Nit: please keep CL description to 72 chars (git tools are dumb and wrap badly).
6 years, 9 months ago (2014-03-11 18:00:57 UTC) #2
sugoi
On 2014/03/11 18:00:57, Stephen White wrote: > Nit: please keep CL description to 72 chars ...
6 years, 9 months ago (2014-03-11 18:03:23 UTC) #3
Stephen White
https://codereview.chromium.org/195223003/diff/1/src/core/SkPicturePlayback.cpp File src/core/SkPicturePlayback.cpp (right): https://codereview.chromium.org/195223003/diff/1/src/core/SkPicturePlayback.cpp#newcode620 src/core/SkPicturePlayback.cpp:620: SkASSERT(NULL == fOpData); It looks like if a picture ...
6 years, 9 months ago (2014-03-11 18:14:42 UTC) #4
Stephen White
On 2014/03/11 18:03:23, sugoi wrote: > - In SkPicture, a header is now written as ...
6 years, 9 months ago (2014-03-11 18:14:51 UTC) #5
sugoi1
On 2014/03/11 18:14:51, Stephen White wrote: > On 2014/03/11 18:03:23, sugoi wrote: > > > ...
6 years, 9 months ago (2014-03-11 18:29:48 UTC) #6
sugoi1
https://codereview.chromium.org/195223003/diff/1/src/core/SkPicturePlayback.cpp File src/core/SkPicturePlayback.cpp (right): https://codereview.chromium.org/195223003/diff/1/src/core/SkPicturePlayback.cpp#newcode620 src/core/SkPicturePlayback.cpp:620: SkASSERT(NULL == fOpData); On 2014/03/11 18:14:43, Stephen White wrote: ...
6 years, 9 months ago (2014-03-11 18:54:03 UTC) #7
Stephen White
LGTM for non-API https://codereview.chromium.org/195223003/diff/20001/src/core/SkPicturePlayback.cpp File src/core/SkPicturePlayback.cpp (right): https://codereview.chromium.org/195223003/diff/20001/src/core/SkPicturePlayback.cpp#newcode621 src/core/SkPicturePlayback.cpp:621: SkASSERT(NULL == fOpData); Nit: this assert ...
6 years, 9 months ago (2014-03-11 19:05:54 UTC) #8
sugoi1
https://codereview.chromium.org/195223003/diff/20001/src/core/SkPicturePlayback.cpp File src/core/SkPicturePlayback.cpp (right): https://codereview.chromium.org/195223003/diff/20001/src/core/SkPicturePlayback.cpp#newcode621 src/core/SkPicturePlayback.cpp:621: SkASSERT(NULL == fOpData); On 2014/03/11 19:05:54, Stephen White wrote: ...
6 years, 9 months ago (2014-03-11 19:20:02 UTC) #9
reed1
Can we just move "magic" into SkPictInfo, to avoid having to have (yet) another struct ...
6 years, 9 months ago (2014-03-11 19:53:17 UTC) #10
reed1
Can the CL description contain more information?
6 years, 9 months ago (2014-03-11 19:53:41 UTC) #11
sugoi1
On 2014/03/11 19:53:41, reed1 wrote: > Can the CL description contain more information? Yeah, sorry, ...
6 years, 9 months ago (2014-03-11 19:57:30 UTC) #12
sugoi1
On 2014/03/11 19:53:17, reed1 wrote: > Can we just move "magic" into SkPictInfo, to avoid ...
6 years, 9 months ago (2014-03-11 20:05:41 UTC) #13
reed1
lgtm w/ suggestions https://codereview.chromium.org/195223003/diff/40001/src/core/SkPicture.cpp File src/core/SkPicture.cpp (right): https://codereview.chromium.org/195223003/diff/40001/src/core/SkPicture.cpp#newcode269 src/core/SkPicture.cpp:269: // Check magic bytes. should we ...
6 years, 9 months ago (2014-03-11 21:13:12 UTC) #14
sugoi1
On 2014/03/11 21:13:12, reed1 wrote: > lgtm w/ suggestions > > https://codereview.chromium.org/195223003/diff/40001/src/core/SkPicture.cpp > File src/core/SkPicture.cpp ...
6 years, 9 months ago (2014-03-12 12:14:06 UTC) #15
reed1
On 2014/03/12 12:14:06, sugoi1 wrote: > On 2014/03/11 21:13:12, reed1 wrote: > > lgtm w/ ...
6 years, 9 months ago (2014-03-12 13:23:42 UTC) #16
sugoi1
The CQ bit was checked by sugoi@chromium.org
6 years, 9 months ago (2014-03-12 13:52:07 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/sugoi@chromium.org/195223003/60001
6 years, 9 months ago (2014-03-12 13:52:13 UTC) #18
commit-bot: I haz the power
Change committed as 13764
6 years, 9 months ago (2014-03-12 14:46:46 UTC) #19
robertphillips
I believe this CL has introduced a new memory leak in the SerializationTest: 12:35:20.745579] ==2938== ...
6 years, 9 months ago (2014-03-12 23:19:03 UTC) #20
sugoi
6 years, 9 months ago (2014-03-13 03:11:41 UTC) #21
Message was sent while issue was closed.
On 2014/03/12 23:19:03, robertphillips wrote:
> I believe this CL has introduced a new memory leak in the SerializationTest:
> 
> 12:35:20.745579] ==2938== 263,084 (40 direct, 263,044 indirect) bytes in 1
> blocks are definitely lost in loss record 1,266 of 1,273
> [12:35:20.745601] ==2938==    at 0x4C2B1C7: operator new(unsigned long) (in
> /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
> [12:35:20.745622] ==2938==    by 0x54DA93:
> SkPicture::CreateFromBuffer(SkReadBuffer&) (SkPicture.cpp:354)
> [12:35:20.745642] ==2938==    by 0x4C5CAE: Serialization(skiatest::Reporter*)
> (SerializationTest.cpp:386)
> [12:35:20.745663] ==2938==    by 0x4C5E09:
> skiatest::SerializationClass::onRun(skiatest::Reporter*)
> (SerializationTest.cpp:291)
> [12:35:20.745683] ==2938==    by 0x440DD2: skiatest::Test::run()
(Test.cpp:108)
> [12:35:20.745703] ==2938==    by 0x4070A6: SkTestRunnable::run()
> (skia_test.cpp:108)
> [12:35:20.745722] ==2938==    by 0x407065: SkTThreadPool<void>::Loop(void*)
> (SkThreadPool.h:108)
> [12:35:20.745743] ==2938==    by 0x65552A: thread_start(void*)
> (SkThreadUtils_pthread.cpp:66)
> [12:35:20.745762] ==2938==    by 0x5481E99: start_thread
(pthread_create.c:308)
> [12:35:20.745782] ==2938==    by 0x6A02CBC: clone (clone.S:112)

Hmmm... This is probably a problem that was already there, but was exposed by
using this previously unused code path in the tests. I'll look into it tomorrow.

Powered by Google App Engine
This is Rietveld 408576698