aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@google.com>2014-06-08 07:02:47 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-06-08 07:02:47 -0700
commit91359bed48bc006a4319da86eb26db3b2e6d4afb (patch)
tree923d1ac57009191855db0b4a49b487d9bf39a283 /bench
parent643b8bd6617e333f7a970a57ad9166f3d6675d1a (diff)
Revert of Clean up Test's resourcePath code. (https://codereview.chromium.org/319473003/)
Reason for revert: Some benchmarks are written in a way that makes this change unsafe (e.g. const char* resPath = GetResourcePath().c_str(); in SkipZeroesBench) and Valgrind and ASAN caught that. We can try again after a more careful cleanup of GetResourcePath(). Original issue's description: > Clean up resourcePath code. > > 1) Make the implementation of SetResourcePath/GetResourcePath of GM and SkBenchmark match with the one in Test. > 2) Make gResourcePath a static pointer to const char and move it inside the classes. > > BUG=None > TEST=make tests && out/Debug/tests > make gm && out/Debug/gm > make bench && out/Debug/bench > R=mtklein@google.com > > Committed: https://skia.googlesource.com/skia/+/52e4f413ffe2d281f9e90ff2147db08083ffcba7 R=tfarina@chromium.org TBR=tfarina@chromium.org NOTREECHECKS=true NOTRY=true BUG=None Author: mtklein@google.com Review URL: https://codereview.chromium.org/320733002
Diffstat (limited to 'bench')
-rw-r--r--bench/SkBenchmark.cpp9
-rw-r--r--bench/SkBenchmark.h7
2 files changed, 5 insertions, 11 deletions
diff --git a/bench/SkBenchmark.cpp b/bench/SkBenchmark.cpp
index 1f12ed339f..d995415632 100644
--- a/bench/SkBenchmark.cpp
+++ b/bench/SkBenchmark.cpp
@@ -12,7 +12,7 @@ const char* SkTriState::Name[] = { "default", "true", "false" };
template BenchRegistry* BenchRegistry::gHead;
-const char* SkBenchmark::gResourcePath;
+SkString SkBenchmark::gResourcePath;
SkBenchmark::SkBenchmark() {
fForceAlpha = 0xFF;
@@ -55,13 +55,6 @@ void SkBenchmark::setupPaint(SkPaint* paint) {
}
}
-void SkBenchmark::SetResourcePath(const char* resourcePath) {
- gResourcePath = resourcePath;
-}
-
-SkString SkBenchmark::GetResourcePath() {
- return SkString(gResourcePath);
-}
///////////////////////////////////////////////////////////////////////////////
diff --git a/bench/SkBenchmark.h b/bench/SkBenchmark.h
index 00a816cdba..bf28689236 100644
--- a/bench/SkBenchmark.h
+++ b/bench/SkBenchmark.h
@@ -107,8 +107,9 @@ public:
fClearMask = clearMask;
}
- static void SetResourcePath(const char*);
- static SkString GetResourcePath();
+ static void SetResourcePath(const char* resPath) { gResourcePath.set(resPath); }
+
+ static SkString& GetResourcePath() { return gResourcePath; }
protected:
virtual void setupPaint(SkPaint* paint);
@@ -128,7 +129,7 @@ private:
bool fForceFilter;
SkTriState::State fDither;
uint32_t fOrMask, fClearMask;
- static const char* gResourcePath;
+ static SkString gResourcePath;
typedef SkRefCnt INHERITED;
};