Revise various Windows create functions to use GDIObject smart pointer.
1. Change FontPlatformData to take a GDIObject<HFONT> and use std::move. 2. 'createGDIFont' should return a GDIObject<HFONT> - as should any other create functions we have that return GDI objects.
<rdar://problem/14958562>
Created attachment 211341 [details] Patch
Comment on attachment 211341 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=211341&action=review > Source/WebCore/platform/graphics/win/FontCacheWin.cpp:491 > + return GDIObject<HFONT>(); If you add a GDIObject constructor that takes std::nullptr_t you can just return nullptr here. > Source/WebCore/platform/graphics/win/FontPlatformDataWin.cpp:58 > + ::SelectObject(hdc, m_font.get()->get()); I think SharedGDIObject’s get function should just return T, then this would just be m_font.get(). > Source/WebCore/platform/graphics/win/FontPlatformDataWin.cpp:69 > + platformDataInit(m_font.get()->get(), size, hdc, faceName); Same thing here.
Comment on attachment 211341 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=211341&action=review >> Source/WebCore/platform/graphics/win/FontCacheWin.cpp:491 >> + return GDIObject<HFONT>(); > > If you add a GDIObject constructor that takes std::nullptr_t you can just return nullptr here. Great! I'll do that. >> Source/WebCore/platform/graphics/win/FontPlatformDataWin.cpp:58 >> + ::SelectObject(hdc, m_font.get()->get()); > > I think SharedGDIObject’s get function should just return T, then this would just be m_font.get(). m_font is a RefPtr; SharedGDIObject.get() already returns T. I should have written this as ::SelectObject(hdc, m_font->get()); >> Source/WebCore/platform/graphics/win/FontPlatformDataWin.cpp:69 >> + platformDataInit(m_font.get()->get(), size, hdc, faceName); > > Same thing here. OK!
Committed r155557: <http://trac.webkit.org/changeset/155557>