Bug 1162336 - 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:
Eric Rahm
2015-05-07 12:52:45 -07:00
parent b676a83446
commit 1d6101df90
10 changed files with 86 additions and 58 deletions

View File

@@ -225,9 +225,11 @@ nsOfflineCacheEvictionFunction::Apply()
LOG(("nsOfflineCacheEvictionFunction::Apply\n"));
for (int32_t i = 0; i < mItems.Count(); i++) {
nsAutoCString path;
mItems[i]->GetNativePath(path);
LOG((" removing %s\n", path.get()));
if (PR_LOG_TEST(gCacheLog, PR_LOG_DEBUG)) {
nsAutoCString path;
mItems[i]->GetNativePath(path);
LOG((" removing %s\n", path.get()));
}
mItems[i]->Remove(false);
}