Reland attempt to fix a DirectWrite metrics retrieval browser crasher in Canary.
commitf811086bb585e878f4e672a3c943ddb7806db53b
authordcheng <dcheng@chromium.org>
Tue, 25 Nov 2014 05:37:30 +0000 (24 21:37 -0800)
committerCommit bot <commit-bot@chromium.org>
Tue, 25 Nov 2014 05:38:15 +0000 (25 05:38 +0000)
treea5a37da4b75928fd1cccaae4b91ccd3ae949ba06
parentae9169e81c6eb067f1cc9a013e59cec732a3d307
Reland attempt to fix a DirectWrite metrics retrieval browser crasher in Canary.

The crash occurs because the IDWriteFactory::GetSystemFontCollection method returns E_INVALIDARG. From some analysis of
the crash dumps it appears that the crashes are mostly coming from Windows 7 version 6.1.7600.* and dwrite version 6.1.7600.16972.
We tried the same version of dwrite locally in a VM where things work correctly though.

In any case the fix attempted here is to check the return from the SkFontMgr_New_DirectWrite call. If we get back a NULL factory then
it probably means that the skia factory init failed. There is code in the SkFontMgr_New_DirectWrite function to get the system font collection.
If that call fails the function returns NULL. We should not attempt to use DW in that case.

The other change is to use a ScopedComPtr for the IDWriteFactory interface in the MaybeEnableDirectWriteFontRendering function.

Will see how this plays in tomorrows canary.

BUG=436146
TBR=cpu@chromium.org

Review URL: https://codereview.chromium.org/752353002

Cr-Commit-Position: refs/heads/master@{#305586}
content/browser/browser_main_runner.cc