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

Unified Diff: bench/benchmain.cpp

Issue 19537005: Revert r10280, which caused https://code.google.com/p/skia/issues/detail?id=1441 (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 5 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 | gm/gmmain.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/benchmain.cpp
===================================================================
--- bench/benchmain.cpp (revision 10283)
+++ bench/benchmain.cpp (working copy)
@@ -22,7 +22,6 @@
#include "SkBenchLogger.h"
#include "SkBenchmark.h"
#include "SkCanvas.h"
-#include "SkCommandLineFlags.h"
#include "SkDeferredCanvas.h"
#include "SkDevice.h"
#include "SkColorPriv.h"
@@ -271,6 +270,38 @@
return -1;
}
+static bool skip_name(const SkTDArray<const char*> array, const char name[]) {
+ // FIXME: this duplicates the logic in skia_test.cpp, gmmain.cpp -- consolidate
+ int count = array.count();
+ size_t testLen = strlen(name);
+ bool anyExclude = count == 0;
+ for (int i = 0; i < array.count(); ++i) {
+ const char* matchName = array[i];
+ size_t matchLen = strlen(matchName);
+ bool matchExclude, matchStart, matchEnd;
+ if ((matchExclude = matchName[0] == '~')) {
+ anyExclude = true;
+ matchName++;
+ matchLen--;
+ }
+ if ((matchStart = matchName[0] == '^')) {
+ matchName++;
+ matchLen--;
+ }
+ if ((matchEnd = matchName[matchLen - 1] == '$')) {
+ matchLen--;
+ }
+ if (matchStart ? (!matchEnd || matchLen == testLen)
+ && strncmp(name, matchName, matchLen) == 0
+ : matchEnd ? matchLen <= testLen
+ && strncmp(name + testLen - matchLen, matchName, matchLen) == 0
+ : strstr(name, matchName) != 0) {
+ return matchExclude;
+ }
+ }
+ return !anyExclude;
+}
+
static void help() {
SkString configsStr;
static const size_t kConfigCount = SK_ARRAY_COUNT(gConfigs);
@@ -740,7 +771,7 @@
}
// only run benchmarks if their name contains matchStr
- if (SkCommandLineFlags::ShouldSkip(fMatches, bench->getName())) {
+ if (skip_name(fMatches, bench->getName())) {
continue;
}
« no previous file with comments | « no previous file | gm/gmmain.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698