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