summaryrefslogtreecommitdiff
path: root/tests/glean/dsfilt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/glean/dsfilt.cpp')
-rw-r--r--tests/glean/dsfilt.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/glean/dsfilt.cpp b/tests/glean/dsfilt.cpp
index fe5ed2660..015aa64b8 100644
--- a/tests/glean/dsfilt.cpp
+++ b/tests/glean/dsfilt.cpp
@@ -163,11 +163,23 @@ DrawingSurfaceFilter::matches(DrawingSurfaceConfig& c) {
///////////////////////////////////////////////////////////////////////////////
vector<DrawingSurfaceConfig*>
DrawingSurfaceFilter::filter(vector<DrawingSurfaceConfig*>& v) {
+ return filter(v, ~0u);
+} // DrawingSurfaceFilter::filter
+
+///////////////////////////////////////////////////////////////////////////////
+// filter - filter as above, but limit number of results
+///////////////////////////////////////////////////////////////////////////////
+vector<DrawingSurfaceConfig*>
+DrawingSurfaceFilter::filter(vector<DrawingSurfaceConfig*>& v,
+ unsigned int maxConfigs) {
vector<DrawingSurfaceConfig*> result;
+ unsigned count = 0;
for (vector<DrawingSurfaceConfig*>::const_iterator p = v.begin();
- p < v.end(); ++p) {
- if (matches(**p))
+ p < v.end() && count < maxConfigs; ++p) {
+ if (matches(**p)) {
result.push_back(*p);
+ count++;
+ }
}
sort(result.begin(), result.end(), ConfigSort(sortKeys));