mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-23 13:04:28 +00:00
Bug 770789 - Remove dead StorageMemoryReporter. r=mak.
--HG-- extra : rebase_source : 6b0e4d4c74ff45deb57008ffb32ce1316c9d3e7c
This commit is contained in:
parent
1cb6d6b979
commit
1170e5054f
@ -377,122 +377,6 @@ private:
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//// Memory Reporting
|
||||
|
||||
class StorageMemoryReporter MOZ_FINAL : public nsIMemoryReporter
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
enum ReporterType {
|
||||
Cache_Used,
|
||||
Schema_Used,
|
||||
Stmt_Used
|
||||
};
|
||||
|
||||
StorageMemoryReporter(sqlite3 *aDBConn,
|
||||
const nsCString &aFileName,
|
||||
ReporterType aType)
|
||||
: mDBConn(aDBConn)
|
||||
, mFileName(aFileName)
|
||||
, mType(aType)
|
||||
, mHasLeaked(false)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHOD GetProcess(nsACString &process)
|
||||
{
|
||||
process.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD GetPath(nsACString &path)
|
||||
{
|
||||
path.AssignLiteral("explicit/storage/sqlite/");
|
||||
path.Append(mFileName);
|
||||
if (mHasLeaked) {
|
||||
path.AppendLiteral("-LEAKED");
|
||||
}
|
||||
|
||||
if (mType == Cache_Used) {
|
||||
path.AppendLiteral("/cache-used");
|
||||
}
|
||||
else if (mType == Schema_Used) {
|
||||
path.AppendLiteral("/schema-used");
|
||||
}
|
||||
else if (mType == Stmt_Used) {
|
||||
path.AppendLiteral("/stmt-used");
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD GetKind(PRInt32 *kind)
|
||||
{
|
||||
*kind = KIND_HEAP;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD GetUnits(PRInt32 *units)
|
||||
{
|
||||
*units = UNITS_BYTES;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD GetAmount(PRInt64 *amount)
|
||||
{
|
||||
int type = 0;
|
||||
if (mType == Cache_Used) {
|
||||
type = SQLITE_DBSTATUS_CACHE_USED;
|
||||
}
|
||||
else if (mType == Schema_Used) {
|
||||
type = SQLITE_DBSTATUS_SCHEMA_USED;
|
||||
}
|
||||
else if (mType == Stmt_Used) {
|
||||
type = SQLITE_DBSTATUS_STMT_USED;
|
||||
}
|
||||
|
||||
int cur=0, max=0;
|
||||
int rc = ::sqlite3_db_status(mDBConn, type, &cur, &max, 0);
|
||||
*amount = cur;
|
||||
return convertResultCode(rc);
|
||||
}
|
||||
|
||||
NS_IMETHOD GetDescription(nsACString &desc)
|
||||
{
|
||||
if (mType == Cache_Used) {
|
||||
desc.AssignLiteral("Memory (approximate) used by all pager caches used "
|
||||
"by connections to this database.");
|
||||
}
|
||||
else if (mType == Schema_Used) {
|
||||
desc.AssignLiteral("Memory (approximate) used to store the schema "
|
||||
"for all databases associated with connections to "
|
||||
"this database.");
|
||||
}
|
||||
else if (mType == Stmt_Used) {
|
||||
desc.AssignLiteral("Memory (approximate) used by all prepared statements "
|
||||
"used by connections to this database.");
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// We call this when we know we've leaked a connection.
|
||||
void markAsLeaked()
|
||||
{
|
||||
mHasLeaked = true;
|
||||
}
|
||||
|
||||
private:
|
||||
sqlite3 *mDBConn;
|
||||
nsCString mFileName;
|
||||
ReporterType mType;
|
||||
bool mHasLeaked;
|
||||
};
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(
|
||||
StorageMemoryReporter
|
||||
, nsIMemoryReporter
|
||||
)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//// Connection
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user