Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1867)

Unified Diff: Source/modules/encryptedmedia/MediaKeyStatusMap.h

Issue 1237343004: Convert MediaKeyStatusMap to iterable<BufferSource,MediaKeyStatus> (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/modules/encryptedmedia/MediaKeyStatusMap.h
diff --git a/Source/modules/encryptedmedia/MediaKeyStatusMap.h b/Source/modules/encryptedmedia/MediaKeyStatusMap.h
index 2b2fbf1792ea1f8ae91e873cdf3cc28c06f48de3..486d6e5441acfa35746dd98a67bb9024461ef209 100644
--- a/Source/modules/encryptedmedia/MediaKeyStatusMap.h
+++ b/Source/modules/encryptedmedia/MediaKeyStatusMap.h
@@ -5,7 +5,7 @@
#ifndef MediaKeyStatusMap_h
#define MediaKeyStatusMap_h
-#include "bindings/core/v8/Maplike.h"
+#include "bindings/core/v8/Iterable.h"
#include "bindings/core/v8/ScriptWrappable.h"
#include "bindings/core/v8/UnionTypesCore.h"
#include "core/dom/DOMArrayPiece.h"
@@ -22,36 +22,37 @@ class WebData;
// status known to a particular session. Since it can be updated any time there
// is a keychange event, iteration order and completeness is not guaranteed
// if the event loop runs.
-class MediaKeyStatusMap final : public GarbageCollected<MediaKeyStatusMap>, public ScriptWrappable, public Maplike<ArrayBufferOrArrayBufferView, String> {
+class MediaKeyStatusMap final : public GarbageCollected<MediaKeyStatusMap>, public ScriptWrappable, public PairIterable<ArrayBufferOrArrayBufferView, String> {
DEFINE_WRAPPERTYPEINFO();
private:
// MapEntry holds the keyId (DOMArrayBuffer) and status (MediaKeyStatus as
// String) for each entry.
class MapEntry;
- // As the number of keys per session should be small, the key ids and
- // their status are kept in a list rather than a proper map.
- typedef HeapVector<Member<MapEntry>> MapType;
+ // The key ids and their status are kept in a list, as order is important.
+ typedef HeapVector<Member<MapEntry>> MediaKeyStatusMapType;
public:
MediaKeyStatusMap() { }
void clear();
- void addEntry(WebData source, const String& status);
+ void addEntry(WebData keyId, const String& status);
const MapEntry& at(size_t) const;
// IDL attributes / methods
size_t size() const { return m_entries.size(); }
+ bool has(const ArrayBufferOrArrayBufferView& keyId);
+ String get(const ArrayBufferOrArrayBufferView& keyId);
DECLARE_VIRTUAL_TRACE();
private:
+ // PairIterable<> implementation.
IterationSource* startIteration(ScriptState*, ExceptionState&) override;
- bool getMapEntry(ScriptState*, const ArrayBufferOrArrayBufferView&, String&, ExceptionState&) override;
- size_t indexOf(const DOMArrayPiece& key) const;
+ size_t indexOf(const DOMArrayPiece& keyId) const;
- MapType m_entries;
+ MediaKeyStatusMapType m_entries;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698