Bug 935701 - Get drawing recording working on b2g. r=bas

--HG--
extra : rebase_source : 783627519f291d187552b464689315ce2697df95
This commit is contained in:
Benoit Girard 2013-11-06 18:11:18 -05:00
parent e5e85044a9
commit 5788c09304
2 changed files with 25 additions and 1 deletions

View File

@ -214,7 +214,10 @@ void RecordingFontUserDataDestroyFunc(void *aUserData)
RecordingFontUserData *userData =
static_cast<RecordingFontUserData*>(aUserData);
// TODO support font in b2g recordings
#ifndef MOZ_WIDGET_GONK
userData->recorder->RecordEvent(RecordedScaledFontDestruction(userData->refPtr));
#endif
delete userData;
}
@ -227,7 +230,10 @@ DrawTargetRecording::FillGlyphs(ScaledFont *aFont,
const GlyphRenderingOptions *aRenderingOptions)
{
if (!aFont->GetUserData(reinterpret_cast<UserDataKey*>(mRecorder.get()))) {
// TODO support font in b2g recordings
#ifndef MOZ_WIDGET_GONK
mRecorder->RecordEvent(RecordedScaledFontCreation(aFont, aFont));
#endif
RecordingFontUserData *userData = new RecordingFontUserData;
userData->refPtr = aFont;
userData->recorder = mRecorder;
@ -235,7 +241,10 @@ DrawTargetRecording::FillGlyphs(ScaledFont *aFont,
&RecordingFontUserDataDestroyFunc);
}
// TODO support font in b2g recordings
#ifndef MOZ_WIDGET_GONK
mRecorder->RecordEvent(RecordedFillGlyphs(this, aFont, aPattern, aOptions, aBuffer.mGlyphs, aBuffer.mNumGlyphs));
#endif
mFinalDT->FillGlyphs(aFont, aBuffer, aPattern, aOptions, aRenderingOptions);
}

View File

@ -16,6 +16,8 @@
#include "gfxPlatform.h"
#include "nsXULAppAPI.h"
#include "nsDirectoryServiceUtils.h"
#include "nsDirectoryServiceDefs.h"
#if defined(XP_WIN)
#include "gfxWindowsPlatform.h"
@ -319,10 +321,23 @@ int RecordingPrefChanged(const char *aPrefName, void *aClosure)
if (prefFileName) {
fileName.Append(NS_ConvertUTF16toUTF8(prefFileName));
} else {
fileName.AssignLiteral("browserrecording.aer");
nsCOMPtr<nsIFile> tmpFile;
if (NS_FAILED(NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(tmpFile)))) {
return 0;
}
fileName.AppendPrintf("moz2drec_%i_%i.aer", XRE_GetProcessType(), getpid());
nsresult rv = tmpFile->AppendNative(fileName);
if (NS_FAILED(rv))
return 0;
rv = tmpFile->GetNativePath(fileName);
if (NS_FAILED(rv))
return 0;
}
gPlatform->mRecorder = Factory::CreateEventRecorderForFile(fileName.BeginReading());
printf_stderr("Recording to %s\n", fileName.get());
Factory::SetGlobalEventRecorder(gPlatform->mRecorder);
} else {
Factory::SetGlobalEventRecorder(nullptr);