Bug 1466613 - Add a gfxCriticalNote to provide more details on replay failure. r=jrmuizel

Differential Revision: https://phabricator.services.mozilla.com/D8257

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kartikaya Gupta 2018-11-13 10:38:24 +00:00
Родитель 23793e3a21
Коммит 88030616a1
3 изменённых файлов: 13 добавлений и 1 удалений

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

@ -56,18 +56,21 @@ InlineTranslator::TranslateRecording(char *aData, size_t aLen)
uint32_t magicInt;
ReadElement(reader, magicInt);
if (magicInt != mozilla::gfx::kMagicInt) {
mError = "Magic";
return false;
}
uint16_t majorRevision;
ReadElement(reader, majorRevision);
if (majorRevision != kMajorRevision) {
mError = "Major";
return false;
}
uint16_t minorRevision;
ReadElement(reader, minorRevision);
if (minorRevision > kMinorRevision) {
mError = "Minor";
return false;
}
@ -78,16 +81,19 @@ InlineTranslator::TranslateRecording(char *aData, size_t aLen)
[&] (RecordedEvent *recordedEvent) {
// Make sure that the whole event was read from the stream successfully.
if (!reader.good()) {
mError = " READ";
return false;
}
if (!recordedEvent->PlayEvent(this)) {
mError = " PLAY";
return false;
}
return true;
});
if (!success) {
mError = RecordedEvent::GetEventName(static_cast<RecordedEvent::EventType>(eventType)) + mError;
return false;
}

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

@ -8,6 +8,7 @@
#define mozilla_layout_InlineTranslator_h
#include <istream>
#include <string>
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/Filters.h"
@ -184,10 +185,12 @@ public:
mozilla::gfx::DrawTarget* GetReferenceDrawTarget() final { return mBaseDT; }
void* GetFontContext() final { return mFontContext; }
std::string GetError() { return mError; }
private:
RefPtr<DrawTarget> mBaseDT;
void* mFontContext;
std::string mError;
nsRefPtrHashtable<nsPtrHashKey<void>, DrawTarget> mDrawTargets;
nsRefPtrHashtable<nsPtrHashKey<void>, Path> mPaths;

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

@ -445,7 +445,10 @@ static bool Moz2DRenderCallback(const Range<const uint8_t> aBlob,
Range<const uint8_t> blob(aBlob.begin() + offset, aBlob.begin() + end);
ret = translator.TranslateRecording((char*)blob.begin().get(), blob.length());
MOZ_RELEASE_ASSERT(ret);
if (!ret) {
gfxCriticalNote << "Replay failure: " << translator.GetError();
MOZ_RELEASE_ASSERT(false);
}
offset = extra_end;
}