diff options
author | kulshin <kulshin@chromium.org> | 2016-02-16 16:09:16 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-17 00:10:15 +0000 |
commit | 3f0cbf682e7dfe5ee8ebc171e473cece02c6c3cc (patch) | |
tree | 23abd5016e5d9027afb1f79052ef37846bd3f47f /skia | |
parent | ad66827206bf24e41a4afa7dd7c3083157506c6c (diff) | |
download | chromium_src-3f0cbf682e7dfe5ee8ebc171e473cece02c6c3cc.zip chromium_src-3f0cbf682e7dfe5ee8ebc171e473cece02c6c3cc.tar.gz chromium_src-3f0cbf682e7dfe5ee8ebc171e473cece02c6c3cc.tar.bz2 |
Add plumbing in blink to allow overriding the skia font manager. This allows Chromium to use a custom font collection with skia, without having to patch the vtable of the DirectWrite factory.
BUG=
patch from issue 1591883002 at patchset 300001 (http://crrev.com/1591883002#ps300001)
Review URL: https://codereview.chromium.org/1691073002
Cr-Commit-Position: refs/heads/master@{#375714}
Diffstat (limited to 'skia')
-rw-r--r-- | skia/config/sk_ref_cnt_ext_debug.h | 14 | ||||
-rw-r--r-- | skia/config/sk_ref_cnt_ext_release.h | 8 |
2 files changed, 20 insertions, 2 deletions
diff --git a/skia/config/sk_ref_cnt_ext_debug.h b/skia/config/sk_ref_cnt_ext_debug.h index 78a39a3..8a4e448 100644 --- a/skia/config/sk_ref_cnt_ext_debug.h +++ b/skia/config/sk_ref_cnt_ext_debug.h @@ -11,16 +11,23 @@ #include <atomic> +class SkRefCnt; + +namespace WTF { + void adopted(const SkRefCnt*); + void requireAdoption(const SkRefCnt*); +} + // Alternate implementation of SkRefCnt for Chromium debug builds class SK_API SkRefCnt : public SkRefCntBase { public: SkRefCnt(); ~SkRefCnt() override; void ref() const { SkASSERT(flags_.load() != AdoptionRequired_Flag); SkRefCntBase::ref(); } - void adopted() const { flags_ |= Adopted_Flag; } - void requireAdoption() const { flags_ |= AdoptionRequired_Flag; } void deref() const { SkRefCntBase::unref(); } private: + void adopted() const { flags_ |= Adopted_Flag; } + void requireAdoption() const { flags_ |= AdoptionRequired_Flag; } enum { Adopted_Flag = 0x1, @@ -28,6 +35,9 @@ private: }; mutable std::atomic<int> flags_; + + friend void WTF::adopted(const SkRefCnt*); + friend void WTF::requireAdoption(const SkRefCnt*); }; inline SkRefCnt::SkRefCnt() : flags_(0) { } diff --git a/skia/config/sk_ref_cnt_ext_release.h b/skia/config/sk_ref_cnt_ext_release.h index 7736c84..aec0512 100644 --- a/skia/config/sk_ref_cnt_ext_release.h +++ b/skia/config/sk_ref_cnt_ext_release.h @@ -15,5 +15,13 @@ public: void deref() const { SkRefCntBase::unref(); } }; +namespace WTF { + inline void adopted(const SkRefCnt* object) {} + inline void requireAdoption(const SkRefCnt* object) {} +}; + +using WTF::adopted; +using WTF::requireAdoption; + #endif |