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',
|
|
|
|
'../tools/',
|
|
|
|
|
|
|
|
# Needed for TDStackNesterTest.
|
|
|
|
'../experimental/PdfViewer',
|
|
|
|
'../experimental/PdfViewer/src',
|
|
|
|
],
|
|
|
|
'dependencies': [
|
|
|
|
'skia_lib.gyp:skia_lib',
|
|
|
|
'experimental.gyp:experimental',
|
|
|
|
'flags.gyp:flags',
|
|
|
|
'pdf.gyp:pdf',
|
|
|
|
'tools.gyp:picture_utils',
|
|
|
|
],
|
|
|
|
'sources': [
|
|
|
|
'../tests/Test.cpp',
|
|
|
|
'../tests/Test.h',
|
|
|
|
|
|
|
|
'../tests/AAClipTest.cpp',
|
|
|
|
'../tests/ARGBImageEncoderTest.cpp',
|
|
|
|
'../tests/AndroidPaintTest.cpp',
|
|
|
|
'../tests/AnnotationTest.cpp',
|
|
|
|
'../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',
|
|
|
|
'../tests/FontHostStreamTest.cpp',
|
|
|
|
'../tests/FontHostTest.cpp',
|
|
|
|
'../tests/FontMgrTest.cpp',
|
|
|
|
'../tests/FontNamesTest.cpp',
|
|
|
|
'../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',
|
|
|
|
'../tests/GrBinHashKeyTest.cpp',
|
|
|
|
'../tests/GrContextFactoryTest.cpp',
|
|
|
|
'../tests/GrDrawTargetTest.cpp',
|
|
|
|
'../tests/GrMemoryPoolTest.cpp',
|
|
|
|
'../tests/GrRedBlackTreeTest.cpp',
|
2014-02-27 20:23:22 +00:00
|
|
|
'../tests/GrOrderedSetTest.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',
|
|
|
|
'../tests/InfRectTest.cpp',
|
|
|
|
'../tests/JpegTest.cpp',
|
|
|
|
'../tests/LListTest.cpp',
|
|
|
|
'../tests/LayerDrawLooperTest.cpp',
|
|
|
|
'../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-03-17 10:38:34 +00:00
|
|
|
'../tests/ObjectPoolTest.cpp',
|
2014-02-26 16:31:22 +00:00
|
|
|
'../tests/OSPathTest.cpp',
|
|
|
|
'../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',
|
|
|
|
'../tests/PictureTest.cpp',
|
|
|
|
'../tests/PictureUtilsTest.cpp',
|
|
|
|
'../tests/PixelRefTest.cpp',
|
|
|
|
'../tests/PointTest.cpp',
|
|
|
|
'../tests/PremulAlphaRoundTripTest.cpp',
|
|
|
|
'../tests/QuickRejectTest.cpp',
|
|
|
|
'../tests/RTreeTest.cpp',
|
|
|
|
'../tests/RandomTest.cpp',
|
|
|
|
'../tests/ReadPixelsTest.cpp',
|
|
|
|
'../tests/ReadWriteAlphaTest.cpp',
|
|
|
|
'../tests/Reader32Test.cpp',
|
|
|
|
'../tests/RefCntTest.cpp',
|
|
|
|
'../tests/RefDictTest.cpp',
|
|
|
|
'../tests/RegionTest.cpp',
|
|
|
|
'../tests/ResourceCacheTest.cpp',
|
|
|
|
'../tests/RoundRectTest.cpp',
|
|
|
|
'../tests/RuntimeConfigTest.cpp',
|
|
|
|
'../tests/SHA1Test.cpp',
|
|
|
|
'../tests/ScalarTest.cpp',
|
|
|
|
'../tests/SerializationTest.cpp',
|
|
|
|
'../tests/ShaderImageFilterTest.cpp',
|
|
|
|
'../tests/ShaderOpacityTest.cpp',
|
|
|
|
'../tests/SkBase64Test.cpp',
|
2014-03-17 10:38:34 +00:00
|
|
|
'../tests/SListTest.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',
|
|
|
|
'../tests/TestSize.cpp',
|
|
|
|
'../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/UnitTestTest.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',
|
2014-03-07 03:25:16 +00:00
|
|
|
|
|
|
|
'../tools/sk_tool_utils.cpp',
|
2014-02-26 16:31:22 +00:00
|
|
|
],
|
|
|
|
}
|