Index: ui/gfx/font_fallback_win.cc |
diff --git a/ui/gfx/font_fallback_win.cc b/ui/gfx/font_fallback_win.cc |
index 02afed5006bc5babb3783183f8dc3e62e1d4a5f1..e3e89dffee6326e5d1d1260acb7e9a317195ac9d 100644 |
--- a/ui/gfx/font_fallback_win.cc |
+++ b/ui/gfx/font_fallback_win.cc |
@@ -28,6 +28,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) { |
@@ -348,10 +350,11 @@ |
// renderer should instead use the font proxy. |
DCHECK(base::MessageLoopForUI::IsCurrent()); |
- 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); |