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.

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

mercurial