reed
647cc84748
Add sk_ref_sp helper function.
...
Review URL: https://codereview.chromium.org/1773943004
2016-03-08 12:54:48 -08:00
bungeman
c901c11549
Add element_type, swap, operators, fix reset on sk_sp.
...
The 'element_type' typedef is to play nice with std::pointer_traits.
The full complement of operators and swap to match unique_ptr so that
sk_sp can be properly compared to nullptr and used with standard
containers.
Update to 'reset' so that calling 'unref' is the last operation.
This also adds tests for these changes, and sets the fPtr to nullptr
in debug for easier bug finding.
Review URL: https://codereview.chromium.org/1773453002
2016-03-08 08:35:23 -08:00
mtklein
71aca54991
add virtual ~Effect()
...
Today we make an sk_sp<Effect> from an sk_sp<EffectImpl>.
But when the sk_sp<Effect> dies, it calls ~Effect(), not ~EffectImpl().
Making ~Effect() virtual fixes this.
This should make our Google3 tests sized-delete clean, unblocking those folks.
Review URL: https://codereview.chromium.org/1769093002
2016-03-07 12:28:17 -08:00
reed
941da9d661
Fix behavior of sk_sp::reset(T*) and add unittest.
...
Previously, sk_sp::reset(T* t) did not release its own reference
if its internal pointer was the same as 't'. This leaks a reference.
Now always release the current reference when non-nullptr.
Review URL: https://codereview.chromium.org/1767983002
2016-03-06 13:54:00 -08:00
halcanary
ffa39e02bc
sk_sp: fix contravariant constructors
...
TBR=reed
This is obviously correct and needs to be fixed.
Review URL: https://codereview.chromium.org/1771583002
2016-03-05 08:30:28 -08:00
bungeman
beab9e7ba0
Add operator* and operator safe-bool to sk_sp.
...
This greatly reduces the need to use '.get()' in conditionals.
Review URL: https://codereview.chromium.org/1760453004
2016-03-03 07:50:49 -08:00
halcanary
cb6cb3841a
sk_sp: Covariant Move Constructor and Move Assignment
...
Also Covariant Copy Constructor, Copy Assignment,
and comparison operators.
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1752093002
Review URL: https://codereview.chromium.org/1752093002
2016-03-02 08:11:26 -08:00
halcanary
217c0b3f13
sk_make_sp<T>()
...
because
auto atm = sk_make_sp<SkAdvancedTypefaceMetrics>();
is better than
sk_sp<SkAdvancedTypefaceMetrics> atm(new SkAdvancedTypefaceMetrics);
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1753973002
Review URL: https://codereview.chromium.org/1753973002
2016-03-02 08:06:20 -08:00
reed
bb7b043b2d
isolate sk_sp from larger cl
...
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1752683002
Review URL: https://codereview.chromium.org/1752683002
2016-03-01 07:28:51 -08:00
mtklein
a1bde7d2e1
Remove SkThread::setProcessorAffinity()
...
It's only used by a couple unit tests. We have other ways of getting
the same quality testing of our ref-count code now (e.g. TSAN).
BUG=skia:
CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Ubuntu-GCC-x86_64-Release-CMake-Trybot,Build-Mac10.9-Clang-x86_64-Release-CMake-Trybot
Review URL: https://codereview.chromium.org/1408213005
2015-10-20 11:05:06 -07:00
bungeman
693e993057
Remove unused InstCounterClass.
...
This was added with r4719 (f7943035
) to support testing
SkTRefArray. With 703d3c70
SkTRefArray and the associated test was
removed, but the supporting InstCounterClass was not.
Review URL: https://codereview.chromium.org/1063403003
2015-04-08 08:06:26 -07:00
mtklein
bbb61d7268
make SkRefCnt::getRefCnt() debug-only, remove it from SkNVRefCnt.
...
Only (unused) API removed.
TBR=reed@google.com
BUG=skia:3160
Review URL: https://codereview.chromium.org/752263002
2014-11-24 13:09:39 -08:00
mtklein
703d3c7093
Followup: remove unnecessary SkTRefArray
...
BUG=skia:
Review URL: https://codereview.chromium.org/719113004
2014-11-12 11:08:20 -08:00
Mike Klein
874a62acef
Revert "Remove ability for Release code to call getRefCnt() or getWeakRefCnt()."
...
This reverts commit 4ae94ffce5
.
BUG=skia:
Review URL: https://codereview.chromium.org/382523002
2014-07-09 09:04:07 -04:00
mtklein
4ae94ffce5
Remove ability for Release code to call getRefCnt() or getWeakRefCnt().
...
These getRefCnt() methods are not thread safe, so Skia code should not
be calling them. unique() is fine.
SkDEBUG code (SkASSERTs) can still call getRefCnt() / getWeakRefCnt().
This adds tools/RefCntIs.{h,cpp}, which lets tests make their assertions in
both debug and release modes.
BUG=skia:2726
R=senorblanco@chromium.org , mtklein@google.com , reed@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/378643003
2014-07-08 06:48:17 -07:00
tfarina@chromium.org
8f6884aab8
Cleanup: Sanitize the order of includes under tests/
...
Initially this was to make sure Test.h appeared after the Sk*.h includes.
Patch generated by the following command line:
$ ~/chromium/src/tools/sort-headers.py tests/*.cpp
BUG=None
TEST=tests
R=robertphillips@google.com
Review URL: https://codereview.chromium.org/145313004
git-svn-id: http://skia.googlecode.com/svn/trunk@13177 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-01-24 20:56:26 +00:00
commit-bot@chromium.org
e2eac8b2fd
Move macros from TestClassDef.h to Test.h
...
Motivation: those macros don't make any sense without the definitions
in Test.h.
BUG=
R=mtklein@google.com
Author: halcanary@google.com
Review URL: https://codereview.chromium.org/138563004
git-svn-id: http://skia.googlecode.com/svn/trunk@13074 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-01-14 21:04:37 +00:00
tfarina@chromium.org
e4fafb146e
Use DEFINE_TESTCLASS_SHORT macro in tests.
...
The three version of DEFINE_TESTCLASS macro is deprecated and thus just
use the simple, short one.
BUG=None
TEST=out/Debug/tests
R=mtklein@google.com , bsalomon@google.com , robertphillips@google.com
Review URL: https://codereview.chromium.org/100113004
git-svn-id: http://skia.googlecode.com/svn/trunk@12653 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-12-12 21:11:12 +00:00
rmistry@google.com
d6176b0dca
Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/ )
...
This CL is part II of IV (I broke down the 1280 files into 4 CLs).
Review URL: https://codereview.appspot.com/6474054
git-svn-id: http://skia.googlecode.com/svn/trunk@5263 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-08-23 18:14:13 +00:00
reed@google.com
f79430350d
add protected method for internal_dispose overrides to jam fRefCnt before
...
calling destructor.
move SkTRefArray to actually inherit from SkRefCnt
Review URL: https://codereview.appspot.com/6422057
git-svn-id: http://skia.googlecode.com/svn/trunk@4719 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-07-23 14:50:38 +00:00
reed@google.com
80ba7964cd
add SkTRefArray, in hopes that it will enable more sharing between pictureplaybacks
...
in different threads.
git-svn-id: http://skia.googlecode.com/svn/trunk@4709 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-07-21 17:31:40 +00:00
bungeman@google.com
a02bc1519c
WeakRefCnt
...
http://codereview.appspot.com/5649046/
git-svn-id: http://skia.googlecode.com/svn/trunk@3978 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-05-16 18:21:56 +00:00
bungeman@google.com
5548752100
Add bench and test for SkRefCnt.
...
http://codereview.appspot.com/6195071/
This also adds a cross platform SkThread for testing purposes.
git-svn-id: http://skia.googlecode.com/svn/trunk@3921 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-05-14 14:09:24 +00:00