Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  MediaKeyStatusMap.cpp

  Sprache: C
 

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */


#include "mozilla/dom/MediaKeyStatusMap.h"

#include "GMPUtils.h"
#include "mozilla/EMEUtils.h"
#include "mozilla/dom/BufferSourceBinding.h"
#include "mozilla/dom/ToJSValue.h"
#include "mozilla/dom/UnionTypes.h"
#include "nsPIDOMWindow.h"

namespace mozilla::dom {

NS_IMPL_CYCLE_COLLECTING_ADDREF(MediaKeyStatusMap)
NS_IMPL_CYCLE_COLLECTING_RELEASE(MediaKeyStatusMap)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(MediaKeyStatusMap)
  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
  NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(MediaKeyStatusMap, mParent)

MediaKeyStatusMap::MediaKeyStatusMap(nsPIDOMWindowInner* aParent)
    : mParent(aParent) {}

MediaKeyStatusMap::~MediaKeyStatusMap() = default;

JSObject* MediaKeyStatusMap::WrapObject(JSContext* aCx,
                                        JS::Handle<JSObject*> aGivenProto) {
  return MediaKeyStatusMap_Binding::Wrap(aCx, this, aGivenProto);
}

nsPIDOMWindowInner* MediaKeyStatusMap::GetParentObject() const {
  return mParent;
}

const MediaKeyStatusMap::KeyStatus* MediaKeyStatusMap::FindKey(
    const BufferSource& aKey) const {
  MOZ_ASSERT(aKey.IsArrayBuffer() || aKey.IsArrayBufferView());

  return ProcessTypedArrays(aKey,
                            [&](const Span<const uint8_t>& aData,
                                JS::AutoCheckCannotGC&&) -> const KeyStatus* {
                              for (const KeyStatus& status : mStatuses) {
                                if (aData == Span(status.mKeyId)) {
                                  return &status;
                                }
                              }
                              return nullptr;
                            });
}

void MediaKeyStatusMap::Get(const BufferSource& aKey,
                            OwningMediaKeyStatusOrUndefined& aOutValue,
                            ErrorResult& aOutRv) const {
  const KeyStatus* status = FindKey(aKey);
  if (!status) {
    aOutValue.SetUndefined();
    return;
  }

  aOutValue.SetAsMediaKeyStatus() = status->mStatus;
}

bool MediaKeyStatusMap::Has(const BufferSource& aKey) const {
  return FindKey(aKey);
}

uint32_t MediaKeyStatusMap::GetIterableLength() const {
  return mStatuses.Length();
}

TypedArrayCreator<ArrayBuffer> MediaKeyStatusMap::GetKeyAtIndex(
    uint32_t aIndex) const {
  MOZ_ASSERT(aIndex < GetIterableLength());
  return TypedArrayCreator<ArrayBuffer>(mStatuses[aIndex].mKeyId);
}

nsString MediaKeyStatusMap::GetKeyIDAsHexString(uint32_t aIndex) const {
  MOZ_ASSERT(aIndex < GetIterableLength());
  return NS_ConvertUTF8toUTF16(ToHexString(mStatuses[aIndex].mKeyId));
}

MediaKeyStatus MediaKeyStatusMap::GetValueAtIndex(uint32_t aIndex) const {
  MOZ_ASSERT(aIndex < GetIterableLength());
  return mStatuses[aIndex].mStatus;
}

uint32_t MediaKeyStatusMap::Size() const { return mStatuses.Length(); }

void MediaKeyStatusMap::Update(const nsTArray<CDMCaps::KeyStatus>& aKeys) {
  mStatuses.Clear();
  for (const auto& key : aKeys) {
    mStatuses.InsertElementSorted(KeyStatus(key.mId, key.mStatus));
  }
}

}  // namespace mozilla::dom

Messung V0.5 in Prozent
C=91 H=94 G=92

¤ Dauer der Verarbeitung: 0.6 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

letze Version des Elbe Quellennavigators


Jenseits des Üblichen ....
    

Besucher

Besucher

Statistik
#Sources=141584
#Domains=752002