| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/renderer/renderer_font_platform_win.h" | 5 #include "content/renderer/renderer_font_platform_win.h" |
| 6 | 6 |
| 7 #include <dwrite.h> | 7 #include <dwrite.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 #include <wrl/implements.h> | 10 #include <wrl/implements.h> |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 IDWriteFontCollection* GetCustomFontCollection(IDWriteFactory* factory) { | 343 IDWriteFontCollection* GetCustomFontCollection(IDWriteFactory* factory) { |
| 344 if (g_font_collection.Get() != NULL) | 344 if (g_font_collection.Get() != NULL) |
| 345 return g_font_collection.Get(); | 345 return g_font_collection.Get(); |
| 346 | 346 |
| 347 base::TimeTicks start_tick = base::TimeTicks::Now(); | 347 base::TimeTicks start_tick = base::TimeTicks::Now(); |
| 348 | 348 |
| 349 FontCollectionLoader::Initialize(factory); | 349 FontCollectionLoader::Initialize(factory); |
| 350 | 350 |
| 351 // We try here to put arbitrary limit on max number of fonts that could | 351 // We try here to put arbitrary limit on max number of fonts that could |
| 352 // be loaded, otherwise we fallback to restricted set of fonts. | 352 // be loaded, otherwise we fallback to restricted set of fonts. |
| 353 const UINT32 kMaxFontThreshold = 1000; | 353 const UINT32 kMaxFontThreshold = 1750; |
| 354 HRESULT hr = E_FAIL; | 354 HRESULT hr = E_FAIL; |
| 355 if (g_font_loader->GetFontMapSize() < kMaxFontThreshold) { | 355 if (g_font_loader->GetFontMapSize() < kMaxFontThreshold) { |
| 356 hr = factory->CreateCustomFontCollection( | 356 hr = factory->CreateCustomFontCollection( |
| 357 g_font_loader.Get(), NULL, 0, g_font_collection.GetAddressOf()); | 357 g_font_loader.Get(), NULL, 0, g_font_collection.GetAddressOf()); |
| 358 } | 358 } |
| 359 | 359 |
| 360 bool loadingRestricted = false; | 360 bool loadingRestricted = false; |
| 361 if (FAILED(hr) || !g_font_collection.Get()) { | 361 if (FAILED(hr) || !g_font_collection.Get()) { |
| 362 // We will try here just one more time with restricted font set. | 362 // We will try here just one more time with restricted font set. |
| 363 g_font_loader->LoadRestrictedFontList(); | 363 g_font_loader->LoadRestrictedFontList(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 376 CHECK(g_font_collection.Get() != NULL); | 376 CHECK(g_font_collection.Get() != NULL); |
| 377 | 377 |
| 378 UMA_HISTOGRAM_TIMES("DirectWrite.Fonts.LoadTime", time_delta); | 378 UMA_HISTOGRAM_TIMES("DirectWrite.Fonts.LoadTime", time_delta); |
| 379 | 379 |
| 380 base::debug::ClearCrashKey(kFontKeyName); | 380 base::debug::ClearCrashKey(kFontKeyName); |
| 381 | 381 |
| 382 return g_font_collection.Get(); | 382 return g_font_collection.Get(); |
| 383 } | 383 } |
| 384 | 384 |
| 385 } // namespace content | 385 } // namespace content |
| OLD | NEW |