aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPtrRecorder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/SkPtrRecorder.cpp')
-rw-r--r--src/core/SkPtrRecorder.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/core/SkPtrRecorder.cpp b/src/core/SkPtrRecorder.cpp
index fa640cb32b..6d5d95d6f4 100644
--- a/src/core/SkPtrRecorder.cpp
+++ b/src/core/SkPtrRecorder.cpp
@@ -15,6 +15,22 @@ int SkPtrSet::Cmp(const Pair& a, const Pair& b) {
return (char*)a.fPtr - (char*)b.fPtr;
}
+uint32_t SkPtrSet::find(void* ptr) const {
+ if (NULL == ptr) {
+ return 0;
+ }
+
+ int count = fList.count();
+ Pair pair;
+ pair.fPtr = ptr;
+
+ int index = SkTSearch<Pair>(fList.begin(), count, pair, sizeof(pair), &Cmp);
+ if (index < 0) {
+ return 0;
+ }
+ return fList[index].fIndex;
+}
+
uint32_t SkPtrSet::add(void* ptr) {
if (NULL == ptr) {
return 0;