Commit Graph

33 Commits

Author SHA1 Message Date
mtklein
04cdc4b618 Remove transitional explicit operator bool.
These should no longer be necessary. Android's STL should now
be sane.

TBR=reed
This just removes code.

Review URL: https://codereview.chromium.org/1817153002
2016-03-21 09:35:33 -07:00
mtklein
852f15da7c free -> reset
The C++ standard library uses ".reset()" where we sometimes write ".free()".
We also use ".reset()" quite a lot.  This standardizes on ".reset()".

This is one more step towards dropping SkAutoTDelete in favor of the standard
std::unique_ptr.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1811723002

Committed: https://skia.googlesource.com/skia/+/0e3738db89e86035ed5d4f629bf58b817b1e5274

Review URL: https://codereview.chromium.org/1811723002
2016-03-17 10:51:27 -07:00
bungeman
43812e24cb Revert of free -> reset (patchset #3 id:40001 of https://codereview.chromium.org/1811723002/ )
Reason for revert:
Suspect for Win10 failures.

Original issue's description:
> free -> reset
>
> The C++ standard library uses ".reset()" where we sometimes write ".free()".
> We also use ".reset()" quite a lot.  This standardizes on ".reset()".
>
> This is one more step towards dropping SkAutoTDelete in favor of the standard
> std::unique_ptr.
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1811723002
>
> Committed: https://skia.googlesource.com/skia/+/0e3738db89e86035ed5d4f629bf58b817b1e5274

TBR=reed@google.com,mtklein@google.com,mtklein@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1813843002
2016-03-17 09:53:58 -07:00
mtklein
0e3738db89 free -> reset
The C++ standard library uses ".reset()" where we sometimes write ".free()".
We also use ".reset()" quite a lot.  This standardizes on ".reset()".

This is one more step towards dropping SkAutoTDelete in favor of the standard
std::unique_ptr.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1811723002

Review URL: https://codereview.chromium.org/1811723002
2016-03-17 05:36:18 -07:00
mtklein
cc864c336d Add back SkAutoTDelete::detach() for Android temporarily.
TBR=

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1811483004

Review URL: https://codereview.chromium.org/1811483004
2016-03-16 17:33:54 -07:00
mtklein
18300a3aa7 detach -> release
The C++ standard library uses the name "release" for the operation we call "detach".

Rewriting each "detach(" to "release(" brings us a step closer to using standard library types directly (e.g. std::unique_ptr instead of SkAutoTDelete).

This was a fairly blind transformation.  There may have been unintentional conversions in here, but it's probably for the best to have everything uniformly say "release".

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1809733002

Review URL: https://codereview.chromium.org/1809733002
2016-03-16 13:53:35 -07:00
mtklein
5f939ab658 Use std::unique_ptr.
TBR=reed@google.com

Committed: https://skia.googlesource.com/skia/+/20c1e3abfc681771f73eb19fde7284196e028940

Committed: https://skia.googlesource.com/skia/+/3dd9ed37c24611af86f0fe374bd3698b63f09450
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1780933003

Committed: https://skia.googlesource.com/skia/+/2691d76a06e1af6282f8b3a3140cc93361be10c4

Review URL: https://codereview.chromium.org/1780933003
2016-03-16 10:28:35 -07:00
mtklein
e7ec417268 Revert of Use std::unique_ptr. (patchset #10 id:170001 of https://codereview.chromium.org/1780933003/ )
Reason for revert:
aww jeez, I dropped ps 8...

Original issue's description:
> Use std::unique_ptr.
>
> TBR=reed@google.com
>
> Committed: https://skia.googlesource.com/skia/+/20c1e3abfc681771f73eb19fde7284196e028940
>
> Committed: https://skia.googlesource.com/skia/+/3dd9ed37c24611af86f0fe374bd3698b63f09450
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1780933003
>
> Committed: https://skia.googlesource.com/skia/+/2691d76a06e1af6282f8b3a3140cc93361be10c4

TBR=bungeman@google.com,mtklein@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1809693002
2016-03-16 10:03:15 -07:00
mtklein
2691d76a06 Use std::unique_ptr.
TBR=reed@google.com

Committed: https://skia.googlesource.com/skia/+/20c1e3abfc681771f73eb19fde7284196e028940

Committed: https://skia.googlesource.com/skia/+/3dd9ed37c24611af86f0fe374bd3698b63f09450
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1780933003

Review URL: https://codereview.chromium.org/1780933003
2016-03-16 08:39:42 -07:00
mtklein
218c846ac0 Revert of Use std::unique_ptr. (patchset #8 id:130001 of https://codereview.chromium.org/1780933003/ )
Reason for revert:
Another Android ambiguity due to implicit bool...

frameworks/base/core/jni/android/graphics/Utils.cpp:110:35: error: call of overloaded 'SkMemoryStream(SkAutoTUnref<SkData>&)' is ambiguous
     return new SkMemoryStream(data);

Original issue's description:
> Use std::unique_ptr.
>
> TBR=reed@google.com
>
> Committed: https://skia.googlesource.com/skia/+/20c1e3abfc681771f73eb19fde7284196e028940
>
> Committed: https://skia.googlesource.com/skia/+/3dd9ed37c24611af86f0fe374bd3698b63f09450

TBR=bungeman@google.com,mtklein@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1785353002
2016-03-11 06:10:30 -08:00
mtklein
3dd9ed37c2 Use std::unique_ptr.
TBR=reed@google.com

Committed: https://skia.googlesource.com/skia/+/20c1e3abfc681771f73eb19fde7284196e028940

Review URL: https://codereview.chromium.org/1780933003
2016-03-11 05:18:48 -08:00
mtklein
977c07dad2 Revert of Use std::unique_ptr. (patchset #7 id:120001 of https://codereview.chromium.org/1780933003/ )
Reason for revert:
Now we remember!  The problem was Clank:

https://build.chromium.org/p/tryserver.chromium.android/builders/android_clang_dbg_recipe/builds/34329

Original issue's description:
> Use std::unique_ptr.
>
> TBR=reed@google.com
>
> Committed: https://skia.googlesource.com/skia/+/20c1e3abfc681771f73eb19fde7284196e028940

TBR=bungeman@google.com,mtklein@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1782973002
2016-03-10 11:31:27 -08:00
mtklein
20c1e3abfc Use std::unique_ptr.
TBR=reed@google.com

Review URL: https://codereview.chromium.org/1780933003
2016-03-10 10:10:03 -08:00
benjaminwagner
f49c75a8f1 Move Google3-specific stack limitation logic to template classes.
Remove #ifdefs in other files.

Reapplies https://codereview.chromium.org/1656143003; removing the implicit constructors for GLPtr and GLPtrAlias resolves the build issue on Android.

Also reverts https://codereview.chromium.org/1663013004

Does not change the public API.

TBR=reed
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1666203002

Review URL: https://codereview.chromium.org/1666203002
2016-02-05 07:02:38 -08:00
benjaminwagner
67e8bd2072 Revert of Move Google3-specific stack limitation logic to template classes. Remove #ifdefs in other files. (patchset #2 id:50001 of https://codereview.chromium.org/1656143003/ )
Reason for revert:
See https://codereview.chromium.org/1665603002

Original issue's description:
> Move Google3-specific stack limitation logic to template classes. Remove #ifdefs in other files.
>
> Does not change the public API.
>
> TBR=reed
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1656143003
>
> Committed: https://skia.googlesource.com/skia/+/c92159c8250c62cc47b7b63686538d61d54d2835

TBR=mtklein@google.com,reed@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1666503002
2016-02-02 16:01:39 -08:00
benjaminwagner
c92159c825 Move Google3-specific stack limitation logic to template classes. Remove #ifdefs in other files.
Does not change the public API.

TBR=reed
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1656143003

Review URL: https://codereview.chromium.org/1656143003
2016-02-02 12:48:14 -08:00
mtklein
1138be45ea Revert of skstd -> std for unique_ptr (patchset #24 id:460001 of https://codereview.chromium.org/1436033003/ )
Reason for revert:
Still need an answer for SkAdvancedTypefaceMetrics (at least for Google3 iOS build).

Original issue's description:
> skstd -> std for unique_ptr
>
> TBR=reed@google.com
> No public API changes.
>
> BUG=skia:4564
>
> Committed: https://skia.googlesource.com/skia/+/755c553c17b82bb5de3d9cc8d3b2a866ff9e9e50
>
> CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Mac10.9-Clang-x86_64-Release-CMake-Trybot,Build-Ubuntu-GCC-x86_64-Debug-CrOS_Link-Trybot;client.skia:Perf-Mac10.9-Clang-MacMini6.2-CPU-AVX-x86_64-Release-Trybot,Test-iOS-Clang-iPad4-GPU-SGX554-Arm7-Release-Trybot
>
> Committed: https://skia.googlesource.com/skia/+/06189155d987db5c7e69015f6ea87c2168d6a065
>
> Committed: https://skia.googlesource.com/skia/+/70e8dfca4a7f5bce97b8021a6e378c4828b09c8c
>
> Committed: https://skia.googlesource.com/skia/+/dadfc245cc9a0279ff7b73da3344f2ca5d139907
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1436033003
>
> Committed: https://skia.googlesource.com/skia/+/ccf1de0d9aa75f29829f1c4c462214b991fd8c9e

TBR=bungeman@google.com,mtklein@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:4564

Review URL: https://codereview.chromium.org/1626873004
2016-01-24 19:49:24 -08:00
mtklein
ccf1de0d9a skstd -> std for unique_ptr
TBR=reed@google.com
No public API changes.

BUG=skia:4564

Committed: https://skia.googlesource.com/skia/+/755c553c17b82bb5de3d9cc8d3b2a866ff9e9e50

CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Mac10.9-Clang-x86_64-Release-CMake-Trybot,Build-Ubuntu-GCC-x86_64-Debug-CrOS_Link-Trybot;client.skia:Perf-Mac10.9-Clang-MacMini6.2-CPU-AVX-x86_64-Release-Trybot,Test-iOS-Clang-iPad4-GPU-SGX554-Arm7-Release-Trybot

Committed: https://skia.googlesource.com/skia/+/06189155d987db5c7e69015f6ea87c2168d6a065

Committed: https://skia.googlesource.com/skia/+/70e8dfca4a7f5bce97b8021a6e378c4828b09c8c

Committed: https://skia.googlesource.com/skia/+/dadfc245cc9a0279ff7b73da3344f2ca5d139907
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1436033003

Review URL: https://codereview.chromium.org/1436033003
2016-01-24 19:18:54 -08:00
bungeman
221524de3b Start using <type_traits> and <utility> (C++11).
SkUtility.h and SkTLogic.h implement a number of type traits now
available through <type_traits> and <utility>. This removes SkUtility.h,
replacing it with <utility>, and moves a number of traits in
SkTLogic.h to use the std:: equivelents. This change only uses C++11
parts of the standard library; SkTLogic.h will continue to provide
C++14 and beyond for now in the skstd namespace.

The changes to SkTLogic.h are being done gradually so that safe changes
may be landed confidently, with more risky changes in the future.

Review URL: https://codereview.chromium.org/1561683002
2016-01-05 14:59:40 -08:00
scroggo
565901db95 Switch SkAutoMalloc to SkAutoTMalloc to avoid cast
Make SkAutoTMalloc's interface look more like SkAutoMalloc:
- add free(), which does what you expect
- make reset() return a pointer fPtr

No public API changes (SkAutoTMalloc is in include/private)

BUG=skia:2148

Review URL: https://codereview.chromium.org/1516833003
2015-12-10 10:44:13 -08:00
mtklein
5c05d10511 Revert of skstd -> std for unique_ptr (patchset #17 id:320001 of https://codereview.chromium.org/1436033003/ )
Reason for revert:
Chromium bots can't handle forward declared types, e.g.

struct Foo {
   int x,y;
   std::unique_ptr<Foo> next;
};

https://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_asan_rel_ng/builds/86497

Original issue's description:
> skstd -> std for unique_ptr
>
> TBR=reed@google.com
> No public API changes.
>
> BUG=skia:4564
>
> Committed: https://skia.googlesource.com/skia/+/755c553c17b82bb5de3d9cc8d3b2a866ff9e9e50
>
> CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Mac10.9-Clang-x86_64-Release-CMake-Trybot,Build-Ubuntu-GCC-x86_64-Debug-CrOS_Link-Trybot;client.skia:Perf-Mac10.9-Clang-MacMini6.2-CPU-AVX-x86_64-Release-Trybot,Test-iOS-Clang-iPad4-GPU-SGX554-Arm7-Release-Trybot
>
> Committed: https://skia.googlesource.com/skia/+/06189155d987db5c7e69015f6ea87c2168d6a065
>
> Committed: https://skia.googlesource.com/skia/+/70e8dfca4a7f5bce97b8021a6e378c4828b09c8c
>
> Committed: https://skia.googlesource.com/skia/+/dadfc245cc9a0279ff7b73da3344f2ca5d139907

TBR=bungeman@google.com,mtklein@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:4564

Review URL: https://codereview.chromium.org/1498583002
2015-12-02 12:32:02 -08:00
mtklein
dadfc245cc skstd -> std for unique_ptr
TBR=reed@google.com
No public API changes.

BUG=skia:4564

Committed: https://skia.googlesource.com/skia/+/755c553c17b82bb5de3d9cc8d3b2a866ff9e9e50

CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Mac10.9-Clang-x86_64-Release-CMake-Trybot,Build-Ubuntu-GCC-x86_64-Debug-CrOS_Link-Trybot;client.skia:Perf-Mac10.9-Clang-MacMini6.2-CPU-AVX-x86_64-Release-Trybot,Test-iOS-Clang-iPad4-GPU-SGX554-Arm7-Release-Trybot

Committed: https://skia.googlesource.com/skia/+/06189155d987db5c7e69015f6ea87c2168d6a065

Committed: https://skia.googlesource.com/skia/+/70e8dfca4a7f5bce97b8021a6e378c4828b09c8c

Review URL: https://codereview.chromium.org/1436033003
2015-12-02 10:46:18 -08:00
mtklein
e066df9673 Revert of skstd -> std for unique_ptr (patchset #16 id:300001 of https://codereview.chromium.org/1436033003/ )
Reason for revert:
Test-iOS-Clang-iPad4-GPU-SGX554-Arm7-Release

Original issue's description:
> skstd -> std for unique_ptr
>
> TBR=reed@google.com
> No public API changes.
>
> BUG=skia:4564
>
> Committed: https://skia.googlesource.com/skia/+/755c553c17b82bb5de3d9cc8d3b2a866ff9e9e50
>
> CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Mac10.9-Clang-x86_64-Release-CMake-Trybot,Build-Ubuntu-GCC-x86_64-Debug-CrOS_Link-Trybot;client.skia:Perf-Mac10.9-Clang-MacMini6.2-CPU-AVX-x86_64-Release-Trybot
>
> Committed: https://skia.googlesource.com/skia/+/06189155d987db5c7e69015f6ea87c2168d6a065
>
> Committed: https://skia.googlesource.com/skia/+/70e8dfca4a7f5bce97b8021a6e378c4828b09c8c

TBR=bungeman@google.com,mtklein@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:4564

Review URL: https://codereview.chromium.org/1482343002
2015-11-30 07:17:39 -08:00
mtklein
70e8dfca4a skstd -> std for unique_ptr
TBR=reed@google.com
No public API changes.

BUG=skia:4564

Committed: https://skia.googlesource.com/skia/+/755c553c17b82bb5de3d9cc8d3b2a866ff9e9e50

CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Mac10.9-Clang-x86_64-Release-CMake-Trybot,Build-Ubuntu-GCC-x86_64-Debug-CrOS_Link-Trybot;client.skia:Perf-Mac10.9-Clang-MacMini6.2-CPU-AVX-x86_64-Release-Trybot

Committed: https://skia.googlesource.com/skia/+/06189155d987db5c7e69015f6ea87c2168d6a065

Review URL: https://codereview.chromium.org/1436033003
2015-11-30 07:07:02 -08:00
mtklein
dfd7d48ced Revert of skstd -> std for unique_ptr (patchset #16 id:300001 of https://codereview.chromium.org/1436033003/ )
Reason for revert:
Perf-Mac10.9-Clang-MacMini6.2-CPU-AVX-x86_64-Release has not updated yet.

Original issue's description:
> skstd -> std for unique_ptr
>
> TBR=reed@google.com
> No public API changes.
>
> BUG=skia:4564
>
> Committed: https://skia.googlesource.com/skia/+/755c553c17b82bb5de3d9cc8d3b2a866ff9e9e50
>
> CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Mac10.9-Clang-x86_64-Release-CMake-Trybot,Build-Ubuntu-GCC-x86_64-Debug-CrOS_Link-Trybot
>
> Committed: https://skia.googlesource.com/skia/+/06189155d987db5c7e69015f6ea87c2168d6a065

TBR=bungeman@google.com,mtklein@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:4564

Review URL: https://codereview.chromium.org/1467333002
2015-11-23 09:19:37 -08:00
mtklein
06189155d9 skstd -> std for unique_ptr
TBR=reed@google.com
No public API changes.

BUG=skia:4564

Committed: https://skia.googlesource.com/skia/+/755c553c17b82bb5de3d9cc8d3b2a866ff9e9e50

CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Mac10.9-Clang-x86_64-Release-CMake-Trybot,Build-Ubuntu-GCC-x86_64-Debug-CrOS_Link-Trybot

Review URL: https://codereview.chromium.org/1436033003
2015-11-23 09:12:31 -08:00
mtklein
566b23c571 Revert of skstd -> std for unique_ptr (patchset #9 id:160001 of https://codereview.chromium.org/1436033003/ )
Reason for revert:
10.9 bots are too old too.

Original issue's description:
> skstd -> std for unique_ptr
>
> TBR=reed@google.com
> No public API changes.
>
> BUG=skia:4564
>
> Committed: https://skia.googlesource.com/skia/+/755c553c17b82bb5de3d9cc8d3b2a866ff9e9e50

TBR=bungeman@google.com,mtklein@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:4564

Review URL: https://codereview.chromium.org/1446413002
2015-11-16 13:05:37 -08:00
mtklein
755c553c17 skstd -> std for unique_ptr
TBR=reed@google.com
No public API changes.

BUG=skia:4564

Review URL: https://codereview.chromium.org/1436033003
2015-11-16 12:57:52 -08:00
bungeman
a3434d83cf Add skstd::unique_ptr and use it.
TBR=bsalomon@google.com
The one gpu include change is just to fix swap in implementation.

Review URL: https://codereview.chromium.org/1330503006
2015-09-07 12:45:52 -07:00
bungeman
761cf6186e Clean up SkTLogic.
This change regularizes Skia's type traits so that when <type_traits>
can finally be used the transition is easier. Various traits are
renamed to match <type_traits> and placed in the skstd namespace.
Current users of these traits are updated.

Review URL: https://codereview.chromium.org/1317593004
2015-08-28 07:09:20 -07:00
halcanary
385fe4d4b6 Style Change: SkNEW->new; SkDELETE->delete
DOCS_PREVIEW= https://skia.org/?cl=1316123003

Review URL: https://codereview.chromium.org/1316123003
2015-08-26 13:07:49 -07:00
bungeman
afd7c74972 Remove SK_OFFSETOF from SkTypes, clean up offsetof usage.
The motivation for this was to remove SK_OFFSETOF from SkTypes, but
this CL is mostly about cleaning up our use of offsetof generally.

SK_OFFSETOF is removed to SkTypes and added to the two places it is
actually used (for the non standard behavior of finding the offset of
fields in types which are not standard layout).

Older versions of gcc required POD for offsetof to be used without
warning. Newer versions require the more relaxed standard layout.
Now that we no longer build on older versions of gcc, remove the
old warning suppressions.

PODMatrix is renamed to AggregateMatrix. SkMatrix is already POD
(trivial and standard layout). The PODMatrix name implies that the
POD-ness is needed for the offsetof, but it is actually the aggregate
attribute which is needed for compile time constant initialization.
This makes it more obvious that this can be revisited after we can
rely on constexpr constructors.

This also adds skstd::declval since this allows removal of existing
awkward code which casts a constant to a pointer to find the size of
a field.

TBR=reed@google.com
No API change, only removes unused macro.

Review URL: https://codereview.chromium.org/1309523003
2015-08-25 12:05:55 -07:00
bungeman
f3c15b7cfc Move SkTemplates.h to private.
SkTemplates.h contains a number of Skia specific utilities which are
not designed for external use. In addition to reducing the external
support burden, this will allow Skia to freely refactor this file.

Review URL: https://codereview.chromium.org/1272293004
2015-08-19 11:56:48 -07:00