LCOV - code coverage report
Current view: top level - dom/media/eme - MediaKeySession.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 3 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 5 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
       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 file,
       5             :  * You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef mozilla_dom_MediaKeySession_h
       8             : #define mozilla_dom_MediaKeySession_h
       9             : 
      10             : #include "mozilla/Attributes.h"
      11             : #include "mozilla/ErrorResult.h"
      12             : #include "nsCycleCollectionParticipant.h"
      13             : #include "mozilla/DOMEventTargetHelper.h"
      14             : #include "nsCOMPtr.h"
      15             : #include "mozilla/dom/TypedArray.h"
      16             : #include "mozilla/Mutex.h"
      17             : #include "mozilla/dom/Date.h"
      18             : #include "mozilla/dom/Promise.h"
      19             : #include "mozilla/DetailedPromise.h"
      20             : #include "mozilla/dom/MediaKeySessionBinding.h"
      21             : #include "mozilla/dom/MediaKeysBinding.h"
      22             : #include "mozilla/dom/MediaKeyMessageEventBinding.h"
      23             : 
      24             : struct JSContext;
      25             : 
      26             : namespace mozilla {
      27             : namespace dom {
      28             : 
      29             : class ArrayBufferViewOrArrayBuffer;
      30             : class MediaKeyError;
      31             : class MediaKeyStatusMap;
      32             : 
      33             : nsCString
      34             : ToCString(MediaKeySessionType aType);
      35             : 
      36             : nsString
      37             : ToString(MediaKeySessionType aType);
      38             : 
      39             : class MediaKeySession final : public DOMEventTargetHelper
      40             : {
      41             : public:
      42             :   NS_DECL_ISUPPORTS_INHERITED
      43           0 :   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(MediaKeySession,
      44             :                                            DOMEventTargetHelper)
      45             : public:
      46             :   MediaKeySession(JSContext* aCx,
      47             :                   nsPIDOMWindowInner* aParent,
      48             :                   MediaKeys* aKeys,
      49             :                   const nsAString& aKeySystem,
      50             :                   MediaKeySessionType aSessionType,
      51             :                   ErrorResult& aRv);
      52             : 
      53             :   void SetSessionId(const nsAString& aSessionId);
      54             : 
      55             :   JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
      56             : 
      57             :   // Mark this as resultNotAddRefed to return raw pointers
      58             :   MediaKeyError* GetError() const;
      59             : 
      60             :   MediaKeyStatusMap* KeyStatuses() const;
      61             : 
      62             :   void GetSessionId(nsString& aRetval) const;
      63             : 
      64             :   const nsString& GetSessionId() const;
      65             : 
      66             :   // Number of ms since epoch at which expiration occurs, or NaN if unknown.
      67             :   // TODO: The type of this attribute is still under contention.
      68             :   // https://www.w3.org/Bugs/Public/show_bug.cgi?id=25902
      69             :   double Expiration() const;
      70             : 
      71             :   Promise* Closed() const;
      72             : 
      73             :   already_AddRefed<Promise> GenerateRequest(const nsAString& aInitDataType,
      74             :                                             const ArrayBufferViewOrArrayBuffer& aInitData,
      75             :                                             ErrorResult& aRv);
      76             : 
      77             :   already_AddRefed<Promise> Load(const nsAString& aSessionId,
      78             :                                  ErrorResult& aRv);
      79             : 
      80             :   already_AddRefed<Promise> Update(const ArrayBufferViewOrArrayBuffer& response,
      81             :                                    ErrorResult& aRv);
      82             : 
      83             :   already_AddRefed<Promise> Close(ErrorResult& aRv);
      84             : 
      85             :   already_AddRefed<Promise> Remove(ErrorResult& aRv);
      86             : 
      87             :   void DispatchKeyMessage(MediaKeyMessageType aMessageType,
      88             :                           const nsTArray<uint8_t>& aMessage);
      89             : 
      90             :   void DispatchKeyError(uint32_t system_code);
      91             : 
      92             :   void DispatchKeyStatusesChange();
      93             : 
      94             :   void OnClosed();
      95             : 
      96             :   bool IsClosed() const;
      97             : 
      98             :   void SetExpiration(double aExpiry);
      99             : 
     100             :   mozilla::dom::EventHandlerNonNull* GetOnkeystatuseschange();
     101             :   void SetOnkeystatuseschange(mozilla::dom::EventHandlerNonNull* aCallback);
     102             : 
     103             :   mozilla::dom::EventHandlerNonNull* GetOnmessage();
     104             :   void SetOnmessage(mozilla::dom::EventHandlerNonNull* aCallback);
     105             : 
     106             :   // Process-unique identifier.
     107             :   uint32_t Token() const;
     108             : 
     109             : private:
     110             :   ~MediaKeySession();
     111             : 
     112             :   void UpdateKeyStatusMap();
     113             : 
     114           0 :   bool IsCallable() const {
     115             :     // The EME spec sets the "callable value" to true whenever the CDM sets
     116             :     // the sessionId. When the session is initialized, sessionId is empty and
     117             :     // callable is thus false.
     118           0 :     return !mSessionId.IsEmpty();
     119             :   }
     120             : 
     121             :   already_AddRefed<DetailedPromise> MakePromise(ErrorResult& aRv,
     122             :                                                 const nsACString& aName);
     123             : 
     124             :   RefPtr<DetailedPromise> mClosed;
     125             : 
     126             :   RefPtr<MediaKeyError> mMediaKeyError;
     127             :   RefPtr<MediaKeys> mKeys;
     128             :   const nsString mKeySystem;
     129             :   nsString mSessionId;
     130             :   const MediaKeySessionType mSessionType;
     131             :   const uint32_t mToken;
     132             :   bool mIsClosed;
     133             :   bool mUninitialized;
     134             :   RefPtr<MediaKeyStatusMap> mKeyStatusMap;
     135             :   double mExpiration;
     136             : };
     137             : 
     138             : } // namespace dom
     139             : } // namespace mozilla
     140             : 
     141             : #endif

Generated by: LCOV version 1.13