Revert bug 1251065 due to stupidity

This commit is contained in:
James Willcox 2016-02-25 10:51:34 -06:00
parent fc58af66ea
commit 3300b5d6b5
3 changed files with 0 additions and 50 deletions

View File

@ -4,11 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <string>
#include <sstream>
#include "GfxTexturesReporter.h"
#include "gfxPrefs.h"
#include "mozilla/Preferences.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
@ -23,57 +19,16 @@ Atomic<size_t> GfxTexturesReporter::sAmount(0);
Atomic<size_t> GfxTexturesReporter::sPeakAmount(0);
Atomic<size_t> GfxTexturesReporter::sTileWasteAmount(0);
std::string
FormatBytes(size_t amount)
{
std::stringstream stream;
int depth = 0;
double val = amount;
while (val > 1024) {
val /= 1024;
depth++;
}
const char* unit;
switch(depth) {
case 0:
unit = "bytes";
break;
case 1:
unit = "KB";
break;
case 2:
unit = "MB";
break;
case 3:
unit = "GB";
break;
}
stream << val << " " << unit;
return stream.str();
}
/* static */ void
GfxTexturesReporter::UpdateAmount(MemoryUse action, size_t amount)
{
if (action == MemoryFreed) {
MOZ_RELEASE_ASSERT(amount <= sAmount);
sAmount -= amount;
if (gfxPrefs::GfxLoggingTextureUsageEnabled()) {
size_t amount = sAmount;
printf_stderr("Current texture usage: %s\n", FormatBytes(amount).c_str());
}
} else {
sAmount += amount;
if (sAmount > sPeakAmount) {
sPeakAmount = sAmount;
if (gfxPrefs::GfxLoggingPeakTextureUsageEnabled()) {
size_t peak = sPeakAmount;
printf_stderr("Peak texture usage: %s\n", FormatBytes(peak).c_str());
}
}
}

View File

@ -262,8 +262,6 @@ private:
// Note that "gfx.logging.level" is defined in Logging.h
DECL_GFX_PREF(Once, "gfx.logging.crash.length", GfxLoggingCrashLength, uint32_t, 16);
// The maximums here are quite conservative, we can tighten them if problems show up.
DECL_GFX_PREF(Once, "gfx.logging.texture-usage.enabled", GfxLoggingTextureUsageEnabled, bool, false);
DECL_GFX_PREF(Once, "gfx.logging.peak-texture-usage.enabled",GfxLoggingPeakTextureUsageEnabled, bool, false);
DECL_GFX_PREF(Once, "gfx.max-alloc-size", MaxAllocSize, int32_t, (int32_t)500000000);
DECL_GFX_PREF(Once, "gfx.max-texture-size", MaxTextureSize, int32_t, (int32_t)32767);
DECL_GFX_PREF(Live, "gfx.partialpresent.force", PartialPresent, int32_t, 0);

View File

@ -730,9 +730,6 @@ pref("gfx.prefer-mesa-llvmpipe", false);
pref("gfx.draw-color-bars", false);
pref("gfx.logging.texture-usage.enabled", false);
pref("gfx.logging.peak-texture-usage.enabled", false);
pref("accessibility.browsewithcaret", false);
pref("accessibility.warn_on_browsewithcaret", true);