void DecoderDoctorDiagnostics::StoreMediaKeySystemAccess(nsIDocument* aDocument, const nsAString& aKeySystem, bool aIsSupported, const char* aCallSite) { MOZ_ASSERT(NS_IsMainThread()); // Make sure we only store once. MOZ_ASSERT(mDiagnosticsType == eUnsaved); mDiagnosticsType = eMediaKeySystemAccessRequest; if (NS_WARN_IF(!aDocument)) { DD_WARN("DecoderDoctorDiagnostics[%p]::StoreMediaKeySystemAccess(nsIDocument* aDocument=nullptr, keysystem='%s', supported=%d, call site '%s')", this, NS_ConvertUTF16toUTF8(aKeySystem).get(), aIsSupported, aCallSite); return; } if (NS_WARN_IF(aKeySystem.IsEmpty())) { DD_WARN("DecoderDoctorDiagnostics[%p]::StoreMediaKeySystemAccess(nsIDocument* aDocument=%p, keysystem=<empty>, supported=%d, call site '%s')", this, aDocument, aIsSupported, aCallSite); return; } RefPtr<DecoderDoctorDocumentWatcher> watcher = DecoderDoctorDocumentWatcher::RetrieveOrCreate(aDocument); if (NS_WARN_IF(!watcher)) { DD_WARN("DecoderDoctorDiagnostics[%p]::StoreMediaKeySystemAccess(nsIDocument* aDocument=%p, keysystem='%s', supported=%d, call site '%s') - Could not create document watcher", this, aDocument, NS_ConvertUTF16toUTF8(aKeySystem).get(), aIsSupported, aCallSite); return; } mKeySystem = aKeySystem; mIsKeySystemSupported = aIsSupported; // StoreMediaKeySystemAccess should only be called once, after all data is // available, so it is safe to std::move() from this object. watcher->AddDiagnostics(std::move(*this), aCallSite); // Even though it's moved-from, the type should stay set // (Only used to ensure that we do store only once.) MOZ_ASSERT(mDiagnosticsType == eMediaKeySystemAccessRequest); }
void DecoderDoctorDiagnostics::StoreFormatDiagnostics(nsIDocument* aDocument, const nsAString& aFormat, bool aCanPlay, const char* aCallSite) { MOZ_ASSERT(NS_IsMainThread()); // Make sure we only store once. MOZ_ASSERT(mDiagnosticsType == eUnsaved); mDiagnosticsType = eFormatSupportCheck; if (NS_WARN_IF(!aDocument)) { DD_WARN("DecoderDoctorDiagnostics[%p]::StoreFormatDiagnostics(nsIDocument* aDocument=nullptr, format='%s', can-play=%d, call site '%s')", this, NS_ConvertUTF16toUTF8(aFormat).get(), aCanPlay, aCallSite); return; } if (NS_WARN_IF(aFormat.IsEmpty())) { DD_WARN("DecoderDoctorDiagnostics[%p]::StoreFormatDiagnostics(nsIDocument* aDocument=%p, format=<empty>, can-play=%d, call site '%s')", this, aDocument, aCanPlay, aCallSite); return; } RefPtr<DecoderDoctorDocumentWatcher> watcher = DecoderDoctorDocumentWatcher::RetrieveOrCreate(aDocument); if (NS_WARN_IF(!watcher)) { DD_WARN("DecoderDoctorDiagnostics[%p]::StoreFormatDiagnostics(nsIDocument* aDocument=%p, format='%s', can-play=%d, call site '%s') - Could not create document watcher", this, aDocument, NS_ConvertUTF16toUTF8(aFormat).get(), aCanPlay, aCallSite); return; } mFormat = aFormat; mCanPlay = aCanPlay; // StoreDiagnostics should only be called once, after all data is available, // so it is safe to std::move() from this object. watcher->AddDiagnostics(std::move(*this), aCallSite); // Even though it's moved-from, the type should stay set // (Only used to ensure that we do store only once.) MOZ_ASSERT(mDiagnosticsType == eFormatSupportCheck); }
void DecoderDoctorDiagnostics::StoreDecodeWarning(nsIDocument* aDocument, const MediaResult& aWarning, const nsString& aMediaSrc, const char* aCallSite) { MOZ_ASSERT(NS_IsMainThread()); // Make sure we only store once. MOZ_ASSERT(mDiagnosticsType == eUnsaved); mDiagnosticsType = eDecodeWarning; if (NS_WARN_IF(!aDocument)) { DD_WARN("DecoderDoctorDiagnostics[%p]::StoreDecodeWarning(" "nsIDocument* aDocument=nullptr, aWarning=%s," " aMediaSrc=<provided>, call site '%s')", this, aWarning.Description().get(), aCallSite); return; } RefPtr<DecoderDoctorDocumentWatcher> watcher = DecoderDoctorDocumentWatcher::RetrieveOrCreate(aDocument); if (NS_WARN_IF(!watcher)) { DD_WARN("DecoderDoctorDiagnostics[%p]::StoreDecodeWarning(" "nsIDocument* aDocument=%p, aWarning='%s', aMediaSrc=<provided>," " call site '%s') - Could not create document watcher", this, aDocument, aWarning.Description().get(), aCallSite); return; } mDecodeIssue = aWarning; mDecodeIssueMediaSrc = aMediaSrc; // StoreDecodeWarning should only be called once, after all data is // available, so it is safe to std::move() from this object. watcher->AddDiagnostics(std::move(*this), aCallSite); // Even though it's moved-from, the type should stay set // (Only used to ensure that we do store only once.) MOZ_ASSERT(mDiagnosticsType == eDecodeWarning); }