| Index: ui/gfx/font_fallback_win.cc
|
| diff --git a/ui/gfx/font_fallback_win.cc b/ui/gfx/font_fallback_win.cc
|
| index 66aba3536afe23e52e6b791e4430562d97b185e8..4bc023693175f050c17f024530411d484f48010c 100644
|
| --- a/ui/gfx/font_fallback_win.cc
|
| +++ b/ui/gfx/font_fallback_win.cc
|
| @@ -29,6 +29,8 @@
|
| namespace gfx {
|
|
|
| namespace {
|
| +
|
| +IDWriteFactory* g_factory = nullptr;
|
|
|
| // Queries the registry to get a mapping from font filenames to font names.
|
| void QueryFontsFromRegistry(std::map<std::string, std::string>* map) {
|
| @@ -355,10 +357,11 @@
|
| DCHECK_GE(wcslen(text), static_cast<size_t>(text_length));
|
| text_length = std::min(wcslen(text), static_cast<size_t>(text_length));
|
|
|
| - base::win::ScopedComPtr<IDWriteFactory> factory;
|
| - gfx::win::CreateDWriteFactory(factory.Receive());
|
| + if (g_factory == nullptr) {
|
| + gfx::win::CreateDWriteFactory(&g_factory);
|
| + }
|
| base::win::ScopedComPtr<IDWriteFactory2> factory2;
|
| - factory.QueryInterface(factory2.Receive());
|
| + g_factory->QueryInterface(factory2.Receive());
|
| if (!factory2) {
|
| // IDWriteFactory2 is not available before Win8.1
|
| return GetUniscribeFallbackFont(font, text, text_length, result);
|
|
|