Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 2 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef MOZILLA_GFX_SCALEDFONTMAC_H_ |
michael@0 | 7 | #define MOZILLA_GFX_SCALEDFONTMAC_H_ |
michael@0 | 8 | |
michael@0 | 9 | #import <ApplicationServices/ApplicationServices.h> |
michael@0 | 10 | #include "2D.h" |
michael@0 | 11 | |
michael@0 | 12 | #include "ScaledFontBase.h" |
michael@0 | 13 | |
michael@0 | 14 | namespace mozilla { |
michael@0 | 15 | namespace gfx { |
michael@0 | 16 | |
michael@0 | 17 | class ScaledFontMac : public ScaledFontBase |
michael@0 | 18 | { |
michael@0 | 19 | public: |
michael@0 | 20 | MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(ScaledFontMac) |
michael@0 | 21 | ScaledFontMac(CGFontRef aFont, Float aSize); |
michael@0 | 22 | virtual ~ScaledFontMac(); |
michael@0 | 23 | |
michael@0 | 24 | virtual FontType GetType() const { return FontType::MAC; } |
michael@0 | 25 | #ifdef USE_SKIA |
michael@0 | 26 | virtual SkTypeface* GetSkTypeface(); |
michael@0 | 27 | #endif |
michael@0 | 28 | virtual TemporaryRef<Path> GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget); |
michael@0 | 29 | virtual void CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBuilder, BackendType aBackendType, const Matrix *aTransformHint); |
michael@0 | 30 | virtual bool GetFontFileData(FontFileDataOutput aDataCallback, void *aBaton); |
michael@0 | 31 | |
michael@0 | 32 | private: |
michael@0 | 33 | friend class DrawTargetCG; |
michael@0 | 34 | CGFontRef mFont; |
michael@0 | 35 | CTFontRef mCTFont; // only created if CTFontDrawGlyphs is available, otherwise null |
michael@0 | 36 | |
michael@0 | 37 | typedef void (CTFontDrawGlyphsFuncT)(CTFontRef, |
michael@0 | 38 | const CGGlyph[], const CGPoint[], |
michael@0 | 39 | size_t, CGContextRef); |
michael@0 | 40 | |
michael@0 | 41 | static bool sSymbolLookupDone; |
michael@0 | 42 | |
michael@0 | 43 | public: |
michael@0 | 44 | // function pointer for CTFontDrawGlyphs, if available; |
michael@0 | 45 | // initialized the first time a ScaledFontMac is created, |
michael@0 | 46 | // so it will be valid by the time DrawTargetCG wants to use it |
michael@0 | 47 | static CTFontDrawGlyphsFuncT* CTFontDrawGlyphsPtr; |
michael@0 | 48 | }; |
michael@0 | 49 | |
michael@0 | 50 | } |
michael@0 | 51 | } |
michael@0 | 52 | |
michael@0 | 53 | #endif /* MOZILLA_GFX_SCALEDFONTMAC_H_ */ |