2015-03-25 17:22:41 +00:00
|
|
|
# Copyright 2015 Google Inc.
|
|
|
|
#
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
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': [
|
2015-07-28 15:55:14 +00:00
|
|
|
'../include/private',
|
2015-04-09 19:43:10 +00:00
|
|
|
'../src/codec',
|
2014-02-26 16:31:22 +00:00
|
|
|
'../src/core',
|
|
|
|
'../src/effects',
|
|
|
|
'../src/image',
|
|
|
|
'../src/lazy',
|
|
|
|
'../src/images',
|
|
|
|
'../src/pathops',
|
|
|
|
'../src/pdf',
|
2015-07-15 17:58:47 +00:00
|
|
|
'../src/ports',
|
2014-02-26 16:31:22 +00:00
|
|
|
'../src/utils',
|
2016-02-09 20:44:06 +00:00
|
|
|
'../tools/debugger',
|
2014-02-26 16:31:22 +00:00
|
|
|
],
|
|
|
|
'dependencies': [
|
|
|
|
'experimental.gyp:experimental',
|
2014-07-22 17:15:34 +00:00
|
|
|
'flags.gyp:flags_common',
|
2014-02-26 16:31:22 +00:00
|
|
|
'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',
|
2015-08-18 20:30:25 +00:00
|
|
|
'zlib.gyp:zlib',
|
2014-02-26 16:31:22 +00:00
|
|
|
],
|
2014-07-22 20:56:34 +00:00
|
|
|
'conditions': [
|
2016-04-29 21:01:34 +00:00
|
|
|
[ 'skia_os not in ["linux", "freebsd", "openbsd", "solaris", "android"]', {
|
2015-06-23 20:25:46 +00:00
|
|
|
'sources!': [ '../tests/FontMgrAndroidParserTest.cpp', ],
|
2015-07-15 17:58:47 +00:00
|
|
|
}],
|
2015-08-11 17:30:12 +00:00
|
|
|
[ 'not skia_pdf', {
|
2015-08-18 20:30:25 +00:00
|
|
|
'dependencies!': [ 'pdf.gyp:pdf', 'zlib.gyp:zlib' ],
|
2015-08-11 17:30:12 +00:00
|
|
|
'dependencies': [ 'pdf.gyp:nopdf' ],
|
2016-08-02 21:28:26 +00:00
|
|
|
'sources!': [ '<!@(python find.py "PDF*.c*" ../tests)', ],
|
2015-08-11 17:30:12 +00:00
|
|
|
}],
|
2015-08-12 13:51:08 +00:00
|
|
|
[ 'skia_gpu_extra_tests_path', {
|
|
|
|
'sources': [
|
2016-08-02 21:28:26 +00:00
|
|
|
'<!@(python find.py "*.c*" <(skia_gpu_extra_tests_path))',
|
2015-08-12 13:51:08 +00:00
|
|
|
],
|
|
|
|
}],
|
2014-07-22 20:56:34 +00:00
|
|
|
],
|
2014-02-26 16:31:22 +00:00
|
|
|
'sources': [
|
|
|
|
'../tests/Test.h',
|
2016-08-02 21:28:26 +00:00
|
|
|
'<!@(python find.py "*.c*" ../tests)',
|
2016-02-09 20:44:06 +00:00
|
|
|
'../tools/debugger/SkDrawCommand.h',
|
|
|
|
'../tools/debugger/SkDrawCommand.cpp',
|
|
|
|
'../tools/debugger/SkDebugCanvas.h',
|
|
|
|
'../tools/debugger/SkDebugCanvas.cpp',
|
2016-05-04 18:06:28 +00:00
|
|
|
'../tools/debugger/SkJsonWriteBuffer.h',
|
|
|
|
'../tools/debugger/SkJsonWriteBuffer.cpp',
|
2016-02-09 20:44:06 +00:00
|
|
|
'../tools/debugger/SkObjectParser.h',
|
|
|
|
'../tools/debugger/SkObjectParser.cpp',
|
|
|
|
'../tools/debugger/SkOverdrawMode.h',
|
|
|
|
'../tools/debugger/SkOverdrawMode.cpp',
|
2014-02-26 16:31:22 +00:00
|
|
|
],
|
2015-05-17 13:47:49 +00:00
|
|
|
'sources!': [
|
|
|
|
'../tests/SkpSkGrTest.cpp',
|
|
|
|
'../tests/skia_test.cpp',
|
|
|
|
'../tests/PathOpsAngleIdeas.cpp',
|
|
|
|
'../tests/PathOpsBattles.cpp',
|
|
|
|
'../tests/PathOpsCubicLineIntersectionIdeas.cpp',
|
|
|
|
'../tests/PathOpsDebug.cpp',
|
|
|
|
'../tests/PathOpsOpLoopThreadedTest.cpp',
|
|
|
|
'../tests/PathOpsSkpClipTest.cpp',
|
|
|
|
],
|
2014-02-26 16:31:22 +00:00
|
|
|
}
|