| 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 // We delay building of font cache until first startup page loads. | 252 content::BrowserThread::PostTask( |
| 253 // Selected 5 seconds as delay based on 50th percentile value | 253 content::BrowserThread::IO, FROM_HERE, |
| 254 // for Startup.FirstWebContents.NonEmptyPaint. | 254 base::Bind(ExecuteFontCacheBuildTask, path)); |
| 255 // During first renderer start there are lot of things happening | |
| 256 // simultaneously some of them are: | |
| 257 // - Renderer is going through all font files on the system to create | |
| 258 // a font collection. | |
| 259 // - Renderer loading up startup URL, accessing HTML/JS File cache, | |
| 260 // net activity etc. | |
| 261 // - Extension initialization. | |
| 262 // We delay building of cache mainly to avoid parallel font file | |
| 263 // loading along with Renderer. Some systems have significant number of | |
| 264 // font files which takes long time to process. | |
| 265 // Related information is at http://crbug.com/436195. | |
| 266 const int kBuildFontCacheDelaySec = 5; | |
| 267 content::BrowserThread::PostDelayedTask( | |
| 268 content::BrowserThread::IO, | |
| 269 FROM_HERE, | |
| 270 base::Bind(ExecuteFontCacheBuildTask, path), | |
| 271 base::TimeDelta::FromSeconds(kBuildFontCacheDelaySec)); | |
| 272 } | 255 } |
| 273 } | 256 } |
| 274 } | 257 } |
| 275 | 258 |
| 276 void ChromeBrowserMainPartsWin::PostBrowserStart() { | 259 void ChromeBrowserMainPartsWin::PostBrowserStart() { |
| 277 ChromeBrowserMainParts::PostBrowserStart(); | 260 ChromeBrowserMainParts::PostBrowserStart(); |
| 278 | 261 |
| 279 UMA_HISTOGRAM_BOOLEAN("Windows.Tablet", base::win::IsTabletDevice()); | 262 UMA_HISTOGRAM_BOOLEAN("Windows.Tablet", base::win::IsTabletDevice()); |
| 280 | 263 |
| 281 // Set up a task to verify installed modules in the current process. Use a | 264 // 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... |
| 476 if (resource_id) | 459 if (resource_id) |
| 477 return l10n_util::GetStringUTF16(resource_id); | 460 return l10n_util::GetStringUTF16(resource_id); |
| 478 return base::string16(); | 461 return base::string16(); |
| 479 } | 462 } |
| 480 | 463 |
| 481 // static | 464 // static |
| 482 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { | 465 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { |
| 483 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); | 466 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); |
| 484 installer::SetTranslationDelegate(&delegate); | 467 installer::SetTranslationDelegate(&delegate); |
| 485 } | 468 } |
| OLD | NEW |