зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1162673 - Part 2: Wrap expensive calls in PR_LOG_TEST. r=froydnj
Check that logging is enabled before performing potentially expensive operations.
This commit is contained in:
Родитель
e1ce2b6323
Коммит
42c69a4135
|
@ -978,6 +978,18 @@ LogTextPerfStats(gfxTextPerfMetrics* aTextPerf,
|
|||
const gfxTextPerfMetrics::TextCounts& aCounts,
|
||||
float aTime, TextPerfLogType aLogType, const char* aURL)
|
||||
{
|
||||
PRLogModuleInfo* tpLog = gfxPlatform::GetLog(eGfxLog_textperf);
|
||||
|
||||
// ignore XUL contexts unless at debug level
|
||||
PRLogModuleLevel logLevel = PR_LOG_WARNING;
|
||||
if (aCounts.numContentTextRuns == 0) {
|
||||
logLevel = PR_LOG_DEBUG;
|
||||
}
|
||||
|
||||
if (!PR_LOG_TEST(tpLog, logLevel)) {
|
||||
return;
|
||||
}
|
||||
|
||||
char prefix[256];
|
||||
|
||||
switch (aLogType) {
|
||||
|
@ -992,14 +1004,6 @@ LogTextPerfStats(gfxTextPerfMetrics* aTextPerf,
|
|||
sprintf(prefix, "(textperf-totals) %p", aPresShell);
|
||||
}
|
||||
|
||||
PRLogModuleInfo* tpLog = gfxPlatform::GetLog(eGfxLog_textperf);
|
||||
|
||||
// ignore XUL contexts unless at debug level
|
||||
PRLogModuleLevel logLevel = PR_LOG_WARNING;
|
||||
if (aCounts.numContentTextRuns == 0) {
|
||||
logLevel = PR_LOG_DEBUG;
|
||||
}
|
||||
|
||||
double hitRatio = 0.0;
|
||||
uint32_t lookups = aCounts.wordCacheHit + aCounts.wordCacheMiss;
|
||||
if (lookups) {
|
||||
|
|
|
@ -1707,21 +1707,23 @@ nsPrintEngine::SetupToPrintContent()
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
float calcRatio = 0.0f;
|
||||
if (mPrt->mPrintDocList.Length() > 1 && mPrt->mPrintObject->mFrameType == eFrameSet) {
|
||||
nsPrintObject* smallestPO = FindSmallestSTF();
|
||||
NS_ASSERTION(smallestPO, "There must always be an XMost PO!");
|
||||
if (smallestPO) {
|
||||
// Calc the shrinkage based on the entire content area
|
||||
calcRatio = smallestPO->mShrinkRatio;
|
||||
if (PR_LOG_TEST(GetPrintingLog(), PR_LOG_DEBUG)) {
|
||||
float calcRatio = 0.0f;
|
||||
if (mPrt->mPrintDocList.Length() > 1 && mPrt->mPrintObject->mFrameType == eFrameSet) {
|
||||
nsPrintObject* smallestPO = FindSmallestSTF();
|
||||
NS_ASSERTION(smallestPO, "There must always be an XMost PO!");
|
||||
if (smallestPO) {
|
||||
// Calc the shrinkage based on the entire content area
|
||||
calcRatio = smallestPO->mShrinkRatio;
|
||||
}
|
||||
} else {
|
||||
// Single document so use the Shrink as calculated for the PO
|
||||
calcRatio = mPrt->mPrintObject->mShrinkRatio;
|
||||
}
|
||||
} else {
|
||||
// Single document so use the Shrink as calculated for the PO
|
||||
calcRatio = mPrt->mPrintObject->mShrinkRatio;
|
||||
PR_PL(("**************************************************************************\n"));
|
||||
PR_PL(("STF Ratio is: %8.5f Effective Ratio: %8.5f Diff: %8.5f\n", mPrt->mShrinkRatio, calcRatio, mPrt->mShrinkRatio-calcRatio));
|
||||
PR_PL(("**************************************************************************\n"));
|
||||
}
|
||||
PR_PL(("**************************************************************************\n"));
|
||||
PR_PL(("STF Ratio is: %8.5f Effective Ratio: %8.5f Diff: %8.5f\n", mPrt->mShrinkRatio, calcRatio, mPrt->mShrinkRatio-calcRatio));
|
||||
PR_PL(("**************************************************************************\n"));
|
||||
}
|
||||
|
||||
// If the frames got reconstructed and reflowed the number of pages might
|
||||
|
|
Загрузка…
Ссылка в новой задаче