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: 4 -*- |
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 GFX_GRAPHITESHAPER_H |
michael@0 | 7 | #define GFX_GRAPHITESHAPER_H |
michael@0 | 8 | |
michael@0 | 9 | #include "gfxFont.h" |
michael@0 | 10 | |
michael@0 | 11 | struct gr_face; |
michael@0 | 12 | struct gr_font; |
michael@0 | 13 | struct gr_segment; |
michael@0 | 14 | |
michael@0 | 15 | class gfxGraphiteShaper : public gfxFontShaper { |
michael@0 | 16 | public: |
michael@0 | 17 | gfxGraphiteShaper(gfxFont *aFont); |
michael@0 | 18 | virtual ~gfxGraphiteShaper(); |
michael@0 | 19 | |
michael@0 | 20 | virtual bool ShapeText(gfxContext *aContext, |
michael@0 | 21 | const char16_t *aText, |
michael@0 | 22 | uint32_t aOffset, |
michael@0 | 23 | uint32_t aLength, |
michael@0 | 24 | int32_t aScript, |
michael@0 | 25 | gfxShapedText *aShapedText); |
michael@0 | 26 | |
michael@0 | 27 | static void Shutdown(); |
michael@0 | 28 | |
michael@0 | 29 | protected: |
michael@0 | 30 | nsresult SetGlyphsFromSegment(gfxContext *aContext, |
michael@0 | 31 | gfxShapedText *aShapedText, |
michael@0 | 32 | uint32_t aOffset, |
michael@0 | 33 | uint32_t aLength, |
michael@0 | 34 | const char16_t *aText, |
michael@0 | 35 | gr_segment *aSegment); |
michael@0 | 36 | |
michael@0 | 37 | static float GrGetAdvance(const void* appFontHandle, uint16_t glyphid); |
michael@0 | 38 | |
michael@0 | 39 | gr_face *mGrFace; // owned by the font entry; shaper must call |
michael@0 | 40 | // gfxFontEntry::ReleaseGrFace when finished with it |
michael@0 | 41 | gr_font *mGrFont; // owned by the shaper itself |
michael@0 | 42 | |
michael@0 | 43 | struct CallbackData { |
michael@0 | 44 | gfxFont *mFont; |
michael@0 | 45 | gfxGraphiteShaper *mShaper; |
michael@0 | 46 | gfxContext *mContext; |
michael@0 | 47 | }; |
michael@0 | 48 | |
michael@0 | 49 | CallbackData mCallbackData; |
michael@0 | 50 | |
michael@0 | 51 | // Convert HTML 'lang' (BCP47) to Graphite language code |
michael@0 | 52 | static uint32_t GetGraphiteTagForLang(const nsCString& aLang); |
michael@0 | 53 | static nsTHashtable<nsUint32HashKey> *sLanguageTags; |
michael@0 | 54 | }; |
michael@0 | 55 | |
michael@0 | 56 | #endif /* GFX_GRAPHITESHAPER_H */ |