From 7ab04d949bae5e3ad1a5788b0497fc6ea1d86440 Mon Sep 17 00:00:00 2001 From: reed Date: Thu, 18 Jun 2015 13:42:03 -0700 Subject: [PATCH] remove dead guarded code for legacy SkData proc BUG=skia: Review URL: https://codereview.chromium.org/1173173007 --- include/core/SkData.h | 17 +---------------- src/core/SkData.cpp | 22 ---------------------- tests/DataRefTest.cpp | 12 ------------ 3 files changed, 1 insertion(+), 50 deletions(-) diff --git a/include/core/SkData.h b/include/core/SkData.h index 8a37cdee07..d9dd22de9d 100644 --- a/include/core/SkData.h +++ b/include/core/SkData.h @@ -100,13 +100,6 @@ public: */ static SkData* NewWithProc(const void* ptr, size_t length, ReleaseProc proc, void* context); -#ifdef SK_SUPPORT_LEGACY_DATARELEASEPROC_PARAMS - // This variant is temporary. - // Its signature is meant to match an older version of the API - typedef void (*LegacyReleaseProc)(const void* ptr, size_t size, void* ctx); - static SkData* NewWithProc(const void* ptr, size_t length, LegacyReleaseProc proc, void* ctx); -#endif - /** * Call this when the data parameter is already const and will outlive the lifetime of the * SkData. Suitable for with const globals. @@ -167,19 +160,11 @@ public: private: ReleaseProc fReleaseProc; void* fReleaseProcContext; -#ifdef SK_SUPPORT_LEGACY_DATARELEASEPROC_PARAMS - LegacyReleaseProc fLegacyReleaseProc; -#endif - void* fPtr; size_t fSize; -#ifdef SK_SUPPORT_LEGACY_DATARELEASEPROC_PARAMS - SkData(const void* ptr, size_t size, ReleaseProc, void* context, LegacyReleaseProc = NULL); -#else SkData(const void* ptr, size_t size, ReleaseProc, void* context); -#endif - SkData(size_t size); // inplace new/delete + explicit SkData(size_t size); // inplace new/delete virtual ~SkData(); diff --git a/src/core/SkData.cpp b/src/core/SkData.cpp index 09d7a5de98..4590e3bafe 100644 --- a/src/core/SkData.cpp +++ b/src/core/SkData.cpp @@ -12,19 +12,11 @@ #include "SkStream.h" #include "SkWriteBuffer.h" -#ifdef SK_SUPPORT_LEGACY_DATARELEASEPROC_PARAMS -SkData::SkData(const void* ptr, size_t size, ReleaseProc proc, void* context, - LegacyReleaseProc legacyProc) { -#else SkData::SkData(const void* ptr, size_t size, ReleaseProc proc, void* context) { -#endif fPtr = const_cast(ptr); fSize = size; fReleaseProc = proc; fReleaseProcContext = context; -#ifdef SK_SUPPORT_LEGACY_DATARELEASEPROC_PARAMS - fLegacyReleaseProc = legacyProc; -#endif } // This constructor means we are inline with our fPtr's contents. Thus we set fPtr @@ -36,20 +28,12 @@ SkData::SkData(size_t size) { fSize = size; fReleaseProc = NULL; fReleaseProcContext = NULL; -#ifdef SK_SUPPORT_LEGACY_DATARELEASEPROC_PARAMS - fLegacyReleaseProc = NULL; -#endif } SkData::~SkData() { if (fReleaseProc) { fReleaseProc(fPtr, fReleaseProcContext); } -#ifdef SK_SUPPORT_LEGACY_DATARELEASEPROC_PARAMS - if (fLegacyReleaseProc) { - fLegacyReleaseProc(fPtr, fSize, fReleaseProcContext); - } -#endif } bool SkData::equals(const SkData* other) const { @@ -128,12 +112,6 @@ SkData* SkData::NewWithProc(const void* ptr, size_t length, ReleaseProc proc, vo return new SkData(ptr, length, proc, context); } -#ifdef SK_SUPPORT_LEGACY_DATARELEASEPROC_PARAMS -SkData* SkData::NewWithProc(const void* ptr, size_t length, LegacyReleaseProc proc, void* ctx) { - return new SkData(ptr, length, NULL, ctx, proc); -} -#endif - // assumes fPtr was allocated with sk_fmmap static void sk_mmap_releaseproc(const void* addr, void* ctx) { size_t length = reinterpret_cast(ctx); diff --git a/tests/DataRefTest.cpp b/tests/DataRefTest.cpp index 9fcbeb0502..8f06a1892e 100644 --- a/tests/DataRefTest.cpp +++ b/tests/DataRefTest.cpp @@ -149,14 +149,6 @@ static void delete_int_proc(const void* ptr, void* context) { delete[] data; } -#ifdef SK_SUPPORT_LEGACY_DATARELEASEPROC_PARAMS -static void legacy_delete_int_proc(const void* ptr, size_t size, void* context) { - int* data = (int*)ptr; - SkASSERT(context == gGlobal); - delete[] data; -} -#endif - static void assert_len(skiatest::Reporter* reporter, SkData* ref, size_t len) { REPORTER_ASSERT(reporter, ref->size() == len); } @@ -221,10 +213,6 @@ DEF_TEST(Data, reporter) { SkAutoTUnref r2(SkData::NewWithProc(new int[N], N*sizeof(int), delete_int_proc, gGlobal)); SkAutoTUnref r3(SkData::NewSubset(r1, 7, 6)); -#ifdef SK_SUPPORT_LEGACY_DATARELEASEPROC_PARAMS - SkAutoTUnref r4(SkData::NewWithProc(new int[N], N*sizeof(int), - legacy_delete_int_proc, gGlobal)); -#endif assert_len(reporter, r0, 0); assert_len(reporter, r1, strlen(str)); -- 2.34.1