OLD | NEW |
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 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 ChromeBrowserMainParts::PostProfileInit(); | 242 ChromeBrowserMainParts::PostProfileInit(); |
243 | 243 |
244 // DirectWrite support is mainly available Windows 7 and up. | 244 // DirectWrite support is mainly available Windows 7 and up. |
245 if (gfx::win::ShouldUseDirectWrite()) { | 245 if (gfx::win::ShouldUseDirectWrite()) { |
246 base::FilePath path( | 246 base::FilePath path( |
247 profile()->GetPath().AppendASCII(content::kFontCacheSharedSectionName)); | 247 profile()->GetPath().AppendASCII(content::kFontCacheSharedSectionName)); |
248 // This function will create a read only section if cache file exists | 248 // This function will create a read only section if cache file exists |
249 // otherwise it will spawn utility process to build cache file, which will | 249 // otherwise it will spawn utility process to build cache file, which will |
250 // be used during next browser start/postprofileinit. | 250 // be used during next browser start/postprofileinit. |
251 if (!content::LoadFontCache(path)) { | 251 if (!content::LoadFontCache(path)) { |
252 content::BrowserThread::PostTask( | 252 // We delay building of font cache until first startup page loads. |
253 content::BrowserThread::IO, FROM_HERE, | 253 // During first renderer start there are lot of things happening |
254 base::Bind(ExecuteFontCacheBuildTask, path)); | 254 // simultaneously some of them are: |
| 255 // - Renderer is going through all font files on the system to create |
| 256 // a font collection. |
| 257 // - Renderer loading up startup URL, accessing HTML/JS File cache, |
| 258 // net activity etc. |
| 259 // - Extension initialization. |
| 260 // We delay building of cache mainly to avoid parallel font file |
| 261 // loading along with Renderer. Some systems have significant number of |
| 262 // font files which takes long time to process. |
| 263 // Related information is at http://crbug.com/436195. |
| 264 const int kBuildFontCacheDelaySec = 15; |
| 265 content::BrowserThread::PostDelayedTask( |
| 266 content::BrowserThread::IO, |
| 267 FROM_HERE, |
| 268 base::Bind(ExecuteFontCacheBuildTask, path), |
| 269 base::TimeDelta::FromSeconds(kBuildFontCacheDelaySec)); |
255 } | 270 } |
256 } | 271 } |
257 } | 272 } |
258 | 273 |
259 void ChromeBrowserMainPartsWin::PostBrowserStart() { | 274 void ChromeBrowserMainPartsWin::PostBrowserStart() { |
260 ChromeBrowserMainParts::PostBrowserStart(); | 275 ChromeBrowserMainParts::PostBrowserStart(); |
261 | 276 |
262 UMA_HISTOGRAM_BOOLEAN("Windows.Tablet", base::win::IsTabletDevice()); | 277 UMA_HISTOGRAM_BOOLEAN("Windows.Tablet", base::win::IsTabletDevice()); |
263 | 278 |
264 // Set up a task to verify installed modules in the current process. Use a | 279 // Set up a task to verify installed modules in the current process. Use a |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 if (resource_id) | 474 if (resource_id) |
460 return l10n_util::GetStringUTF16(resource_id); | 475 return l10n_util::GetStringUTF16(resource_id); |
461 return base::string16(); | 476 return base::string16(); |
462 } | 477 } |
463 | 478 |
464 // static | 479 // static |
465 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { | 480 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { |
466 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); | 481 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); |
467 installer::SetTranslationDelegate(&delegate); | 482 installer::SetTranslationDelegate(&delegate); |
468 } | 483 } |
OLD | NEW |