summaryrefslogtreecommitdiff
path: root/tests.gypi
diff options
context:
space:
mode:
authorcommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-07 03:24:41 +0000
committercommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-07 03:24:41 +0000
commit43e56d40fbb337a8bc9f123ee29d0b3a898f86d1 (patch)
tree8e781bb0ec3371c84850201089707f294ef08cae /tests.gypi
parent91efdf2ded6353f2d2f60fb1ffc75cfdf17a6e09 (diff)
downloadgyp-43e56d40fbb337a8bc9f123ee29d0b3a898f86d1.tar.gz
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/gyp@13696 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests.gypi')
-rw-r--r--tests.gypi2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests.gypi b/tests.gypi
index c2b2c54..6990464 100644
--- a/tests.gypi
+++ b/tests.gypi
@@ -1,3 +1,4 @@
+# Common gypi for unit tests.
{
'include_dirs': [
'../src/core',
@@ -143,6 +144,7 @@
'../tests/ShaderImageFilterTest.cpp',
'../tests/ShaderOpacityTest.cpp',
'../tests/SkBase64Test.cpp',
+ '../tests/SmallAllocatorTest.cpp',
'../tests/SortTest.cpp',
'../tests/SrcOverTest.cpp',
'../tests/StreamTest.cpp',