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

Unified Diff: ui/gfx/win/direct_write.cc

Issue 2127313002: Revert of Link to DirectWrite directly, instead of calling LoadLibrary (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/gfx_tests.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/win/direct_write.cc
diff --git a/ui/gfx/win/direct_write.cc b/ui/gfx/win/direct_write.cc
index bf30f64cc30a7bb990224ba145c282f3cd3f85b0..90fd728d6beef8ef885b4472a5b0268aecb8e06b 100644
--- a/ui/gfx/win/direct_write.cc
+++ b/ui/gfx/win/direct_write.cc
@@ -18,13 +18,23 @@
namespace win {
void CreateDWriteFactory(IDWriteFactory** factory) {
+ using DWriteCreateFactoryProc = decltype(DWriteCreateFactory)*;
+ HMODULE dwrite_dll = LoadLibraryW(L"dwrite.dll");
+ if (!dwrite_dll)
+ return;
+
+ DWriteCreateFactoryProc dwrite_create_factory_proc =
+ reinterpret_cast<DWriteCreateFactoryProc>(
+ GetProcAddress(dwrite_dll, "DWriteCreateFactory"));
+ // Not finding the DWriteCreateFactory function indicates a corrupt dll.
+ if (!dwrite_create_factory_proc)
+ return;
+
+ // Failure to create the DirectWrite factory indicates a corrupt dll.
base::win::ScopedComPtr<IUnknown> factory_unknown;
- HRESULT hr =
- DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory),
- factory_unknown.Receive());
- if (FAILED(hr)) {
- base::debug::Alias(&hr);
- CHECK(false);
+ if (FAILED(dwrite_create_factory_proc(DWRITE_FACTORY_TYPE_SHARED,
+ __uuidof(IDWriteFactory),
+ factory_unknown.Receive()))) {
return;
}
factory_unknown.QueryInterface<IDWriteFactory>(factory);
« no previous file with comments | « ui/gfx/gfx_tests.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698