content/media/TextTrackList.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 /* vim:set ts=2 sw=2 et tw=78: */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef mozilla_dom_TextTrackList_h
     8 #define mozilla_dom_TextTrackList_h
    10 #include "mozilla/DOMEventTargetHelper.h"
    11 #include "mozilla/dom/TextTrack.h"
    12 #include "nsCycleCollectionParticipant.h"
    14 namespace mozilla {
    15 namespace dom {
    17 class HTMLMediaElement;
    18 class TextTrackManager;
    19 class CompareTextTracks;
    20 class TrackEvent;
    21 class TrackEventRunner;
    23 class TextTrackList MOZ_FINAL : public DOMEventTargetHelper
    24 {
    25 public:
    26   NS_DECL_ISUPPORTS_INHERITED
    27   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TextTrackList, DOMEventTargetHelper)
    29   TextTrackList(nsPIDOMWindow* aOwnerWindow);
    30   TextTrackList(nsPIDOMWindow* aOwnerWindow, TextTrackManager* aTextTrackManager);
    32   virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
    34   uint32_t Length() const
    35   {
    36     return mTextTracks.Length();
    37   }
    39   // Get all the current active cues.
    40   void UpdateAndGetShowingCues(nsTArray<nsRefPtr<TextTrackCue> >& aCues);
    42   TextTrack* IndexedGetter(uint32_t aIndex, bool& aFound);
    43   TextTrack* operator[](uint32_t aIndex);
    45   already_AddRefed<TextTrack> AddTextTrack(TextTrackKind aKind,
    46                                            const nsAString& aLabel,
    47                                            const nsAString& aLanguage,
    48                                            TextTrackMode aMode,
    49                                            TextTrackReadyState aReadyState,
    50                                            TextTrackSource aTextTrackSource,
    51                                            const CompareTextTracks& aCompareTT);
    52   TextTrack* GetTrackById(const nsAString& aId);
    54   void AddTextTrack(TextTrack* aTextTrack, const CompareTextTracks& aCompareTT);
    56   void RemoveTextTrack(TextTrack* aTrack);
    57   void DidSeek();
    59   HTMLMediaElement* GetMediaElement();
    60   void SetTextTrackManager(TextTrackManager* aTextTrackManager);
    62   nsresult DispatchTrackEvent(nsIDOMEvent* aEvent);
    63   void CreateAndDispatchChangeEvent();
    65   IMPL_EVENT_HANDLER(change)
    66   IMPL_EVENT_HANDLER(addtrack)
    67   IMPL_EVENT_HANDLER(removetrack)
    69 private:
    70   nsTArray< nsRefPtr<TextTrack> > mTextTracks;
    71   nsRefPtr<TextTrackManager> mTextTrackManager;
    73   void CreateAndDispatchTrackEventRunner(TextTrack* aTrack,
    74                                          const nsAString& aEventName);
    75 };
    77 } // namespace dom
    78 } // namespace mozilla
    80 #endif // mozilla_dom_TextTrackList_h

mercurial