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 #include "2D.h"
7 #include <vector>
9 namespace mozilla {
10 namespace gfx {
12 struct FlatPathOp
13 {
14 enum OpType {
15 OP_MOVETO,
16 OP_LINETO,
17 };
19 OpType mType;
20 Point mPoint;
21 };
23 class FlattenedPath : public PathSink
24 {
25 public:
26 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FlattenedPath)
27 FlattenedPath() : mCachedLength(0)
28 , mCalculatedLength(false)
29 {
30 }
32 virtual void MoveTo(const Point &aPoint);
33 virtual void LineTo(const Point &aPoint);
34 virtual void BezierTo(const Point &aCP1,
35 const Point &aCP2,
36 const Point &aCP3);
37 virtual void QuadraticBezierTo(const Point &aCP1,
38 const Point &aCP2);
39 virtual void Close();
40 virtual void Arc(const Point &aOrigin, float aRadius, float aStartAngle,
41 float aEndAngle, bool aAntiClockwise = false);
43 virtual Point CurrentPoint() const { return mPathOps.empty() ? Point() : mPathOps[mPathOps.size() - 1].mPoint; }
45 Float ComputeLength();
46 Point ComputePointAtLength(Float aLength, Point *aTangent);
48 private:
49 Float mCachedLength;
50 bool mCalculatedLength;
51 Point mLastMove;
53 std::vector<FlatPathOp> mPathOps;
54 };
56 }
57 }