Chromium Code Reviews| Index: chrome/browser/chrome_browser_main_win.cc |
| diff --git a/chrome/browser/chrome_browser_main_win.cc b/chrome/browser/chrome_browser_main_win.cc |
| index 0e2e53abc5ebacb9f4a36634b33da13ef294d592..bfad64d60b2cb77c584e365075ccbf7685588b13 100644 |
| --- a/chrome/browser/chrome_browser_main_win.cc |
| +++ b/chrome/browser/chrome_browser_main_win.cc |
| @@ -57,7 +57,6 @@ |
| #include "content/public/browser/utility_process_host.h" |
| #include "content/public/browser/utility_process_host_client.h" |
| #include "content/public/common/content_switches.h" |
| -#include "content/public/common/dwrite_font_platform_win.h" |
| #include "content/public/common/main_function_params.h" |
| #include "ui/base/cursor/cursor_loader_win.h" |
| #include "ui/base/l10n/l10n_util.h" |
| @@ -83,6 +82,8 @@ typedef HRESULT (STDAPICALLTYPE* RegisterApplicationRestartProc)( |
| const wchar_t* command_line, |
| DWORD flags); |
| +const char kFontCacheSharedSectionName[] = "ChromeDWriteFontCache"; |
| + |
| void InitializeWindowProcExceptions() { |
| // Get the breakpad pointer from chrome.exe |
| base::win::WinProcExceptionFilter exception_filter = |
| @@ -111,16 +112,6 @@ class TranslationDelegate : public installer::TranslationDelegate { |
| base::string16 GetLocalizedString(int installer_string_id) override; |
| }; |
| -void ExecuteFontCacheBuildTask(const base::FilePath& path) { |
| - base::WeakPtr<content::UtilityProcessHost> utility_process_host( |
| - content::UtilityProcessHost::Create(NULL, NULL)->AsWeakPtr()); |
| - utility_process_host->SetName(l10n_util::GetStringUTF16( |
| - IDS_UTILITY_PROCESS_FONT_CACHE_BUILDER_NAME)); |
| - utility_process_host->DisableSandbox(); |
| - utility_process_host->Send( |
| - new ChromeUtilityHostMsg_BuildDirectWriteFontCache(path)); |
| -} |
| - |
| #if defined(KASKO) |
| void ObserveFailedCrashReportDirectory(const base::FilePath& path, bool error) { |
| DCHECK(!error); |
| @@ -215,6 +206,11 @@ void DetectFaultTolerantHeap() { |
| UMA_HISTOGRAM_ENUMERATION("FaultTolerantHeap", detected, FTH_FLAGS_COUNT); |
| } |
| +void DeleteDirectWriteFontCache(base::FilePath path) { |
| + // Attempt to delte the font cache and ignore any errors. |
|
fdoray
2015/12/23 13:45:02
*delete
Ilya Kulshin
2015/12/28 22:47:05
Done.
|
| + ::DeleteFile(path.AsUTF16Unsafe().c_str()); |
|
fdoray
2015/12/23 13:45:02
base::DeleteFile? base/files/file_util.h
Ilya Kulshin
2015/12/28 22:47:05
Done.
|
| +} |
| + |
| } // namespace |
| void ShowCloseBrowserFirstMessageBox() { |
| @@ -342,33 +338,17 @@ void ChromeBrowserMainPartsWin::ShowMissingLocaleMessageBox() { |
| void ChromeBrowserMainPartsWin::PostProfileInit() { |
| ChromeBrowserMainParts::PostProfileInit(); |
| - // DirectWrite support is mainly available Windows 7 and up. |
| if (gfx::win::ShouldUseDirectWrite()) { |
| + // Clean up the direct write font cache since we no longer use that |
| + // codepath. |
| + // TODO(kulshin): remove this code after several releases. |
|
fdoray
2015/12/23 13:45:02
I would have been curious to see the impact of thi
|
| base::FilePath path( |
| - profile()->GetPath().AppendASCII(content::kFontCacheSharedSectionName)); |
| - // This function will create a read only section if cache file exists |
| - // otherwise it will spawn utility process to build cache file, which will |
| - // be used during next browser start/postprofileinit. |
| - if (!content::LoadFontCache(path)) { |
| - // We delay building of font cache until first startup page loads. |
| - // During first renderer start there are lot of things happening |
| - // simultaneously some of them are: |
| - // - Renderer is going through all font files on the system to create |
| - // a font collection. |
| - // - Renderer loading up startup URL, accessing HTML/JS File cache, |
| - // net activity etc. |
| - // - Extension initialization. |
| - // We delay building of cache mainly to avoid parallel font file |
| - // loading along with Renderer. Some systems have significant number of |
| - // font files which takes long time to process. |
| - // Related information is at http://crbug.com/436195. |
| - const int kBuildFontCacheDelaySec = 30; |
| - content::BrowserThread::PostDelayedTask( |
| - content::BrowserThread::IO, |
| - FROM_HERE, |
| - base::Bind(ExecuteFontCacheBuildTask, path), |
| - base::TimeDelta::FromSeconds(kBuildFontCacheDelaySec)); |
| - } |
| + profile()->GetPath().AppendASCII(kFontCacheSharedSectionName)); |
| + const int kBuildFontCacheDelaySec = 30; |
| + content::BrowserThread::PostDelayedTask( |
| + content::BrowserThread::IO, FROM_HERE, |
|
fdoray
2015/12/23 13:45:02
content::BrowserThread::FILE is the right thread f
Ilya Kulshin
2015/12/28 22:47:05
Done.
|
| + base::Bind(DeleteDirectWriteFontCache, path), |
| + base::TimeDelta::FromSeconds(kBuildFontCacheDelaySec)); |
| } |
| } |