Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(501)

Unified Diff: include/private/SkTDArray.h

Issue 2289783002: dedup images/blobs/pictures by ID in old serialization format (Closed)
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkPictureRecord.cpp » ('j') | src/core/SkPictureRecord.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/private/SkTDArray.h
diff --git a/include/private/SkTDArray.h b/include/private/SkTDArray.h
index d6ef3a3834141d4d1ee14021617926169fdfbe4b..f71d3570056bc33a414ab8171a8ab788dbb37297 100644
--- a/include/private/SkTDArray.h
+++ b/include/private/SkTDArray.h
@@ -217,6 +217,18 @@ public:
}
}
+ template <typename S> int select(S&& selector) const {
herb_g 2016/08/29 14:39:50 Select in many other languages usually returns ALL
+ const T* iter = fArray;
+ const T* stop = fArray + fCount;
+
+ for (; iter < stop; iter++) {
+ if (selector(*iter)) {
+ return SkToInt(iter - fArray);
+ }
+ }
+ return -1;
herb_g 2016/08/29 14:39:50 I agree with Mike. I think that count is a better
+ }
+
int find(const T& elem) const {
const T* iter = fArray;
const T* stop = fArray + fCount;
« no previous file with comments | « no previous file | src/core/SkPictureRecord.cpp » ('j') | src/core/SkPictureRecord.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698