Bug 1320346 - dump |rv| when AddBlocker() fails to get more debugging info. r=cpearce

MozReview-Commit-ID: LA3uPvdKCU5

--HG--
extra : rebase_source : c75effe6260dfc0318a1c18edd77ebdda68b5b83
This commit is contained in:
JW Wang 2016-11-29 10:38:32 +08:00
Родитель 5dc843a1d7
Коммит 76ca346c0c
1 изменённых файлов: 11 добавлений и 2 удалений

Просмотреть файл

@ -74,7 +74,16 @@ MediaShutdownManager::EnsureCorrectShutdownObserverState()
nsresult rv = GetShutdownBarrier()->AddBlocker(
this, NS_LITERAL_STRING(__FILE__), __LINE__,
NS_LITERAL_STRING("MediaShutdownManager shutdown"));
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));
if (NS_FAILED(rv)) {
// Leak the buffer on the heap to make sure that it lives long enough,
// as MOZ_CRASH_ANNOTATE expects the pointer passed to it to live to
// the end of the program.
const size_t CAPACITY = 256;
auto buf = new char[CAPACITY];
snprintf(buf, CAPACITY, "Failed to add shutdown blocker! rv=%x", rv);
MOZ_CRASH_ANNOTATE(buf);
MOZ_REALLY_CRASH();
}
} else {
GetShutdownBarrier()->RemoveBlocker(this);
// Clear our singleton reference. This will probably delete
@ -89,7 +98,7 @@ void
MediaShutdownManager::Register(MediaDecoder* aDecoder)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_DIAGNOSTIC_ASSERT(!mIsDoingXPCOMShutDown);
MOZ_RELEASE_ASSERT(!mIsDoingXPCOMShutDown);
// Don't call Register() after you've Unregistered() all the decoders,
// that's not going to work.
MOZ_ASSERT(!mDecoders.Contains(aDecoder));