Add a class to allocate small objects w/o extra calls to new.
Add SkSmallAllocator, a template for allocating small (as defined by the
instantiation) objects without extra calls to new. Add a helper macro to
make using it simple.
Remove SkTemplatesPriv.h, whose behavior is replaced by SkSmallAllocator.
The old SK_PLACEMENT_NEW had the following drawbacks:
- Easily confused with SkNEW_PLACEMENT.
- Requires passing around lots of void*s along with the storageSize.
- Requires using a separate class for deleting it.
- We had multiple ways Auto objects for deleting in different places.
- It always did a straight heap allocation on Windows, meaning Windows
did not get any advantages from the confusing code.
The new SkSmallAllocator simplifies things:
- It is clear about what it does.
- It takes care of the deletion in one place that is automatically
handled.
Further, the new class can be used to create more than one object. This
is in preparation for BUG=skia:1976, for which we would like to create
a new object without extra heap allocations. The plan is to create both
the blitter and the new object on the stack using the SkSmallAllocator.
Add a new test for SkSmallAllocator.
SkShader.h:
Move the private version of CreateBitmapShader to SkBitmapProcShader
(which already has the implementation) and remove the friend class
(which was only used to call this private function). This allows
SkSmallAllocator to reside in the private src/ directory.
SkBitmapProcShader:
Move CreateBitmapShader and the macro for the storage size here. With
the macro in a (private) header, the (private) headers with function
declarations (which now depend on the storage size used) can see the
macro.
Use SkSmallAllocator in CreateBitmapShader.
Change the macro to kBlitterStorageByteCount, since SkSmallAllocator
takes a byte count as its template parameter.
SkBlitter:
Use the SkSmallAllocator.
Remove Sk3DShader::fKillProc and SkAutoCallProc. Both of their
behaviors have been moved into SkSmallAllocator (SkAutoCallProc was
unnecessary anyway, because the only time we ever used it we also
called detach(), so its auto behavior never happened).
Create the Sk3DShader on the stack, if there's room.
Remove the helper version of Choose, which was unused.
SmallAllocatorTest:
Test for the new class.
The rest:
Use SkSmallAllocator.
BUG=skia:1976
R=reed@google.com, mtklein@google.com
Author: scroggo@google.com
Review URL: https://codereview.chromium.org/179343005
git-svn-id: http://skia.googlecode.com/svn/trunk@13696 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-03-07 03:24:41 +00:00
|
|
|
# Common gypi for unit tests.
|
2014-02-26 16:31:22 +00:00
|
|
|
{
|
|
|
|
'include_dirs': [
|
|
|
|
'../src/core',
|
|
|
|
'../src/effects',
|
|
|
|
'../src/image',
|
|
|
|
'../src/lazy',
|
|
|
|
'../src/images',
|
|
|
|
'../src/pathops',
|
|
|
|
'../src/pdf',
|
|
|
|
'../src/pipe/utils',
|
|
|
|
'../src/utils',
|
|
|
|
'../src/utils/debugger',
|
|
|
|
|
|
|
|
# Needed for TDStackNesterTest.
|
|
|
|
'../experimental/PdfViewer',
|
|
|
|
'../experimental/PdfViewer/src',
|
|
|
|
],
|
|
|
|
'dependencies': [
|
|
|
|
'experimental.gyp:experimental',
|
|
|
|
'flags.gyp:flags',
|
|
|
|
'pdf.gyp:pdf',
|
2014-06-18 21:32:48 +00:00
|
|
|
'skia_lib.gyp:skia_lib',
|
2014-02-26 16:31:22 +00:00
|
|
|
'tools.gyp:picture_utils',
|
2014-06-20 18:29:20 +00:00
|
|
|
'tools.gyp:resources',
|
2014-06-21 17:54:17 +00:00
|
|
|
'tools.gyp:sk_tool_utils',
|
2014-02-26 16:31:22 +00:00
|
|
|
],
|
|
|
|
'sources': [
|
|
|
|
'../tests/Test.cpp',
|
|
|
|
'../tests/Test.h',
|
|
|
|
|
|
|
|
'../tests/AAClipTest.cpp',
|
|
|
|
'../tests/ARGBImageEncoderTest.cpp',
|
|
|
|
'../tests/AndroidPaintTest.cpp',
|
|
|
|
'../tests/AnnotationTest.cpp',
|
2014-04-22 15:21:18 +00:00
|
|
|
'../tests/AsADashTest.cpp',
|
2014-02-26 16:31:22 +00:00
|
|
|
'../tests/AtomicTest.cpp',
|
|
|
|
'../tests/BBoxHierarchyTest.cpp',
|
|
|
|
'../tests/BitSetTest.cpp',
|
|
|
|
'../tests/BitmapCopyTest.cpp',
|
|
|
|
'../tests/BitmapGetColorTest.cpp',
|
|
|
|
'../tests/BitmapHasherTest.cpp',
|
|
|
|
'../tests/BitmapHeapTest.cpp',
|
|
|
|
'../tests/BitmapTest.cpp',
|
|
|
|
'../tests/BlendTest.cpp',
|
|
|
|
'../tests/BlitRowTest.cpp',
|
|
|
|
'../tests/BlurTest.cpp',
|
|
|
|
'../tests/CachedDecodingPixelRefTest.cpp',
|
|
|
|
'../tests/CanvasStateTest.cpp',
|
|
|
|
'../tests/CanvasTest.cpp',
|
|
|
|
'../tests/ChecksumTest.cpp',
|
|
|
|
'../tests/ClampRangeTest.cpp',
|
|
|
|
'../tests/ClipCacheTest.cpp',
|
|
|
|
'../tests/ClipCubicTest.cpp',
|
|
|
|
'../tests/ClipStackTest.cpp',
|
|
|
|
'../tests/ClipperTest.cpp',
|
|
|
|
'../tests/ColorFilterTest.cpp',
|
|
|
|
'../tests/ColorPrivTest.cpp',
|
|
|
|
'../tests/ColorTest.cpp',
|
2014-03-18 17:38:34 +00:00
|
|
|
'../tests/DashPathEffectTest.cpp',
|
2014-02-26 16:31:22 +00:00
|
|
|
'../tests/DataRefTest.cpp',
|
|
|
|
'../tests/DeferredCanvasTest.cpp',
|
|
|
|
'../tests/DequeTest.cpp',
|
|
|
|
'../tests/DeviceLooperTest.cpp',
|
2014-03-03 19:23:28 +00:00
|
|
|
'../tests/DiscardableMemoryPoolTest.cpp',
|
2014-02-26 16:31:22 +00:00
|
|
|
'../tests/DiscardableMemoryTest.cpp',
|
|
|
|
'../tests/DocumentTest.cpp',
|
|
|
|
'../tests/DrawBitmapRectTest.cpp',
|
|
|
|
'../tests/DrawPathTest.cpp',
|
|
|
|
'../tests/DrawTextTest.cpp',
|
|
|
|
'../tests/DynamicHashTest.cpp',
|
|
|
|
'../tests/EmptyPathTest.cpp',
|
|
|
|
'../tests/ErrorTest.cpp',
|
|
|
|
'../tests/FillPathTest.cpp',
|
|
|
|
'../tests/FitsInTest.cpp',
|
|
|
|
'../tests/FlatDataTest.cpp',
|
|
|
|
'../tests/FlateTest.cpp',
|
2014-07-16 20:32:56 +00:00
|
|
|
'../tests/FloatingPointTextureTest.cpp',
|
2014-02-26 16:31:22 +00:00
|
|
|
'../tests/FontHostStreamTest.cpp',
|
|
|
|
'../tests/FontHostTest.cpp',
|
|
|
|
'../tests/FontMgrTest.cpp',
|
|
|
|
'../tests/FontNamesTest.cpp',
|
2014-07-08 17:33:28 +00:00
|
|
|
'../tests/FontObjTest.cpp',
|
2014-02-26 16:31:22 +00:00
|
|
|
'../tests/FrontBufferedStreamTest.cpp',
|
2014-03-03 19:23:28 +00:00
|
|
|
'../tests/GLInterfaceValidationTest.cpp',
|
2014-02-26 16:31:22 +00:00
|
|
|
'../tests/GLProgramsTest.cpp',
|
|
|
|
'../tests/GeometryTest.cpp',
|
|
|
|
'../tests/GifTest.cpp',
|
|
|
|
'../tests/GpuColorFilterTest.cpp',
|
|
|
|
'../tests/GpuDrawPathTest.cpp',
|
2014-06-30 15:26:50 +00:00
|
|
|
'../tests/GpuLayerCacheTest.cpp',
|
2014-05-29 18:46:38 +00:00
|
|
|
'../tests/GpuRectanizerTest.cpp',
|
2014-02-26 16:31:22 +00:00
|
|
|
'../tests/GrBinHashKeyTest.cpp',
|
|
|
|
'../tests/GrContextFactoryTest.cpp',
|
|
|
|
'../tests/GrDrawTargetTest.cpp',
|
|
|
|
'../tests/GrMemoryPoolTest.cpp',
|
2014-02-27 20:23:22 +00:00
|
|
|
'../tests/GrOrderedSetTest.cpp',
|
2014-07-08 17:33:28 +00:00
|
|
|
'../tests/GrRedBlackTreeTest.cpp',
|
2014-02-26 16:31:22 +00:00
|
|
|
'../tests/GrSurfaceTest.cpp',
|
|
|
|
'../tests/GrTBSearchTest.cpp',
|
|
|
|
'../tests/GradientTest.cpp',
|
|
|
|
'../tests/HashCacheTest.cpp',
|
|
|
|
'../tests/ImageCacheTest.cpp',
|
|
|
|
'../tests/ImageDecodingTest.cpp',
|
|
|
|
'../tests/ImageFilterTest.cpp',
|
2014-07-21 18:37:39 +00:00
|
|
|
'../tests/ImageGeneratorTest.cpp',
|
2014-07-14 14:48:04 +00:00
|
|
|
'../tests/ImageNewShaderTest.cpp',
|
2014-02-26 16:31:22 +00:00
|
|
|
'../tests/InfRectTest.cpp',
|
2014-06-26 20:07:05 +00:00
|
|
|
'../tests/InterpolatorTest.cpp',
|
2014-02-26 16:31:22 +00:00
|
|
|
'../tests/JpegTest.cpp',
|
2014-06-06 13:16:28 +00:00
|
|
|
'../tests/KtxTest.cpp',
|
2014-02-26 16:31:22 +00:00
|
|
|
'../tests/LListTest.cpp',
|
|
|
|
'../tests/LayerDrawLooperTest.cpp',
|
2014-04-10 20:42:53 +00:00
|
|
|
'../tests/LayerRasterizerTest.cpp',
|
2014-02-26 16:31:22 +00:00
|
|
|
'../tests/MD5Test.cpp',
|
|
|
|
'../tests/MallocPixelRefTest.cpp',
|
|
|
|
'../tests/MathTest.cpp',
|
|
|
|
'../tests/Matrix44Test.cpp',
|
|
|
|
'../tests/MatrixClipCollapseTest.cpp',
|
|
|
|
'../tests/MatrixTest.cpp',
|
|
|
|
'../tests/MemoryTest.cpp',
|
|
|
|
'../tests/MemsetTest.cpp',
|
|
|
|
'../tests/MessageBusTest.cpp',
|
|
|
|
'../tests/MetaDataTest.cpp',
|
|
|
|
'../tests/MipMapTest.cpp',
|
2014-06-09 18:16:58 +00:00
|
|
|
'../tests/NameAllocatorTest.cpp',
|
2014-02-26 16:31:22 +00:00
|
|
|
'../tests/OSPathTest.cpp',
|
2014-07-08 17:33:28 +00:00
|
|
|
'../tests/ObjectPoolTest.cpp',
|
2014-02-26 16:31:22 +00:00
|
|
|
'../tests/OnceTest.cpp',
|
|
|
|
'../tests/PDFPrimitivesTest.cpp',
|
|
|
|
'../tests/PackBitsTest.cpp',
|
|
|
|
'../tests/PaintTest.cpp',
|
|
|
|
'../tests/ParsePathTest.cpp',
|
|
|
|
'../tests/PathCoverageTest.cpp',
|
|
|
|
'../tests/PathMeasureTest.cpp',
|
|
|
|
'../tests/PathTest.cpp',
|
|
|
|
'../tests/PathUtilsTest.cpp',
|
2014-04-21 19:33:12 +00:00
|
|
|
'../tests/PictureShaderTest.cpp',
|
2014-04-28 20:17:48 +00:00
|
|
|
'../tests/PictureStateTreeTest.cpp',
|
2014-07-08 17:33:28 +00:00
|
|
|
'../tests/PictureTest.cpp',
|
2014-02-26 16:31:22 +00:00
|
|
|
'../tests/PixelRefTest.cpp',
|
|
|
|
'../tests/PointTest.cpp',
|
|
|
|
'../tests/PremulAlphaRoundTripTest.cpp',
|
|
|
|
'../tests/QuickRejectTest.cpp',
|
2014-07-08 17:33:28 +00:00
|
|
|
'../tests/RTConfRegistryTest.cpp',
|
2014-02-26 16:31:22 +00:00
|
|
|
'../tests/RTreeTest.cpp',
|
|
|
|
'../tests/RandomTest.cpp',
|
|
|
|
'../tests/ReadPixelsTest.cpp',
|
|
|
|
'../tests/ReadWriteAlphaTest.cpp',
|
|
|
|
'../tests/Reader32Test.cpp',
|
2014-04-09 23:30:28 +00:00
|
|
|
'../tests/RecordDrawTest.cpp',
|
2014-04-30 13:18:12 +00:00
|
|
|
'../tests/RecordOptsTest.cpp',
|
Add pattern matchers for SkRecord
This is a mid-level library for finding patterns of commands in an SkRecord. At the API level, it's a bit regex inspired. Some examples:
- Pattern1<Is<DrawRect>> matches a single DrawRect
- Pattern1<Star<Is<DrawRect>>> matches 0 or more DrawRects
- Pattern2<Is<ClipRect>, Is<DrawRect>> matches a single clip rect followed by a single draw rect
- Pattern3<Is<Save>, Star<IsDraw>, Is<Restore>> matches a single Save, followed by any number of Draws, followed by Restore
- Pattern1<Or<Is<DrawRect>, Is<ClipRect>>> matches a DrawRect or a ClipRect
- Pattern1<Not<Is<ClipRect>>> matches a command that's notClipRect.
Once you have a pattern, you can call .search() on it to step through ranges of matching commands. This means patterns can replace most of the custom iteration logic for optimization passes: the generic pattern searching steps through all the optimization candidates, which optimization-specific code further inspects and mutates.
SkRecordTraits is now unused. Bye bye!
Generated code and performance of SkRecordOpts is very similar to what it was before. (I had to use SK_ALWAYS_INLINE in a few places to make this so.)
BUG=skia:2378
R=fmalita@chromium.org, bungeman@google.com, mtklein@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/263063002
git-svn-id: http://skia.googlecode.com/svn/trunk@14582 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-05-05 21:59:52 +00:00
|
|
|
'../tests/RecordPatternTest.cpp',
|
2014-04-08 17:31:08 +00:00
|
|
|
'../tests/RecordTest.cpp',
|
2014-04-08 20:17:26 +00:00
|
|
|
'../tests/RecorderTest.cpp',
|
2014-04-10 23:30:59 +00:00
|
|
|
'../tests/RecordingTest.cpp',
|
2014-02-26 16:31:22 +00:00
|
|
|
'../tests/RefCntTest.cpp',
|
|
|
|
'../tests/RefDictTest.cpp',
|
|
|
|
'../tests/RegionTest.cpp',
|
|
|
|
'../tests/ResourceCacheTest.cpp',
|
|
|
|
'../tests/RoundRectTest.cpp',
|
|
|
|
'../tests/RuntimeConfigTest.cpp',
|
|
|
|
'../tests/SHA1Test.cpp',
|
2014-06-25 17:39:00 +00:00
|
|
|
'../tests/SListTest.cpp',
|
2014-02-26 16:31:22 +00:00
|
|
|
'../tests/ScalarTest.cpp',
|
2014-07-17 13:58:01 +00:00
|
|
|
'../tests/ScaledImageCache.cpp',
|
2014-02-26 16:31:22 +00:00
|
|
|
'../tests/SerializationTest.cpp',
|
|
|
|
'../tests/ShaderImageFilterTest.cpp',
|
|
|
|
'../tests/ShaderOpacityTest.cpp',
|
2014-06-25 17:39:00 +00:00
|
|
|
'../tests/SizeTest.cpp',
|
2014-02-26 16:31:22 +00:00
|
|
|
'../tests/SkBase64Test.cpp',
|
Add a class to allocate small objects w/o extra calls to new.
Add SkSmallAllocator, a template for allocating small (as defined by the
instantiation) objects without extra calls to new. Add a helper macro to
make using it simple.
Remove SkTemplatesPriv.h, whose behavior is replaced by SkSmallAllocator.
The old SK_PLACEMENT_NEW had the following drawbacks:
- Easily confused with SkNEW_PLACEMENT.
- Requires passing around lots of void*s along with the storageSize.
- Requires using a separate class for deleting it.
- We had multiple ways Auto objects for deleting in different places.
- It always did a straight heap allocation on Windows, meaning Windows
did not get any advantages from the confusing code.
The new SkSmallAllocator simplifies things:
- It is clear about what it does.
- It takes care of the deletion in one place that is automatically
handled.
Further, the new class can be used to create more than one object. This
is in preparation for BUG=skia:1976, for which we would like to create
a new object without extra heap allocations. The plan is to create both
the blitter and the new object on the stack using the SkSmallAllocator.
Add a new test for SkSmallAllocator.
SkShader.h:
Move the private version of CreateBitmapShader to SkBitmapProcShader
(which already has the implementation) and remove the friend class
(which was only used to call this private function). This allows
SkSmallAllocator to reside in the private src/ directory.
SkBitmapProcShader:
Move CreateBitmapShader and the macro for the storage size here. With
the macro in a (private) header, the (private) headers with function
declarations (which now depend on the storage size used) can see the
macro.
Use SkSmallAllocator in CreateBitmapShader.
Change the macro to kBlitterStorageByteCount, since SkSmallAllocator
takes a byte count as its template parameter.
SkBlitter:
Use the SkSmallAllocator.
Remove Sk3DShader::fKillProc and SkAutoCallProc. Both of their
behaviors have been moved into SkSmallAllocator (SkAutoCallProc was
unnecessary anyway, because the only time we ever used it we also
called detach(), so its auto behavior never happened).
Create the Sk3DShader on the stack, if there's room.
Remove the helper version of Choose, which was unused.
SmallAllocatorTest:
Test for the new class.
The rest:
Use SkSmallAllocator.
BUG=skia:1976
R=reed@google.com, mtklein@google.com
Author: scroggo@google.com
Review URL: https://codereview.chromium.org/179343005
git-svn-id: http://skia.googlecode.com/svn/trunk@13696 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-03-07 03:24:41 +00:00
|
|
|
'../tests/SmallAllocatorTest.cpp',
|
2014-02-26 16:31:22 +00:00
|
|
|
'../tests/SortTest.cpp',
|
|
|
|
'../tests/SrcOverTest.cpp',
|
|
|
|
'../tests/StreamTest.cpp',
|
|
|
|
'../tests/StringTest.cpp',
|
|
|
|
'../tests/StrokeTest.cpp',
|
|
|
|
'../tests/SurfaceTest.cpp',
|
2014-03-21 19:39:02 +00:00
|
|
|
'../tests/TArrayTest.cpp',
|
2014-02-26 16:31:22 +00:00
|
|
|
'../tests/TLSTest.cpp',
|
|
|
|
'../tests/TSetTest.cpp',
|
2014-06-11 19:26:49 +00:00
|
|
|
'../tests/TextureCompressionTest.cpp',
|
2014-02-26 16:31:22 +00:00
|
|
|
'../tests/TileGridTest.cpp',
|
2014-03-03 19:23:28 +00:00
|
|
|
'../tests/ToUnicodeTest.cpp',
|
2014-02-26 16:31:22 +00:00
|
|
|
'../tests/TracingTest.cpp',
|
2014-03-03 19:23:28 +00:00
|
|
|
'../tests/TypefaceTest.cpp',
|
2014-02-26 16:31:22 +00:00
|
|
|
'../tests/UnicodeTest.cpp',
|
|
|
|
'../tests/UtilsTest.cpp',
|
|
|
|
'../tests/WArrayTest.cpp',
|
|
|
|
'../tests/WritePixelsTest.cpp',
|
|
|
|
'../tests/Writer32Test.cpp',
|
|
|
|
'../tests/XfermodeTest.cpp',
|
|
|
|
|
|
|
|
'../tests/MatrixClipCollapseTest.cpp',
|
|
|
|
'../src/utils/debugger/SkDrawCommand.h',
|
|
|
|
'../src/utils/debugger/SkDrawCommand.cpp',
|
|
|
|
'../src/utils/debugger/SkDebugCanvas.h',
|
|
|
|
'../src/utils/debugger/SkDebugCanvas.cpp',
|
|
|
|
'../src/utils/debugger/SkObjectParser.h',
|
|
|
|
'../src/utils/debugger/SkObjectParser.cpp',
|
|
|
|
|
|
|
|
'../tests/PipeTest.cpp',
|
|
|
|
'../src/pipe/utils/SamplePipeControllers.cpp',
|
|
|
|
|
|
|
|
'../tests/TDStackNesterTest.cpp',
|
|
|
|
'../experimental/PdfViewer/src/SkTDStackNester.h',
|
|
|
|
],
|
|
|
|
}
|