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

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

Issue 1557513002: Add logic to switch to DirectWrite font proxy via field trial. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove extraneous namespace qualification Created 4 years, 11 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 | chrome/utility/font_cache_handler_win.h » ('j') | 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 108 }
109 109
110 class TranslationDelegate : public installer::TranslationDelegate { 110 class TranslationDelegate : public installer::TranslationDelegate {
111 public: 111 public:
112 base::string16 GetLocalizedString(int installer_string_id) override; 112 base::string16 GetLocalizedString(int installer_string_id) override;
113 }; 113 };
114 114
115 void ExecuteFontCacheBuildTask(const base::FilePath& path) { 115 void ExecuteFontCacheBuildTask(const base::FilePath& path) {
116 base::WeakPtr<content::UtilityProcessHost> utility_process_host( 116 base::WeakPtr<content::UtilityProcessHost> utility_process_host(
117 content::UtilityProcessHost::Create(NULL, NULL)->AsWeakPtr()); 117 content::UtilityProcessHost::Create(NULL, NULL)->AsWeakPtr());
118 utility_process_host->SetName(l10n_util::GetStringUTF16( 118 utility_process_host->SetName(
119 IDS_UTILITY_PROCESS_FONT_CACHE_BUILDER_NAME)); 119 l10n_util::GetStringUTF16(IDS_UTILITY_PROCESS_FONT_CACHE_BUILDER_NAME));
120 utility_process_host->DisableSandbox(); 120 utility_process_host->DisableSandbox();
121 utility_process_host->Send( 121 utility_process_host->Send(
122 new ChromeUtilityHostMsg_BuildDirectWriteFontCache(path)); 122 new ChromeUtilityHostMsg_BuildDirectWriteFontCache(path));
123 } 123 }
124 124
125 #if defined(KASKO) 125 #if defined(KASKO)
126 void ObserveFailedCrashReportDirectory(const base::FilePath& path, bool error) { 126 void ObserveFailedCrashReportDirectory(const base::FilePath& path, bool error) {
127 DCHECK(!error); 127 DCHECK(!error);
128 if (error) 128 if (error)
129 return; 129 return;
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 ui::MessageBox(NULL, 337 ui::MessageBox(NULL,
338 base::ASCIIToUTF16(chrome_browser::kMissingLocaleDataMessage), 338 base::ASCIIToUTF16(chrome_browser::kMissingLocaleDataMessage),
339 base::ASCIIToUTF16(chrome_browser::kMissingLocaleDataTitle), 339 base::ASCIIToUTF16(chrome_browser::kMissingLocaleDataTitle),
340 MB_OK | MB_ICONERROR | MB_TOPMOST); 340 MB_OK | MB_ICONERROR | MB_TOPMOST);
341 } 341 }
342 342
343 void ChromeBrowserMainPartsWin::PostProfileInit() { 343 void ChromeBrowserMainPartsWin::PostProfileInit() {
344 ChromeBrowserMainParts::PostProfileInit(); 344 ChromeBrowserMainParts::PostProfileInit();
345 345
346 // DirectWrite support is mainly available Windows 7 and up. 346 // DirectWrite support is mainly available Windows 7 and up.
347 if (gfx::win::ShouldUseDirectWrite()) { 347 // Skip loading the font cache if we are using the font proxy field trial.
348 if (gfx::win::ShouldUseDirectWrite() &&
349 !content::ShouldUseDirectWriteFontProxyFieldTrial()) {
348 base::FilePath path( 350 base::FilePath path(
349 profile()->GetPath().AppendASCII(content::kFontCacheSharedSectionName)); 351 profile()->GetPath().AppendASCII(content::kFontCacheSharedSectionName));
350 // This function will create a read only section if cache file exists 352 // This function will create a read only section if cache file exists
351 // otherwise it will spawn utility process to build cache file, which will 353 // otherwise it will spawn utility process to build cache file, which will
352 // be used during next browser start/postprofileinit. 354 // be used during next browser start/postprofileinit.
353 if (!content::LoadFontCache(path)) { 355 if (!content::LoadFontCache(path)) {
354 // We delay building of font cache until first startup page loads. 356 // We delay building of font cache until first startup page loads.
355 // During first renderer start there are lot of things happening 357 // During first renderer start there are lot of things happening
356 // simultaneously some of them are: 358 // simultaneously some of them are:
357 // - Renderer is going through all font files on the system to create 359 // - Renderer is going through all font files on the system to create a
358 // a font collection. 360 // font collection.
359 // - Renderer loading up startup URL, accessing HTML/JS File cache, 361 // - Renderer loading up startup URL, accessing HTML/JS File cache, net
360 // net activity etc. 362 // activity etc.
361 // - Extension initialization. 363 // - Extension initialization.
362 // We delay building of cache mainly to avoid parallel font file 364 // We delay building of cache mainly to avoid parallel font file loading
363 // loading along with Renderer. Some systems have significant number of 365 // along with Renderer. Some systems have significant number of font files
364 // font files which takes long time to process. 366 // which takes long time to process.
365 // Related information is at http://crbug.com/436195. 367 // Related information is at http://crbug.com/436195.
366 const int kBuildFontCacheDelaySec = 30; 368 const int kBuildFontCacheDelaySec = 30;
367 content::BrowserThread::PostDelayedTask( 369 content::BrowserThread::PostDelayedTask(
368 content::BrowserThread::IO, 370 content::BrowserThread::IO,
369 FROM_HERE, 371 FROM_HERE,
370 base::Bind(ExecuteFontCacheBuildTask, path), 372 base::Bind(ExecuteFontCacheBuildTask, path),
371 base::TimeDelta::FromSeconds(kBuildFontCacheDelaySec)); 373 base::TimeDelta::FromSeconds(kBuildFontCacheDelaySec));
372 } 374 }
373 } 375 }
374 } 376 }
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 if (resource_id) 576 if (resource_id)
575 return l10n_util::GetStringUTF16(resource_id); 577 return l10n_util::GetStringUTF16(resource_id);
576 return base::string16(); 578 return base::string16();
577 } 579 }
578 580
579 // static 581 // static
580 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { 582 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() {
581 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); 583 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ());
582 installer::SetTranslationDelegate(&delegate); 584 installer::SetTranslationDelegate(&delegate);
583 } 585 }
OLDNEW
« no previous file with comments | « no previous file | chrome/utility/font_cache_handler_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698