Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Unified Diff: ui/gfx/font_fallback_win.cc

Issue 2111373002: Reland of Link to DirectWrite directly, instead of calling LoadLibrary (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/BUILD.gn ('k') | ui/gfx/gfx.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/font_fallback_win.cc
diff --git a/ui/gfx/font_fallback_win.cc b/ui/gfx/font_fallback_win.cc
index 4bc023693175f050c17f024530411d484f48010c..66aba3536afe23e52e6b791e4430562d97b185e8 100644
--- a/ui/gfx/font_fallback_win.cc
+++ b/ui/gfx/font_fallback_win.cc
@@ -30,8 +30,6 @@ 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) {
const wchar_t* kFonts =
@@ -357,11 +355,10 @@ bool GetFallbackFont(const Font& font,
DCHECK_GE(wcslen(text), static_cast<size_t>(text_length));
text_length = std::min(wcslen(text), static_cast<size_t>(text_length));
- if (g_factory == nullptr) {
- gfx::win::CreateDWriteFactory(&g_factory);
- }
+ base::win::ScopedComPtr<IDWriteFactory> factory;
+ gfx::win::CreateDWriteFactory(factory.Receive());
base::win::ScopedComPtr<IDWriteFactory2> factory2;
- g_factory->QueryInterface(factory2.Receive());
+ factory.QueryInterface(factory2.Receive());
if (!factory2) {
// IDWriteFactory2 is not available before Win8.1
return GetUniscribeFallbackFont(font, text, text_length, result);
« no previous file with comments | « ui/gfx/BUILD.gn ('k') | ui/gfx/gfx.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698