| Index: tests/DataRefTest.cpp
|
| ===================================================================
|
| --- tests/DataRefTest.cpp (revision 9702)
|
| +++ tests/DataRefTest.cpp (working copy)
|
| @@ -229,11 +229,16 @@
|
|
|
| static void* gGlobal;
|
|
|
| -static void delete_int_proc(const void* ptr, size_t len, void* context) {
|
| - int* data = (int*)ptr;
|
| - SkASSERT(context == gGlobal);
|
| - delete[] data;
|
| -}
|
| +struct DeleteIntFunctor {
|
| + explicit DeleteIntFunctor(void* context) : fContext(context) { }
|
| + void operator()(const void* ptr, size_t len) const {
|
| + int* data = (int*)ptr;
|
| + SkASSERT(fContext == gGlobal);
|
| + delete[] data;
|
| + }
|
| +private:
|
| + void* fContext;
|
| +};
|
|
|
| static void assert_len(skiatest::Reporter* reporter, SkData* ref, size_t len) {
|
| REPORTER_ASSERT(reporter, ref->size() == len);
|
| @@ -299,7 +304,7 @@
|
| SkAutoTUnref<SkData> r0(SkData::NewEmpty());
|
| SkAutoTUnref<SkData> r1(SkData::NewWithCopy(str, strlen(str)));
|
| SkAutoTUnref<SkData> r2(SkData::NewWithProc(new int[N], N*sizeof(int),
|
| - delete_int_proc, gGlobal));
|
| + DeleteIntFunctor(gGlobal)));
|
| SkAutoTUnref<SkData> r3(SkData::NewSubset(r1, 7, 6));
|
|
|
| assert_len(reporter, r0, 0);
|
|
|