Re: Add SkSTDArray. (issue 14502003)

4 views
Skip to first unread message

bung...@google.com

unread,
Apr 22, 2015, 6:20:29 PM4/22/15
to re...@google.com, mtk...@google.com, joshu...@google.com, skia-...@googlegroups.com
Reviewers: reed1, mtklein, joshualitt,

Message:
Joshua was complaining this didn't exist today, so I dug it out of
retirement
for him to take a look at it. It was surprisingly easy to do a quick merge
(git
is pretty amazing), and being able to run CQ on a two year old review based
on a
no longer existing project url is pretty cool. In any event, Joshua, it's
all
yours.


https://codereview.chromium.org/14502003/diff/61001/include/core/SkTDArray.h
File include/core/SkTDArray.h (right):

https://codereview.chromium.org/14502003/diff/61001/include/core/SkTDArray.h#newcode64
include/core/SkTDArray.h:64: void swap(SkTDArray<T>& other) {
This swap is wrong for any STD versions, haven't thought about how to
fix.

Description:
Add SkSTDArray.

Please review this at https://codereview.chromium.org/14502003/

Base URL: http://skia.googlecode.com/svn/trunk/

Affected files (+275, -67 lines):
M gyp/tests.gypi
M include/core/SkTDArray.h
A tests/TDArrayTest.cpp


re...@google.com

unread,
Apr 22, 2015, 7:02:12 PM4/22/15
to bung...@google.com, mtk...@google.com, joshu...@google.com, skia-...@googlegroups.com
Since it seems to add complexity (and overhead) to all SkTDArrays, is there
any
way to add it "template-wise" so that instances that do not take advantage
of it
don't have to pay for the extra code/size?

Where did Josh want to use this?
https://codereview.chromium.org/14502003/diff/61001/include/core/SkTDArray.h#newcode389
include/core/SkTDArray.h:389: size_t fReserve;
Why change fReserve and fCount from int to size_t? Clearly in some
places we had to add casts. Can these stay ints?

https://codereview.chromium.org/14502003/

joshu...@google.com

unread,
Apr 22, 2015, 7:21:51 PM4/22/15
to bung...@google.com, re...@google.com, mtk...@google.com, skia-...@googlegroups.com
On 2015/04/22 23:02:12, reed1 wrote:
> Since it seems to add complexity (and overhead) to all SkTDArrays, is
> there
any
> way to add it "template-wise" so that instances that do not take
> advantage of
it
> don't have to pay for the extra code/size?

> Where did Josh want to use this?
src/gpu/GrBatchAtlas.h:98 SkSTArray<kMinItems, int, true> fPlotsToUpdate, I
can,
however, use SkAutoSTMalloc and just manually do the copying / moving about
myself. If I have a chance tomorrow, maybe I can find a way to reduce the
cost.
Reply all
Reply to author
Forward
0 new messages