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 // Selected 5 seconds as delay based on 50th percentile value |
254 base::Bind(ExecuteFontCacheBuildTask, path)); | 254 // for Startup.FirstWebContents.NonEmptyPaint. |
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; | |
gab
2015/03/12 12:44:43
I don't think 5s is enough.
From timelinev2: http
Shrikant Kelkar
2015/03/17 23:32:23
Modified delay to 30s
| |
267 content::BrowserThread::PostDelayedTask( | |
268 content::BrowserThread::IO, | |
gab
2015/03/12 12:44:43
Does this have to be on the IO thread? The IO thre
Shrikant Kelkar
2015/03/17 23:32:23
Most utility processes start on IO thread as after
| |
269 FROM_HERE, | |
270 base::Bind(ExecuteFontCacheBuildTask, path), | |
271 base::TimeDelta::FromSeconds(kBuildFontCacheDelaySec)); | |
255 } | 272 } |
256 } | 273 } |
257 } | 274 } |
258 | 275 |
259 void ChromeBrowserMainPartsWin::PostBrowserStart() { | 276 void ChromeBrowserMainPartsWin::PostBrowserStart() { |
260 ChromeBrowserMainParts::PostBrowserStart(); | 277 ChromeBrowserMainParts::PostBrowserStart(); |
261 | 278 |
262 UMA_HISTOGRAM_BOOLEAN("Windows.Tablet", base::win::IsTabletDevice()); | 279 UMA_HISTOGRAM_BOOLEAN("Windows.Tablet", base::win::IsTabletDevice()); |
263 | 280 |
264 // Set up a task to verify installed modules in the current process. Use a | 281 // 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) | 476 if (resource_id) |
460 return l10n_util::GetStringUTF16(resource_id); | 477 return l10n_util::GetStringUTF16(resource_id); |
461 return base::string16(); | 478 return base::string16(); |
462 } | 479 } |
463 | 480 |
464 // static | 481 // static |
465 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { | 482 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { |
466 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); | 483 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); |
467 installer::SetTranslationDelegate(&delegate); | 484 installer::SetTranslationDelegate(&delegate); |
468 } | 485 } |
OLD | NEW |