From 91359bed48bc006a4319da86eb26db3b2e6d4afb Mon Sep 17 00:00:00 2001 From: mtklein Date: Sun, 8 Jun 2014 07:02:47 -0700 Subject: 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 --- gm/gm.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'gm/gm.h') diff --git a/gm/gm.h b/gm/gm.h index a48976b20e..90de96f7e8 100644 --- a/gm/gm.h +++ b/gm/gm.h @@ -96,8 +96,13 @@ namespace skiagm { // GM's getISize bounds. void drawSizeBounds(SkCanvas*, SkColor); - static void SetResourcePath(const char*); - static SkString GetResourcePath(); + static void SetResourcePath(const char* resourcePath) { + gResourcePath = resourcePath; + } + + static SkString& GetResourcePath() { + return gResourcePath; + } bool isCanvasDeferred() const { return fCanvasIsDeferred; } void setCanvasIsDeferred(bool isDeferred) { @@ -110,7 +115,7 @@ namespace skiagm { } protected: - static const char* gResourcePath; + static SkString gResourcePath; virtual void onOnceBeforeDraw() {} virtual void onDraw(SkCanvas*) = 0; -- cgit v1.2.3