aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar bungeman <bungeman@google.com>2016-04-14 09:44:34 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-14 09:44:34 -0700
commita821af83890d3b365c7b871f939737d47c48139c (patch)
tree5f888942bf21d15dccd1116a9926635a2c2e007b
parentfbcfd6d060f4d42e6b9de70f676564fcf1d97eb5 (diff)
Put SkEmptyTypeface in anonymous namespace.
We ended up with two SkEmptyTypefaces it differnt places. Avoid this odr violation by sticking these in anonymous namespaces. Review URL: https://codereview.chromium.org/1887093002
-rw-r--r--src/core/SkTypeface.cpp4
-rw-r--r--tests/TypefaceTest.cpp4
2 files changed, 8 insertions, 0 deletions
diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp
index 07b1467360..855ef909e8 100644
--- a/src/core/SkTypeface.cpp
+++ b/src/core/SkTypeface.cpp
@@ -33,6 +33,8 @@ SkTypeface* (*gDeserializeTypefaceDelegate)(SkStream* ) = nullptr;
///////////////////////////////////////////////////////////////////////////////
+namespace {
+
class SkEmptyTypeface : public SkTypeface {
public:
static SkEmptyTypeface* Create() { return new SkEmptyTypeface; }
@@ -74,6 +76,8 @@ protected:
}
};
+}
+
SK_DECLARE_STATIC_MUTEX(gCreateDefaultMutex);
SK_DECLARE_STATIC_ONCE_PTR(SkTypeface, defaults[4]);
diff --git a/tests/TypefaceTest.cpp b/tests/TypefaceTest.cpp
index 130cabf37a..950449d9c1 100644
--- a/tests/TypefaceTest.cpp
+++ b/tests/TypefaceTest.cpp
@@ -27,6 +27,8 @@ DEF_TEST(Typeface, reporter) {
#endif
}
+namespace {
+
class SkEmptyTypeface : public SkTypeface {
public:
static sk_sp<SkTypeface> Create(SkFontID id) { return sk_sp<SkTypeface>(new SkEmptyTypeface(id)); }
@@ -59,6 +61,8 @@ protected:
size_t onGetTableData(SkFontTableTag, size_t, size_t, void*) const override { return 0; }
};
+}
+
static bool count_proc(SkTypeface* face, void* ctx) {
int* count = static_cast<int*>(ctx);
*count = *count + 1;