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

Side by Side Diff: chrome/browser/chrome_browser_main_win.cc

Issue 1881043003: Delete the font cache file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo in comment Created 4 years, 8 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chrome_browser_main_win.h" 5 #include "chrome/browser/chrome_browser_main_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 #if BUILDFLAG(ENABLE_KASKO) 73 #if BUILDFLAG(ENABLE_KASKO)
74 #include "syzygy/kasko/api/reporter.h" 74 #include "syzygy/kasko/api/reporter.h"
75 #endif 75 #endif
76 76
77 namespace { 77 namespace {
78 78
79 typedef HRESULT (STDAPICALLTYPE* RegisterApplicationRestartProc)( 79 typedef HRESULT (STDAPICALLTYPE* RegisterApplicationRestartProc)(
80 const wchar_t* command_line, 80 const wchar_t* command_line,
81 DWORD flags); 81 DWORD flags);
82 82
83 const char kFontCacheSharedSectionName[] = "ChromeDWriteFontCache";
84
83 void InitializeWindowProcExceptions() { 85 void InitializeWindowProcExceptions() {
84 // Get the breakpad pointer from chrome.exe 86 // Get the breakpad pointer from chrome.exe
85 base::win::WinProcExceptionFilter exception_filter = 87 base::win::WinProcExceptionFilter exception_filter =
86 reinterpret_cast<base::win::WinProcExceptionFilter>( 88 reinterpret_cast<base::win::WinProcExceptionFilter>(
87 ::GetProcAddress(::GetModuleHandle( 89 ::GetProcAddress(::GetModuleHandle(
88 chrome::kBrowserProcessExecutableName), 90 chrome::kBrowserProcessExecutableName),
89 "CrashForException")); 91 "CrashForException"));
90 exception_filter = base::win::SetWinProcExceptionFilter(exception_filter); 92 exception_filter = base::win::SetWinProcExceptionFilter(exception_filter);
91 DCHECK(!exception_filter); 93 DCHECK(!exception_filter);
92 } 94 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 197
196 // Look for the DLLs used to implement the FTH and other compat hacks. 198 // Look for the DLLs used to implement the FTH and other compat hacks.
197 if (GetModuleHandleW(L"AcLayers.dll") != NULL) 199 if (GetModuleHandleW(L"AcLayers.dll") != NULL)
198 detected = static_cast<FTHFlags>(detected | FTH_ACLAYERS_LOADED); 200 detected = static_cast<FTHFlags>(detected | FTH_ACLAYERS_LOADED);
199 if (GetModuleHandleW(L"AcXtrnal.dll") != NULL) 201 if (GetModuleHandleW(L"AcXtrnal.dll") != NULL)
200 detected = static_cast<FTHFlags>(detected | FTH_ACXTRNAL_LOADED); 202 detected = static_cast<FTHFlags>(detected | FTH_ACXTRNAL_LOADED);
201 203
202 UMA_HISTOGRAM_ENUMERATION("FaultTolerantHeap", detected, FTH_FLAGS_COUNT); 204 UMA_HISTOGRAM_ENUMERATION("FaultTolerantHeap", detected, FTH_FLAGS_COUNT);
203 } 205 }
204 206
207 void DeleteDirectWriteFontCache(base::FilePath path) {
208 // TODO(kulshin): delete this function and associated code in 2017.
209 // Attempt to delete the font cache and ignore any errors.
210 base::DeleteFile(path, false /*recursive*/);
gab 2016/04/14 15:04:29 Define static const char kFontCacheSharedSectionN
gab 2016/04/14 15:04:29 Use kFontCacheSharedSectionName directly here inst
Ilya Kulshin 2016/04/14 21:55:37 Unfortunately I still need the path, since I need
Ilya Kulshin 2016/04/14 21:55:37 Inlined the string constant altogether, since it w
211 }
212
205 } // namespace 213 } // namespace
206 214
207 void ShowCloseBrowserFirstMessageBox() { 215 void ShowCloseBrowserFirstMessageBox() {
208 int message_id = IDS_UNINSTALL_CLOSE_APP; 216 int message_id = IDS_UNINSTALL_CLOSE_APP;
209 if (base::win::GetVersion() >= base::win::VERSION_WIN8 && 217 if (base::win::GetVersion() >= base::win::VERSION_WIN8 &&
210 (shell_integration::GetDefaultBrowser() == 218 (shell_integration::GetDefaultBrowser() ==
211 shell_integration::IS_DEFAULT)) { 219 shell_integration::IS_DEFAULT)) {
212 message_id = IDS_UNINSTALL_CLOSE_APP_IMMERSIVE; 220 message_id = IDS_UNINSTALL_CLOSE_APP_IMMERSIVE;
213 } 221 }
214 chrome::ShowWarningMessageBox(NULL, 222 chrome::ShowWarningMessageBox(NULL,
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 313
306 void ChromeBrowserMainPartsWin::ShowMissingLocaleMessageBox() { 314 void ChromeBrowserMainPartsWin::ShowMissingLocaleMessageBox() {
307 ui::MessageBox(NULL, 315 ui::MessageBox(NULL,
308 base::ASCIIToUTF16(chrome_browser::kMissingLocaleDataMessage), 316 base::ASCIIToUTF16(chrome_browser::kMissingLocaleDataMessage),
309 base::ASCIIToUTF16(chrome_browser::kMissingLocaleDataTitle), 317 base::ASCIIToUTF16(chrome_browser::kMissingLocaleDataTitle),
310 MB_OK | MB_ICONERROR | MB_TOPMOST); 318 MB_OK | MB_ICONERROR | MB_TOPMOST);
311 } 319 }
312 320
313 void ChromeBrowserMainPartsWin::PostProfileInit() { 321 void ChromeBrowserMainPartsWin::PostProfileInit() {
314 ChromeBrowserMainParts::PostProfileInit(); 322 ChromeBrowserMainParts::PostProfileInit();
323
324 base::FilePath path(
325 profile()->GetPath().AppendASCII(kFontCacheSharedSectionName));
326 const int kBuildFontCacheDelaySec = 30;
327 content::BrowserThread::PostDelayedTask(
gab 2016/04/14 15:04:29 Use BrowserThread::PostAfterStartupTask() instead
Ilya Kulshin 2016/04/14 21:55:37 Done.
328 content::BrowserThread::FILE, FROM_HERE,
329 base::Bind(DeleteDirectWriteFontCache, path),
330 base::TimeDelta::FromSeconds(kBuildFontCacheDelaySec));
315 } 331 }
316 332
317 void ChromeBrowserMainPartsWin::PostBrowserStart() { 333 void ChromeBrowserMainPartsWin::PostBrowserStart() {
318 ChromeBrowserMainParts::PostBrowserStart(); 334 ChromeBrowserMainParts::PostBrowserStart();
319 335
320 UMA_HISTOGRAM_BOOLEAN("Windows.Tablet", base::win::IsTabletDevice(nullptr)); 336 UMA_HISTOGRAM_BOOLEAN("Windows.Tablet", base::win::IsTabletDevice(nullptr));
321 337
322 // Set up a task to verify installed modules in the current process. 338 // Set up a task to verify installed modules in the current process.
323 content::BrowserThread::PostAfterStartupTask( 339 content::BrowserThread::PostAfterStartupTask(
324 FROM_HERE, content::BrowserThread::GetBlockingPool(), 340 FROM_HERE, content::BrowserThread::GetBlockingPool(),
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 if (resource_id) 527 if (resource_id)
512 return l10n_util::GetStringUTF16(resource_id); 528 return l10n_util::GetStringUTF16(resource_id);
513 return base::string16(); 529 return base::string16();
514 } 530 }
515 531
516 // static 532 // static
517 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { 533 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() {
518 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); 534 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ());
519 installer::SetTranslationDelegate(&delegate); 535 installer::SetTranslationDelegate(&delegate);
520 } 536 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698