mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-24 17:35:10 +03:00
f539147d48
This fixes all the license headers in the main library, which corrects the appearance of the main license in the compiled output. It seems that the `!` in the header forces the compiler to keep it in the output. I believe older compiler releases did this purely based on `@license`. Issue #2638 Change-Id: I7f0e918caad10c9af689c9d07672b7fe9be7b2f3
74 lines
1.7 KiB
JavaScript
74 lines
1.7 KiB
JavaScript
/*! @license
|
|
* Shaka Player
|
|
* Copyright 2016 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
goog.provide('shaka.offline.indexeddb.EmeSessionStorageCell');
|
|
|
|
goog.require('shaka.offline.indexeddb.DBConnection');
|
|
|
|
|
|
/**
|
|
* The implementation of the EME session storage cell.
|
|
*
|
|
* @implements {shaka.extern.EmeSessionStorageCell}
|
|
*/
|
|
shaka.offline.indexeddb.EmeSessionStorageCell = class {
|
|
/**
|
|
* @param {IDBDatabase} connection
|
|
* @param {string} store
|
|
*/
|
|
constructor(connection, store) {
|
|
/** @private {!shaka.offline.indexeddb.DBConnection} */
|
|
this.connection_ = new shaka.offline.indexeddb.DBConnection(connection);
|
|
|
|
/** @private {string} */
|
|
this.store_ = store;
|
|
}
|
|
|
|
/** @override */
|
|
destroy() { return this.connection_.destroy(); }
|
|
|
|
/** @override */
|
|
async getAll() {
|
|
/** @type {!shaka.offline.indexeddb.DBOperation} */
|
|
const op = this.connection_.startReadOnlyOperation(this.store_);
|
|
/** @type {!Array.<shaka.extern.EmeSessionDB>} */
|
|
const values = [];
|
|
|
|
await op.forEachEntry((key, value) => {
|
|
values.push(value);
|
|
});
|
|
|
|
await op.promise();
|
|
return values;
|
|
}
|
|
|
|
/** @override */
|
|
add(sessions) {
|
|
const op = this.connection_.startReadWriteOperation(this.store_);
|
|
const store = op.store();
|
|
|
|
for (const session of sessions) {
|
|
store.add(session);
|
|
}
|
|
|
|
return op.promise();
|
|
}
|
|
|
|
/** @override */
|
|
async remove(sessionIds) {
|
|
/** @type {!shaka.offline.indexeddb.DBOperation} */
|
|
const op = this.connection_.startReadWriteOperation(this.store_);
|
|
|
|
await op.forEachEntry((key, value, cursor) => {
|
|
if (sessionIds.includes(value.sessionId)) {
|
|
cursor.delete();
|
|
}
|
|
});
|
|
|
|
await op.promise();
|
|
}
|
|
};
|