dom/smil/nsSMILInterval.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

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: 2; 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 NS_SMILINTERVAL_H_
michael@0 7 #define NS_SMILINTERVAL_H_
michael@0 8
michael@0 9 #include "nsSMILInstanceTime.h"
michael@0 10 #include "nsTArray.h"
michael@0 11
michael@0 12 //----------------------------------------------------------------------
michael@0 13 // nsSMILInterval class
michael@0 14 //
michael@0 15 // A structure consisting of a begin and end time. The begin time must be
michael@0 16 // resolved (i.e. not indefinite or unresolved).
michael@0 17 //
michael@0 18 // For an overview of how this class is related to other SMIL time classes see
michael@0 19 // the documentation in nsSMILTimeValue.h
michael@0 20
michael@0 21 class nsSMILInterval
michael@0 22 {
michael@0 23 public:
michael@0 24 nsSMILInterval();
michael@0 25 nsSMILInterval(const nsSMILInterval& aOther);
michael@0 26 ~nsSMILInterval();
michael@0 27 void Unlink(bool aFiltered = false);
michael@0 28
michael@0 29 const nsSMILInstanceTime* Begin() const
michael@0 30 {
michael@0 31 NS_ABORT_IF_FALSE(mBegin && mEnd,
michael@0 32 "Requesting Begin() on un-initialized instance time");
michael@0 33 return mBegin;
michael@0 34 }
michael@0 35 nsSMILInstanceTime* Begin();
michael@0 36
michael@0 37 const nsSMILInstanceTime* End() const
michael@0 38 {
michael@0 39 NS_ABORT_IF_FALSE(mBegin && mEnd,
michael@0 40 "Requesting End() on un-initialized instance time");
michael@0 41 return mEnd;
michael@0 42 }
michael@0 43 nsSMILInstanceTime* End();
michael@0 44
michael@0 45 void SetBegin(nsSMILInstanceTime& aBegin);
michael@0 46 void SetEnd(nsSMILInstanceTime& aEnd);
michael@0 47 void Set(nsSMILInstanceTime& aBegin, nsSMILInstanceTime& aEnd)
michael@0 48 {
michael@0 49 SetBegin(aBegin);
michael@0 50 SetEnd(aEnd);
michael@0 51 }
michael@0 52
michael@0 53 void FixBegin();
michael@0 54 void FixEnd();
michael@0 55
michael@0 56 typedef nsTArray<nsRefPtr<nsSMILInstanceTime> > InstanceTimeList;
michael@0 57
michael@0 58 void AddDependentTime(nsSMILInstanceTime& aTime);
michael@0 59 void RemoveDependentTime(const nsSMILInstanceTime& aTime);
michael@0 60 void GetDependentTimes(InstanceTimeList& aTimes);
michael@0 61
michael@0 62 // Cue for assessing if this interval can be filtered
michael@0 63 bool IsDependencyChainLink() const;
michael@0 64
michael@0 65 private:
michael@0 66 nsRefPtr<nsSMILInstanceTime> mBegin;
michael@0 67 nsRefPtr<nsSMILInstanceTime> mEnd;
michael@0 68
michael@0 69 // nsSMILInstanceTimes to notify when this interval is changed or deleted.
michael@0 70 InstanceTimeList mDependentTimes;
michael@0 71
michael@0 72 // Indicates if the end points of the interval are fixed or not.
michael@0 73 //
michael@0 74 // Note that this is not the same as having an end point whose TIME is fixed
michael@0 75 // (i.e. nsSMILInstanceTime::IsFixed() returns true). This is because it is
michael@0 76 // possible to have an end point with a fixed TIME and yet still update the
michael@0 77 // end point to refer to a different nsSMILInstanceTime object.
michael@0 78 //
michael@0 79 // However, if mBegin/EndFixed is true, then BOTH the nsSMILInstanceTime
michael@0 80 // OBJECT returned for that end point and its TIME value will not change.
michael@0 81 bool mBeginFixed;
michael@0 82 bool mEndFixed;
michael@0 83 };
michael@0 84
michael@0 85 #endif // NS_SMILINTERVAL_H_

mercurial