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

Issue 670453002: Remove image decoder and encoder autoregistration (Closed)

Created:
6 years, 2 months ago by Kimmo Kinnunen
Modified:
4 years, 10 months ago
Reviewers:
scroggo, reed1
CC:
reviews_skia.org
Base URL:
https://skia.googlesource.com/skia.git@separate-image-decoder-01-skpicture
Project:
skia
Visibility:
Public.

Description

Remove image decoder and encoder autoregistration Remove image decoder and encoder autoregistration through SkFactory. Replace this with normal sequential if -statements and #ifdefs. The ability to compile a encoder/decoder to the library just by including a .cpp file was not fulfilled. In addition to adding the file, one would need to add the new entry points to multiple other places, such as SkForceLinking. The autoregistration caused the encoder/decoder system to be more laboursome to maintan than without it. Simplifies using images library with embedders like Chromium. Avoids following problems: * Linking of decoders do not need to be forced in every executable that links to the library * Decoder and encoder application order is not undefined * Decoder and encoder application order does not need to be encoded in build system. The previous order was not as expected on all platforms, for example on windows. Removes the possibility for library client to replace existing decoders/encoders through the API. The possibility still exists for clients that "recompile" Skia (such as Chromium). BUG=skia:2992

Patch Set 1 #

Total comments: 51

Patch Set 2 : address review commetns #

Patch Set 3 : mac+win compile #

Patch Set 4 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+552 lines, -678 lines) Patch
M bench/ImageDecodeBench.cpp View 1 chunk +0 lines, -3 lines 0 comments Download
M bench/SkipZeroesBench.cpp View 1 1 chunk +0 lines, -3 lines 0 comments Download
M bench/nanobench.cpp View 1 2 2 chunks +0 lines, -3 lines 0 comments Download
M debugger/QT/SkDebuggerGUI.cpp View 1 2 2 chunks +0 lines, -3 lines 0 comments Download
M dm/DM.cpp View 1 2 2 chunks +0 lines, -3 lines 0 comments Download
M experimental/PdfViewer/chop_transparency_main.cpp View 1 2 chunks +0 lines, -3 lines 0 comments Download
M experimental/PdfViewer/src/SkPdfRenderer.cpp View 1 2 chunks +0 lines, -3 lines 0 comments Download
M experimental/nanomsg/picture_demo.cpp View 2 chunks +0 lines, -3 lines 0 comments Download
M gm/gmmain.cpp View 1 2 chunks +0 lines, -3 lines 0 comments Download
M gyp/images.gyp View 1 2 3 4 chunks +41 lines, -29 lines 0 comments Download
M gyp/utils.gyp View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M include/core/SkImageDecoder.h View 1 2 1 chunk +0 lines, -30 lines 0 comments Download
M include/core/SkImageEncoder.h View 1 1 chunk +0 lines, -31 lines 0 comments Download
D include/images/SkForceLinking.h View 1 chunk +0 lines, -20 lines 0 comments Download
M samplecode/SampleUnpremul.cpp View 1 2 chunks +0 lines, -3 lines 0 comments Download
M src/core/SkBitmapProcState.cpp View 1 1 chunk +0 lines, -1 line 0 comments Download
D src/images/SkForceLinking.cpp View 1 chunk +0 lines, -42 lines 0 comments Download
A src/images/SkImageDecoder_Factory.cpp View 1 2 1 chunk +128 lines, -0 lines 0 comments Download
D src/images/SkImageDecoder_FactoryDefault.cpp View 1 chunk +0 lines, -36 lines 0 comments Download
D src/images/SkImageDecoder_FactoryRegistrar.cpp View 1 chunk +0 lines, -63 lines 0 comments Download
A src/images/SkImageDecoder_astc.h View 1 1 chunk +16 lines, -0 lines 0 comments Download
M src/images/SkImageDecoder_astc.cpp View 1 2 3 2 chunks +11 lines, -29 lines 0 comments Download
A src/images/SkImageDecoder_ktx.h View 1 1 chunk +19 lines, -0 lines 0 comments Download
M src/images/SkImageDecoder_ktx.cpp View 1 2 3 2 chunks +6 lines, -18 lines 0 comments Download
A src/images/SkImageDecoder_libbmp.h View 1 1 chunk +16 lines, -0 lines 0 comments Download
M src/images/SkImageDecoder_libbmp.cpp View 1 2 3 2 chunks +10 lines, -27 lines 0 comments Download
A src/images/SkImageDecoder_libgif.h View 1 1 chunk +16 lines, -0 lines 0 comments Download
M src/images/SkImageDecoder_libgif.cpp View 1 2 3 2 chunks +7 lines, -24 lines 0 comments Download
A src/images/SkImageDecoder_libico.h View 1 1 chunk +16 lines, -0 lines 0 comments Download
M src/images/SkImageDecoder_libico.cpp View 1 2 3 2 chunks +9 lines, -21 lines 0 comments Download
A src/images/SkImageDecoder_libjpeg.h View 1 1 chunk +18 lines, -0 lines 0 comments Download
M src/images/SkImageDecoder_libjpeg.cpp View 1 2 3 3 chunks +10 lines, -31 lines 0 comments Download
A src/images/SkImageDecoder_libpng.h View 1 1 chunk +19 lines, -0 lines 0 comments Download
M src/images/SkImageDecoder_libpng.cpp View 1 2 3 2 chunks +11 lines, -28 lines 0 comments Download
A src/images/SkImageDecoder_libwebp.h View 1 1 chunk +19 lines, -0 lines 0 comments Download
M src/images/SkImageDecoder_libwebp.cpp View 1 2 3 3 chunks +8 lines, -24 lines 0 comments Download
A src/images/SkImageDecoder_pkm.h View 1 1 chunk +16 lines, -0 lines 0 comments Download
M src/images/SkImageDecoder_pkm.cpp View 1 2 3 2 chunks +9 lines, -27 lines 0 comments Download
A src/images/SkImageDecoder_wbmp.h View 1 2 3 1 chunk +16 lines, -0 lines 0 comments Download
M src/images/SkImageDecoder_wbmp.cpp View 1 2 3 2 chunks +5 lines, -17 lines 0 comments Download
M src/images/SkImageEncoder_Factory.cpp View 1 2 3 1 chunk +36 lines, -8 lines 0 comments Download
A src/images/SkImageEncoder_argb.h View 1 2 3 1 chunk +21 lines, -0 lines 0 comments Download
M src/images/SkImageEncoder_argb.cpp View 1 2 3 3 chunks +2 lines, -14 lines 0 comments Download
A + src/images/SkMovie_gif.h View 2 1 chunk +7 lines, -5 lines 0 comments Download
M src/images/SkMovie_gif.cpp View 1 2 3 3 chunks +2 lines, -8 lines 0 comments Download
A src/ports/SkImageDecoder_CG.h View 1 1 chunk +19 lines, -0 lines 0 comments Download
M src/ports/SkImageDecoder_CG.cpp View 1 2 3 6 chunks +9 lines, -41 lines 0 comments Download
A src/ports/SkImageDecoder_WIC.h View 1 1 chunk +19 lines, -0 lines 0 comments Download
M src/ports/SkImageDecoder_WIC.cpp View 1 2 3 6 chunks +6 lines, -27 lines 0 comments Download
M src/utils/SkBitmapHasher.cpp View 1 2 3 2 chunks +2 lines, -3 lines 0 comments Download
M tests/ARGBImageEncoderTest.cpp View 1 2 3 2 chunks +2 lines, -1 line 0 comments Download
M tests/GifTest.cpp View 1 chunk +0 lines, -3 lines 0 comments Download
M tests/ImageDecodingTest.cpp View 1 2 chunks +0 lines, -3 lines 0 comments Download
M tests/JpegTest.cpp View 1 chunk +0 lines, -3 lines 0 comments Download
M tests/KtxTest.cpp View 1 1 chunk +0 lines, -3 lines 0 comments Download
M tests/PathOpsExtendedTest.cpp View 1 2 2 chunks +0 lines, -3 lines 0 comments Download
M tests/PathOpsSkpClipTest.cpp View 1 2 chunks +0 lines, -3 lines 0 comments Download
M tools/LazyDecodeBitmap.cpp View 1 chunk +0 lines, -3 lines 0 comments Download
M tools/bbh_shootout.cpp View 1 chunk +0 lines, -1 line 0 comments Download
M tools/filtermain.cpp View 2 chunks +0 lines, -3 lines 0 comments Download
M tools/render_pdfs_main.cpp View 2 chunks +0 lines, -3 lines 0 comments Download
M tools/skdiff_main.cpp View 2 chunks +0 lines, -3 lines 0 comments Download
M tools/skhello.cpp View 1 1 chunk +0 lines, -3 lines 0 comments Download
M tools/skimage_main.cpp View 1 2 chunks +0 lines, -3 lines 0 comments Download
M tools/skpdiff/skpdiff_main.cpp View 1 chunk +0 lines, -3 lines 0 comments Download
M tools/test_image_decoder.cpp View 1 chunk +0 lines, -3 lines 0 comments Download

Messages

Total messages: 18 (2 generated)
Kimmo Kinnunen
would it be possible to replace FORCE_IMAGE_DECODER_LINKING with plain old ifdef'ing?
6 years, 2 months ago (2014-10-20 12:52:55 UTC) #2
Kimmo Kinnunen
https://codereview.chromium.org/670453002/diff/1/src/images/SkImageEncoder_Factory.cpp File src/images/SkImageEncoder_Factory.cpp (right): https://codereview.chromium.org/670453002/diff/1/src/images/SkImageEncoder_Factory.cpp#newcode26 src/images/SkImageEncoder_Factory.cpp:26: #if defined(SK_BUILD_FOR_WIN) I can double-check the encoder order and ...
6 years, 2 months ago (2014-10-20 14:03:39 UTC) #3
reed1
There are a lot of separate CLs related to this. Perhaps we should come to ...
6 years, 2 months ago (2014-10-20 14:39:58 UTC) #5
scroggo
On 2014/10/20 14:39:58, reed1 wrote: > There are a lot of separate CLs related to ...
6 years, 2 months ago (2014-10-20 15:34:41 UTC) #6
Kimmo Kinnunen
On 2014/10/20 15:34:41, scroggo wrote: > On 2014/10/20 14:39:58, reed1 wrote: > > There are ...
6 years, 2 months ago (2014-10-20 16:19:04 UTC) #7
scroggo
On 2014/10/20 16:19:04, Kimmo Kinnunen wrote: > On 2014/10/20 15:34:41, scroggo wrote: > > On ...
6 years, 2 months ago (2014-10-22 19:54:31 UTC) #8
Kimmo Kinnunen
On 2014/10/22 19:54:31, scroggo wrote: > It seems like if your special Chromium build with ...
6 years, 2 months ago (2014-10-23 08:33:52 UTC) #9
Kimmo Kinnunen
On 2014/10/23 08:33:52, Kimmo Kinnunen wrote: > There's no distinct Skia for "Build Chromium" and ...
6 years, 2 months ago (2014-10-23 08:49:04 UTC) #10
scroggo
By itself, I think this is a great change! The current registration system is a ...
6 years, 1 month ago (2014-11-12 18:00:13 UTC) #11
reed1
I do not like the direction of the change per-se, as I find the current ...
6 years, 1 month ago (2014-11-12 18:31:46 UTC) #12
Kimmo Kinnunen
On 2014/11/12 18:31:46, reed1 wrote: > I do not like the direction of the change ...
6 years, 1 month ago (2014-11-13 14:02:27 UTC) #13
Kimmo Kinnunen
On 2014/11/13 14:02:27, Kimmo Kinnunen wrote: > On 2014/11/12 18:31:46, reed1 wrote: > > I ...
6 years, 1 month ago (2014-11-13 14:04:49 UTC) #14
Kimmo Kinnunen
https://chromiumcodereview.appspot.com/670453002/diff/1/gyp/images.gyp File gyp/images.gyp (left): https://chromiumcodereview.appspot.com/670453002/diff/1/gyp/images.gyp#oldcode48 gyp/images.gyp:48: # IMPORTANT: The build order of the SkImageDecoder_*.cpp files ...
6 years, 1 month ago (2014-11-18 08:29:46 UTC) #15
scroggo
Regarding the larger issue of, is this the right direction: I like this change because ...
6 years, 1 month ago (2014-11-18 16:52:23 UTC) #16
Kimmo Kinnunen
On 2014/11/18 16:52:23, scroggo wrote: > Regarding the larger issue of, is this the right ...
6 years, 1 month ago (2014-11-19 08:55:39 UTC) #17
scroggo
4 years, 10 months ago (2016-02-12 19:02:11 UTC) #18
On 2014/11/19 08:55:39, Kimmo Kinnunen wrote:
> On 2014/11/18 16:52:23, scroggo wrote:
> > Regarding the larger issue of, is this the right direction:
> > 
> > I like this change because it removes the requirement of including
> > "SkForceLinking.h". SkForceLinking gets around an annoying behavior of the
> > linker to strip out the decoders, which it thinks are not used. (If we can
> find
> > a better way to *not* strip out the decoders, potentially while still
> stripping
> > out things that are actually unused, I think we should do that instead.)
> 
> Well, I guess it is such a good system that all these undefined behaviors wrt.
> global constructor ordering and linker behavior is worth it.
> 
> > One nice thing about the current system is that we can add another decoder
via
> > the registration function. Except thanks to the linker, you also have to
> update
> > SkForceLinking, and any program that uses the decoders needs to use
> > SkForceLinking as well.
> 
> Right, "except". Well, all I can say is that if the process of adding a
decoder
> is the thing you want to optimize, then global constructors might just be the
> solution to go for.
> 
> 
> > But let's get to the heart of the issue. What is your goal? I think your end
> > game is to run Skia's testing tools on Chromium. I think this is a great
idea.
> > But I don't see how this CL accomplishes that.
> 
> The point is that from any point of view this change is a progression that
fixes
> real bugs. I beg the change to be looked from this perspective, and not even
> hanging to any other dislike to bigger picture goals. This is how the cl
> description is written.
> 
> Note: the only pov this change is not a progression is the perceived
convenience
> of adding a decoder. And I write "perceived", because I do not think at the
> moment the benefit of current system is fulfilled. By posting this patch up
for
> consideration, I posit it is false thinking that paying for the current
> __FORCE_LINKINGs and false #NOTEs in .gyp files to get SK_REGISTER_DECODER is
> really more convenient. I think I have to admit the contrary now.
> 
> So I have spent quite lot of my time for fighting this change uphill. This is
a
> third-party developer trying to fix unit tests (of all things!), fighting over
a
> petty change over 4 weeks. I think I get the message that you do not want this
> here, no need to stall this based on cl description nits and whatnot.
> 
> Let's just drop the end goal.
> 
> > I've looked at your document at
> >
>
https://docs.google.com/document/d/1pUbdJ6OSNK--y2rSjPRkUMYCCx7jg6CjcLB_AjZyv...
> > , but that doesn't mention anything about image decoding, or explain how
this
> > helps Skia get there.
> 
> The doc talks nothing but that, I believe. I've also explained it to you
> multiple times over the numerous comments about the same subject. Same
> executable can not have multiple implementations of SkImageDecoder. The way
the
> image decoders are hacked together, the implementation spreads all over the
> place. This means that in order to compile SkImageDecoder_wic.cpp, for
example,
> you compile parts of SkImageDecoder.
> 
> Surely this goal can be achieved in multiple ways, including creating new
> defines that cut SkImageDecoders magically, and then compiling the file
multiple
> times. I chose this approach, because this actually makes the code simpler (in
> my opinion, that is) and fixes bugs. 
> 
> > The description of this issue mentions that it leaves open a way for clients
> > like Chromium to add encoders/decoders. What is that way? Why not use the
> > existing way?
> 
> Because using the existing way to implement client-extendable image decoders
is
> a mirage, just like the convenience of adding a decoder.
> 
> Now you have system where:
> - Library has finite, unextensible set of possible image decoder types
> (SkImageDecoder::Type)
> --> Biggest use case (that I know, of course) for extensible image decoder
list
> is to implement image decoder for a _new_ type. If library would know about
it,
> then it would probably have an implementation of it
> 
> - Client can not know which image decoders the library has compiled in
> --> If you use the extension system to implement already known type, then how
do
> you know the system does not have it?
> 
> - Client can not specify the order of image decoders
> --> It's just a random order. If you masquerade your new decoder as an
existing
> type with an existing decoder, it's really not known which one will be
selected.
> 
> If I had to guess, the API was not designed for client-extendable image
> decoders. Having that possibility is a leak from the chase of the convenience
of
> the library implementing the decoders.

Phasing out SkImageDecoder

Powered by Google App Engine
This is Rietveld 408576698