コード例 #1
0
ファイル: MediaResource.cpp プロジェクト: Shaif95/gecko-dev
void FileMediaResource::EnsureSizeInitialized()
{
  mLock.AssertCurrentThreadOwns();
  NS_ASSERTION(mInput, "Must have file input stream");
  if (mSizeInitialized) {
    return;
  }
  mSizeInitialized = true;
  // Get the file size and inform the decoder.
  uint64_t size;
  nsresult res = mInput->Available(&size);
  if (NS_SUCCEEDED(res) && size <= INT64_MAX) {
    mSize = (int64_t)size;
    mCallback->NotifyDataEnded(NS_OK);
  }
}
コード例 #2
0
void FileMediaResource::EnsureSizeInitialized()
{
    mLock.AssertCurrentThreadOwns();
    NS_ASSERTION(mInput, "Must have file input stream");
    if (mSizeInitialized) {
        return;
    }
    mSizeInitialized = true;
    // Get the file size and inform the decoder.
    uint64_t size;
    nsresult res = mInput->Available(&size);
    if (NS_SUCCEEDED(res) && size <= PR_INT64_MAX) {
        mSize = (int64_t)size;
        nsCOMPtr<nsIRunnable> event = new LoadedEvent(mDecoder);
        NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
    }
}