зеркало из https://github.com/mozilla/pjs.git
Bug 629611. Add font cache size info to about:support. r=bas,joedrew a=joedrew
This commit is contained in:
Родитель
df7b690830
Коммит
00bd67cec6
|
@ -76,6 +76,9 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#include <Shlobj.h>
|
||||
#include <Shlwapi.h>
|
||||
|
||||
#ifdef CAIRO_HAS_D2D_SURFACE
|
||||
#include "gfxD2DSurface.h"
|
||||
|
||||
|
@ -728,6 +731,36 @@ gfxWindowsPlatform::GetDLLVersion(const PRUnichar *aDLLPath, nsAString& aVersion
|
|||
aVersion.Assign(NS_ConvertUTF8toUTF16(buf));
|
||||
}
|
||||
|
||||
void
|
||||
gfxWindowsPlatform::GetFontCacheSize(nsAString& aSize)
|
||||
{
|
||||
WIN32_FIND_DATAW findFileData;
|
||||
HANDLE file;
|
||||
LARGE_INTEGER fileSize;
|
||||
WCHAR path[MAX_PATH];
|
||||
|
||||
aSize.Assign(L"n/a");
|
||||
|
||||
if (FAILED(SHGetFolderPathW(NULL, CSIDL_WINDOWS, NULL, 0, path))) {
|
||||
return;
|
||||
}
|
||||
|
||||
PathAppendW(path,
|
||||
L"ServiceProfiles\\LocalService\\AppData\\Local\\FontCache-*-*.dat");
|
||||
file = FindFirstFileW(path, &findFileData);
|
||||
if (file == INVALID_HANDLE_VALUE) {
|
||||
return;
|
||||
}
|
||||
|
||||
WCHAR size[256];
|
||||
|
||||
double sizeMB = (double(findFileData.nFileSizeLow) +
|
||||
findFileData.nFileSizeHigh * (double(MAXDWORD) + 1))
|
||||
/ 1000000.0;
|
||||
swprintf(size, L"%.2f MB", sizeMB);
|
||||
aSize.Assign(size);
|
||||
}
|
||||
|
||||
void
|
||||
gfxWindowsPlatform::FontsPrefsChanged(nsIPrefBranch *aPrefBranch, const char *aPref)
|
||||
{
|
||||
|
|
|
@ -229,6 +229,8 @@ public:
|
|||
|
||||
static void GetDLLVersion(const PRUnichar *aDLLPath, nsAString& aVersion);
|
||||
|
||||
static void GetFontCacheSize(nsAString& aSize);
|
||||
|
||||
virtual void FontsPrefsChanged(nsIPrefBranch *aPrefBranch, const char *aPref);
|
||||
|
||||
#ifdef CAIRO_HAS_DWRITE_FONT
|
||||
|
|
|
@ -102,7 +102,13 @@ GfxInfo::GetDWriteEnabled(PRBool *aEnabled)
|
|||
NS_IMETHODIMP
|
||||
GfxInfo::GetDWriteVersion(nsAString & aDwriteVersion)
|
||||
{
|
||||
gfxWindowsPlatform::GetPlatform()->GetDLLVersion(L"dwrite.dll", aDwriteVersion);
|
||||
nsAutoString str;
|
||||
gfxWindowsPlatform::GetPlatform()->GetDLLVersion(L"dwrite.dll", str);
|
||||
aDwriteVersion.Assign(str);
|
||||
aDwriteVersion.Append(L", font cache ");
|
||||
gfxWindowsPlatform::GetPlatform()->GetFontCacheSize(str);
|
||||
aDwriteVersion.Append(str);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче