Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Unified Diff: chrome/browser/chrome_browser_main_win.cc

Issue 1432123002: Switch to direct write font proxy and remove the font cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dwfontsplit
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/chrome_utility.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cbe463ab9fd0bff51e403b3a0175d72838eface8..5d8a237daee9279daea0dc4f31e67dd78efdbb5e 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 delete the font cache and ignore any errors.
+ base::DeleteFile(path, false /*recursive*/);
+}
+
} // 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.
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::FILE, FROM_HERE,
+ base::Bind(DeleteDirectWriteFontCache, path),
+ base::TimeDelta::FromSeconds(kBuildFontCacheDelaySec));
}
}
« no previous file with comments | « no previous file | chrome/chrome_utility.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698