示例#1
0
void
GMPDecryptorChild::SessionClosed(const char* aSessionId,
                                 uint32_t aSessionIdLength)
{
  CALL_ON_GMP_THREAD(SendSessionClosed,
                     nsCString(aSessionId, aSessionIdLength));
}
示例#2
0
GMPErr
GMPStorageChild::Write(GMPRecordImpl* aRecord,
                       const uint8_t* aData,
                       uint32_t aDataSize)
{
  if (aDataSize > GMP_MAX_RECORD_SIZE) {
    return GMPQuotaExceededErr;
  }

  MonitorAutoLock lock(mMonitor);

  if (mShutdown) {
    NS_WARNING("GMPStorage used after it's been shutdown!");
    return GMPClosedErr;
  }

  if (!HasRecord(aRecord->Name())) {
    // Record not opened.
    return GMPClosedErr;
  }

  CALL_ON_GMP_THREAD(SendWrite, aRecord->Name(), ToArray(aData, aDataSize));

  return GMPNoErr;
}
示例#3
0
void
GMPDecryptorChild::ResolveNewSessionPromise(uint32_t aPromiseId,
                                            const char* aSessionId,
                                            uint32_t aSessionIdLength)
{
  CALL_ON_GMP_THREAD(SendResolveNewSessionPromise,
                     aPromiseId, nsAutoCString(aSessionId, aSessionIdLength));
}
示例#4
0
void
GMPDecryptorChild::ExpirationChange(const char* aSessionId,
                                    uint32_t aSessionIdLength,
                                    GMPTimestamp aExpiryTime)
{
  CALL_ON_GMP_THREAD(SendExpirationChange,
                     nsCString(aSessionId, aSessionIdLength), aExpiryTime);
}
示例#5
0
void
GMPDecryptorChild::SetSessionId(uint32_t aCreateSessionToken,
                                const char* aSessionId,
                                uint32_t aSessionIdLength)
{
  CALL_ON_GMP_THREAD(SendSetSessionId,
                     aCreateSessionToken, nsCString(aSessionId, aSessionIdLength));
}
示例#6
0
void
GMPDecryptorChild::RejectPromise(uint32_t aPromiseId,
                                 GMPDOMException aException,
                                 const char* aMessage,
                                 uint32_t aMessageLength)
{
  CALL_ON_GMP_THREAD(SendRejectPromise,
                     aPromiseId, aException, nsCString(aMessage, aMessageLength));
}
示例#7
0
void
GMPDecryptorChild::KeyIdNotUsable(const char* aSessionId,
                                  uint32_t aSessionIdLength,
                                  const uint8_t* aKeyId,
                                  uint32_t aKeyIdLength)
{
  nsAutoTArray<uint8_t, 16> kid;
  kid.AppendElements(aKeyId, aKeyIdLength);
  CALL_ON_GMP_THREAD(SendKeyIdNotUsable,
                     nsAutoCString(aSessionId, aSessionIdLength), kid);
}
示例#8
0
void
GMPDecryptorChild::SessionError(const char* aSessionId,
                                uint32_t aSessionIdLength,
                                GMPDOMException aException,
                                uint32_t aSystemCode,
                                const char* aMessage,
                                uint32_t aMessageLength)
{
  CALL_ON_GMP_THREAD(SendSessionError,
                     nsCString(aSessionId, aSessionIdLength),
                     aException, aSystemCode,
                     nsCString(aMessage, aMessageLength));
}
示例#9
0
void
GMPDecryptorChild::KeyStatusChanged(const char* aSessionId,
                                    uint32_t aSessionIdLength,
                                    const uint8_t* aKeyId,
                                    uint32_t aKeyIdLength,
                                    GMPMediaKeyStatus aStatus)
{
  AutoTArray<uint8_t, 16> kid;
  kid.AppendElements(aKeyId, aKeyIdLength);
  CALL_ON_GMP_THREAD(SendKeyStatusChanged,
                     nsCString(aSessionId, aSessionIdLength), kid,
                     aStatus);
}
示例#10
0
void
GMPDecryptorChild::SessionMessage(const char* aSessionId,
                                  uint32_t aSessionIdLength,
                                  GMPSessionMessageType aMessageType,
                                  const uint8_t* aMessage,
                                  uint32_t aMessageLength)
{
  nsTArray<uint8_t> msg;
  msg.AppendElements(aMessage, aMessageLength);
  CALL_ON_GMP_THREAD(SendSessionMessage,
                     nsCString(aSessionId, aSessionIdLength),
                     aMessageType, Move(msg));
}
示例#11
0
void
GMPDecryptorChild::SessionMessage(const char* aSessionId,
                                  uint32_t aSessionIdLength,
                                  const uint8_t* aMessage,
                                  uint32_t aMessageLength,
                                  const char* aDestinationURL,
                                  uint32_t aDestinationURLLength)
{
  nsTArray<uint8_t> msg;
  msg.AppendElements(aMessage, aMessageLength);
  CALL_ON_GMP_THREAD(SendSessionMessage,
                     nsAutoCString(aSessionId, aSessionIdLength), msg,
                     nsAutoCString(aDestinationURL, aDestinationURLLength));
}
示例#12
0
void
GMPDecryptorChild::BatchedKeyStatusChanged(const char* aSessionId,
                                           uint32_t aSessionIdLength,
                                           const GMPMediaKeyInfo* aKeyInfos,
                                           uint32_t aKeyInfosLength)
{
  nsTArray<GMPKeyInformation> keyInfos;
  for (uint32_t i = 0; i < aKeyInfosLength; i++) {
    nsTArray<uint8_t> keyId;
    keyId.AppendElements(aKeyInfos[i].keyid, aKeyInfos[i].keyid_size);
    keyInfos.AppendElement(GMPKeyInformation(keyId, aKeyInfos[i].status));
  }
  CALL_ON_GMP_THREAD(SendBatchedKeyStatusChanged,
                     nsCString(aSessionId, aSessionIdLength),
                     keyInfos);
}
示例#13
0
GMPErr
GMPStorageChild::Close(const nsCString& aRecordName)
{
  MonitorAutoLock lock(mMonitor);

  if (!HasRecord(aRecordName)) {
    // Already closed.
    return GMPClosedErr;
  }

  mRecords.Remove(aRecordName);

  if (!mShutdown) {
    CALL_ON_GMP_THREAD(SendClose, aRecordName);
  }

  return GMPNoErr;
}
示例#14
0
GMPErr
GMPStorageChild::EnumerateRecords(RecvGMPRecordIteratorPtr aRecvIteratorFunc,
                                  void* aUserArg)
{
  MonitorAutoLock lock(mMonitor);

  if (mShutdown) {
    NS_WARNING("GMPStorage used after it's been shutdown!");
    return GMPClosedErr;
  }

  MOZ_ASSERT(aRecvIteratorFunc);
  mPendingRecordIterators.push(RecordIteratorContext(aRecvIteratorFunc, aUserArg));

  CALL_ON_GMP_THREAD(SendGetRecordNames);

  return GMPNoErr;
}
示例#15
0
GMPErr
GMPStorageChild::Open(GMPRecordImpl* aRecord)
{
  MonitorAutoLock lock(mMonitor);

  if (mShutdown) {
    NS_WARNING("GMPStorage used after it's been shutdown!");
    return GMPClosedErr;
  }

  if (!HasRecord(aRecord->Name())) {
    // Trying to re-open a record that has already been closed.
    return GMPClosedErr;
  }

  CALL_ON_GMP_THREAD(SendOpen, aRecord->Name());

  return GMPNoErr;
}
示例#16
0
void
GMPDecryptorChild::Decrypted(GMPBuffer* aBuffer, GMPErr aResult)
{
  if (!ON_GMP_THREAD()) {
    // We should run this whole method on the GMP thread since the buffer needs
    // to be deleted after the SendDecrypted call.
    CALL_ON_GMP_THREAD(Decrypted, aBuffer, aResult);
    return;
  }

  if (!aBuffer) {
    NS_WARNING("GMPDecryptorCallback passed bull GMPBuffer");
    return;
  }

  auto buffer = static_cast<GMPBufferImpl*>(aBuffer);
  SendDecrypted(buffer->mId, aResult, buffer->mData);
  delete buffer;
}
示例#17
0
GMPErr
GMPStorageChild::Read(GMPRecordImpl* aRecord)
{
  MonitorAutoLock lock(mMonitor);

  if (mShutdown) {
    NS_WARNING("GMPStorage used after it's been shutdown!");
    return GMPClosedErr;
  }

  if (!HasRecord(aRecord->Name())) {
    // Record not opened.
    return GMPClosedErr;
  }

  CALL_ON_GMP_THREAD(SendRead, aRecord->Name());

  return GMPNoErr;
}
示例#18
0
void
GMPDecryptorChild::ResolvePromise(uint32_t aPromiseId)
{
  CALL_ON_GMP_THREAD(SendResolvePromise, aPromiseId);
}
示例#19
0
void
GMPDecryptorChild::ResolveLoadSessionPromise(uint32_t aPromiseId,
                                             bool aSuccess)
{
  CALL_ON_GMP_THREAD(SendResolveLoadSessionPromise, aPromiseId, aSuccess);
}
示例#20
0
void
GMPDecryptorChild::SetCapabilities(uint64_t aCaps)
{
  CALL_ON_GMP_THREAD(SendSetCaps, aCaps);
}