Changeset 155476 in webkit
- Timestamp:
- Sep 10, 2013, 2:40:21 PM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 1 added
- 2 deleted
- 15 edited
-
WTF/ChangeLog (modified) (1 diff)
-
WTF/WTF.vcxproj/WTF.vcxproj (modified) (1 diff)
-
WTF/WTF.vcxproj/WTF.vcxproj.filters (modified) (1 diff)
-
WTF/wtf/OwnPtrCommon.h (modified) (3 diffs)
-
WTF/wtf/win/GDIObject.h (modified) (1 diff)
-
WTF/wtf/win/OwnPtrWin.cpp (deleted)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/WebCore.vcxproj/WebCore.vcxproj (modified) (2 diffs)
-
WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (modified) (3 diffs)
-
WebCore/platform/graphics/FontPlatformData.h (modified) (3 diffs)
-
WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp (modified) (2 diffs)
-
WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp (modified) (1 diff)
-
WebCore/platform/graphics/win/FontPlatformDataWin.cpp (modified) (1 diff)
-
WebCore/platform/graphics/win/RefCountedGDIHandle.h (deleted)
-
WebCore/platform/graphics/win/SharedGDIObject.h (added)
-
WebKit/win/ChangeLog (modified) (1 diff)
-
WebKit/win/WebView.cpp (modified) (11 diffs)
-
WebKit/win/WebView.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r155474 r155476 1 2013-09-10 Brent Fulgham <bfulgham@apple.com> 2 3 [Windows] Create SharedGDIObject Class Template 4 https://bugs.webkit.org/show_bug.cgi?id=121037 5 6 Reviewed by Anders Carlsson. 7 8 Now that the SharedGDIObject class exists we can get rid of 9 the Windows-specific code in OwnPtr. 10 11 * WTF.vcxproj/WTF.vcxproj: Remove OwnPtrWin.cpp. 12 * WTF.vcxproj/WTF.vcxproj.filters: Ditto. 13 * wtf/OwnPtrCommon.h: 14 (WTF::deleteOwnedPtr): Remove Windows declarations that 15 are no longer needed. 16 * wtf/win/GDIObject.h: 17 (WTF::GDIObject::get): Change to 'const' to match 18 signature (and use cases) elsewhere in the code base for 19 our smart pointer classes. 20 * wtf/win/OwnPtrWin.cpp: Removed. 21 1 22 2013-09-10 Anders Carlsson <andersca@apple.com> 2 23 -
trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj
r155454 r155476 113 113 <ClCompile Include="..\wtf\unicode\UTF8.cpp" /> 114 114 <ClCompile Include="..\wtf\win\MainThreadWin.cpp" /> 115 <ClCompile Include="..\wtf\win\OwnPtrWin.cpp" />116 115 <ClCompile Include="..\wtf\WTFThreadData.cpp" /> 117 116 <ClCompile Include="..\wtf\SchedulePairCF.cpp" /> -
trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters
r155454 r155476 77 77 </ClCompile> 78 78 <ClCompile Include="..\wtf\win\MainThreadWin.cpp"> 79 <Filter>win</Filter>80 </ClCompile>81 <ClCompile Include="..\wtf\win\OwnPtrWin.cpp">82 79 <Filter>win</Filter> 83 80 </ClCompile> -
trunk/Source/WTF/wtf/OwnPtrCommon.h
r155454 r155476 1 1 /* 2 * Copyright (C) 2009 Apple Inc. All rights reserved.2 * Copyright (C) 2009, 2013 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2009 Torch Mobile, Inc. 4 4 * Copyright (C) 2010 Company 100 Inc. … … 29 29 #define WTF_OwnPtrCommon_h 30 30 31 #if OS(WINDOWS)32 typedef struct HBITMAP__* HBITMAP;33 typedef struct HDC__* HDC;34 typedef struct HRGN__* HRGN;35 #endif36 37 31 #if PLATFORM(EFL) 38 32 typedef struct _Ecore_Evas Ecore_Evas; … … 60 54 } 61 55 62 #if OS(WINDOWS)63 WTF_EXPORT_PRIVATE void deleteOwnedPtr(HBITMAP);64 WTF_EXPORT_PRIVATE void deleteOwnedPtr(HDC);65 WTF_EXPORT_PRIVATE void deleteOwnedPtr(HRGN);66 #endif67 68 56 #if PLATFORM(EFL) 69 57 WTF_EXPORT_PRIVATE void deleteOwnedPtr(Ecore_Evas*); -
trunk/Source/WTF/wtf/win/GDIObject.h
r155454 r155476 43 43 ~GDIObject() { deleteObject<T>(m_object); } 44 44 45 T get() { return m_object; }45 T get() const { return m_object; } 46 46 47 47 void clear(); -
trunk/Source/WebCore/ChangeLog
r155468 r155476 1 2013-09-10 Brent Fulgham <bfulgham@apple.com> 2 3 [Windows] Create SharedGDIObject Class Template 4 https://bugs.webkit.org/show_bug.cgi?id=121037 5 6 Reviewed by Anders Carlsson. 7 8 * WebCore.vcxproj/WebCore.vcxproj: Remove RefCountedGDIHandle.h, and 9 add new SharedGDIObject.h file. 10 * WebCore.vcxproj/WebCore.vcxproj.filters: Ditto. 11 * platform/graphics/FontPlatformData.h: 12 (WebCore::FontPlatformData::hfont): Switch to new SharedGDIObject. 13 * platform/graphics/win/FontPlatformDataCGWin.cpp: 14 (WebCore::FontPlatformData::FontPlatformData): Ditto. 15 * platform/graphics/win/FontPlatformDataCairoWin.cpp: 16 (WebCore::FontPlatformData::FontPlatformData): Ditto. 17 * platform/graphics/win/FontPlatformDataWin.cpp: 18 (WebCore::FontPlatformData::FontPlatformData): Ditto. 19 * platform/graphics/win/RefCountedGDIHandle.h: Removed. 20 * platform/graphics/win/SharedGDIObject.h: Added. 21 (WebCore::SharedGDIObject::create): 22 (WebCore::SharedGDIObject::get): 23 (WebCore::SharedGDIObject::hash): 24 (WebCore::SharedGDIObject::SharedGDIObject): 25 1 26 2013-09-10 Tim Horton <timothy_horton@apple.com> 2 27 -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
r155454 r155476 19300 19300 <ClInclude Include="..\platform\graphics\opengl\GLPlatformSurface.h" /> 19301 19301 <ClInclude Include="..\platform\graphics\VideoTrackPrivate.h" /> 19302 <ClInclude Include="..\platform\graphics\win\SharedGDIObject.h" /> 19302 19303 <ClInclude Include="..\platform\HistogramSupport.h" /> 19303 19304 <ClInclude Include="..\platform\HostWindow.h" /> … … 19468 19469 <ClInclude Include="..\platform\graphics\opentype\OpenTypeUtilities.h" /> 19469 19470 <ClInclude Include="..\platform\graphics\opentype\OpenTypeVerticalData.h" /> 19470 <ClInclude Include="..\platform\graphics\win\RefCountedGDIHandle.h" />19471 19471 <ClInclude Include="..\platform\graphics\win\UniscribeController.h" /> 19472 19472 <CustomBuildStep Include="..\platform\graphics\win\WKCAImageQueue.h"> -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
r155454 r155476 7098 7098 <Filter>platform\win</Filter> 7099 7099 </ClCompile> 7100 <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSBeforeUnloadEvent.cpp" /> 7101 <ClCompile Include="..\rendering\FloatingObjects.cpp" /> 7100 7102 </ItemGroup> 7101 7103 <ItemGroup> … … 8582 8584 <Filter>platform\graphics\win</Filter> 8583 8585 </ClInclude> 8584 <ClInclude Include="..\platform\graphics\win\RefCountedGDIHandle.h">8585 <Filter>platform\graphics\win</Filter>8586 </ClInclude>8587 8586 <ClInclude Include="..\platform\graphics\win\UniscribeController.h"> 8588 8587 <Filter>platform\graphics\win</Filter> … … 14898 14897 <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\HTMLElementTypeHelpers.h" /> 14899 14898 <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\SVGElementTypeHelpers.h" /> 14899 <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSBeforeUnloadEvent.h" /> 14900 <ClInclude Include="..\rendering\FloatingObjects.h" /> 14901 <ClInclude Include="..\platform\graphics\win\SharedGDIObject.h"> 14902 <Filter>platform\graphics\win</Filter> 14903 </ClInclude> 14900 14904 </ItemGroup> 14901 14905 <ItemGroup> -
trunk/Source/WebCore/platform/graphics/FontPlatformData.h
r155454 r155476 41 41 42 42 #if PLATFORM(WIN) 43 #include " RefCountedGDIHandle.h"43 #include "SharedGDIObject.h" 44 44 #endif 45 45 … … 113 113 114 114 #if PLATFORM(WIN) 115 HFONT hfont() const { return m_font ? m_font-> handle() : 0; }115 HFONT hfont() const { return m_font ? m_font->get() : 0; } 116 116 bool useGDI() const { return m_useGDI; } 117 117 #elif OS(DARWIN) … … 229 229 NSFont* m_font; 230 230 #elif PLATFORM(WIN) 231 RefPtr< RefCountedGDIHandle<HFONT>> m_font;231 RefPtr<SharedGDIObject<HFONT>> m_font; 232 232 #endif 233 233 -
trunk/Source/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp
r149716 r155476 25 25 #include "FontPlatformData.h" 26 26 27 #include "SharedGDIObject.h" 27 28 #include <ApplicationServices/ApplicationServices.h> 28 29 #include <WebKitSystemInterface/WebKitSystemInterface.h> … … 121 122 , m_size(size) 122 123 , m_widthVariant(RegularWidth) 123 , m_font( RefCountedGDIHandle<HFONT>::create(hfont))124 , m_font(SharedGDIObject<HFONT>::create(adoptGDIObject<HFONT>(hfont))) 124 125 , m_cgFont(font) 125 126 , m_isColorBitmapFont(false) -
trunk/Source/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp
r151743 r155476 58 58 59 59 FontPlatformData::FontPlatformData(HFONT font, cairo_font_face_t* fontFace, float size, bool bold, bool oblique) 60 : m_font( RefCountedGDIHandle<HFONT>::create(font))60 : m_font(SharedGDIObject<HFONT>::create(adoptGDIObject<HFONT>(font))) 61 61 , m_size(size) 62 62 , m_orientation(Horizontal) -
trunk/Source/WebCore/platform/graphics/win/FontPlatformDataWin.cpp
r136520 r155476 39 39 40 40 FontPlatformData::FontPlatformData(HFONT font, float size, bool bold, bool oblique, bool useGDI) 41 : m_font( RefCountedGDIHandle<HFONT>::create(font))41 : m_font(SharedGDIObject<HFONT>::create(adoptGDIObject<HFONT>(font))) 42 42 , m_size(size) 43 43 , m_orientation(Horizontal) -
trunk/Source/WebKit/win/ChangeLog
r155454 r155476 1 2013-09-10 Brent Fulgham <bfulgham@apple.com> 2 3 [Windows] Create SharedGDIObject Class Template 4 https://bugs.webkit.org/show_bug.cgi?id=121037 5 6 Reviewed by Anders Carlsson. 7 8 * WebView.cpp: Change implementations to use the new SharedGDIObject 9 class. 10 (WebView::addToDirtyRegion): 11 (WebView::scrollBackingStore): 12 (WebView::updateBackingStore): 13 (WebView::performLayeredWindowUpdate): 14 (WebView::paint): 15 (WebView::backingStore): 16 * WebView.h: Ditto. 17 1 18 2013-09-09 Brent Fulgham <bfulgham@apple.com> 2 19 -
trunk/Source/WebKit/win/WebView.cpp
r155454 r155476 824 824 825 825 void* pixels = NULL; 826 m_backingStoreBitmap = RefCountedHBITMAP::create(::CreateDIBSection(0, &bitmapInfo, DIB_RGB_COLORS, &pixels, 0, 0));826 m_backingStoreBitmap = SharedGDIObject<HBITMAP>::create(adoptGDIObject(::CreateDIBSection(0, &bitmapInfo, DIB_RGB_COLORS, &pixels, 0, 0))); 827 827 return true; 828 828 } … … 844 844 #endif 845 845 846 HRGN newRegion =::CreateRectRgn(dirtyRect.x(), dirtyRect.y(),847 dirtyRect.maxX(), dirtyRect.maxY());848 addToDirtyRegion( newRegion);849 } 850 851 void WebView::addToDirtyRegion( HRGNnewRegion)846 auto newRegion = adoptGDIObject(::CreateRectRgn(dirtyRect.x(), dirtyRect.y(), 847 dirtyRect.maxX(), dirtyRect.maxY())); 848 addToDirtyRegion(std::move(newRegion)); 849 } 850 851 void WebView::addToDirtyRegion(GDIObject<HRGN> newRegion) 852 852 { 853 853 #if USE(ACCELERATED_COMPOSITING) … … 858 858 859 859 if (m_backingStoreDirtyRegion) { 860 HRGN combinedRegion = ::CreateRectRgn(0,0,0,0); 861 ::CombineRgn(combinedRegion, m_backingStoreDirtyRegion->handle(), newRegion, RGN_OR); 862 ::DeleteObject(newRegion); 863 m_backingStoreDirtyRegion = RefCountedHRGN::create(combinedRegion); 860 auto combinedRegion = adoptGDIObject(::CreateRectRgn(0, 0, 0, 0)); 861 ::CombineRgn(combinedRegion.get(), m_backingStoreDirtyRegion->get(), newRegion.get(), RGN_OR); 862 m_backingStoreDirtyRegion = SharedGDIObject<HRGN>::create(std::move(combinedRegion)); 864 863 } else 865 m_backingStoreDirtyRegion = RefCountedHRGN::create(newRegion);864 m_backingStoreDirtyRegion = SharedGDIObject<HRGN>::create(std::move(newRegion)); 866 865 867 866 if (m_uiDelegatePrivate) … … 891 890 892 891 // Make a region to hold the invalidated scroll area. 893 HRGN updateRegion = ::CreateRectRgn(0, 0, 0, 0);892 auto updateRegion = adoptGDIObject(::CreateRectRgn(0, 0, 0, 0)); 894 893 895 894 // Collect our device context info and select the bitmap to scroll. 896 895 HWndDC windowDC(m_viewWindow); 897 896 auto bitmapDC = adoptGDIObject(::CreateCompatibleDC(windowDC)); 898 HGDIOBJ oldBitmap = ::SelectObject(bitmapDC.get(), m_backingStoreBitmap-> handle());897 HGDIOBJ oldBitmap = ::SelectObject(bitmapDC.get(), m_backingStoreBitmap->get()); 899 898 900 899 // Scroll the bitmap. 901 900 RECT scrollRectWin(scrollViewRect); 902 901 RECT clipRectWin(clipRect); 903 ::ScrollDC(bitmapDC.get(), dx, dy, &scrollRectWin, &clipRectWin, updateRegion , 0);902 ::ScrollDC(bitmapDC.get(), dx, dy, &scrollRectWin, &clipRectWin, updateRegion.get(), 0); 904 903 RECT regionBox; 905 ::GetRgnBox(updateRegion , ®ionBox);904 ::GetRgnBox(updateRegion.get(), ®ionBox); 906 905 907 906 // Flush. … … 909 908 910 909 // Add the dirty region to the backing store's dirty region. 911 addToDirtyRegion( updateRegion);910 addToDirtyRegion(std::move(updateRegion)); 912 911 913 912 if (m_uiDelegatePrivate) … … 996 995 bitmapDCObject = adoptGDIObject(::CreateCompatibleDC(windowDC)); 997 996 bitmapDC = bitmapDCObject.get(); 998 oldBitmap = ::SelectObject(bitmapDC, m_backingStoreBitmap-> handle());997 oldBitmap = ::SelectObject(bitmapDC, m_backingStoreBitmap->get()); 999 998 } 1000 999 … … 1008 1007 if (!backingStoreCompletelyDirty && m_backingStoreDirtyRegion) { 1009 1008 RECT regionBox; 1010 ::GetRgnBox(m_backingStoreDirtyRegion-> handle(), ®ionBox);1011 getUpdateRects(m_backingStoreDirtyRegion-> handle(), regionBox, paintRects);1009 ::GetRgnBox(m_backingStoreDirtyRegion->get(), ®ionBox); 1010 getUpdateRects(m_backingStoreDirtyRegion->get(), regionBox, paintRects); 1012 1011 } else { 1013 1012 RECT clientRect; … … 1039 1038 HWndDC hdcScreen(m_viewWindow); 1040 1039 auto hdcMem = adoptGDIObject(::CreateCompatibleDC(hdcScreen)); 1041 HBITMAP hbmOld = static_cast<HBITMAP>(::SelectObject(hdcMem.get(), m_backingStoreBitmap-> handle()));1040 HBITMAP hbmOld = static_cast<HBITMAP>(::SelectObject(hdcMem.get(), m_backingStoreBitmap->get())); 1042 1041 1043 1042 BITMAP bmpInfo; 1044 ::GetObject(m_backingStoreBitmap-> handle(), sizeof(bmpInfo), &bmpInfo);1043 ::GetObject(m_backingStoreBitmap->get(), sizeof(bmpInfo), &bmpInfo); 1045 1044 SIZE windowSize = { bmpInfo.bmWidth, bmpInfo.bmHeight }; 1046 1045 … … 1081 1080 RECT rcPaint; 1082 1081 HDC hdc; 1083 OwnPtr<HRGN> region;1082 GDIObject<HRGN> region; 1084 1083 int regionType = NULLREGION; 1085 1084 PAINTSTRUCT ps; 1086 1085 WindowsToPaint windowsToPaint; 1087 1086 if (!dc) { 1088 region = adopt Ptr(CreateRectRgn(0,0,0,0));1087 region = adoptGDIObject(::CreateRectRgn(0, 0, 0, 0)); 1089 1088 regionType = GetUpdateRgn(m_viewWindow, region.get(), false); 1090 1089 hdc = BeginPaint(m_viewWindow, &ps); … … 1113 1112 1114 1113 auto bitmapDC = adoptGDIObject(::CreateCompatibleDC(hdc)); 1115 HGDIOBJ oldBitmap = ::SelectObject(bitmapDC.get(), m_backingStoreBitmap-> handle());1114 HGDIOBJ oldBitmap = ::SelectObject(bitmapDC.get(), m_backingStoreBitmap->get()); 1116 1115 1117 1116 // Update our backing store if needed. … … 5981 5980 if (!m_backingStoreBitmap) 5982 5981 return E_FAIL; 5983 *hBitmap = reinterpret_cast<OLE_HANDLE>(m_backingStoreBitmap-> handle());5982 *hBitmap = reinterpret_cast<OLE_HANDLE>(m_backingStoreBitmap->get()); 5984 5983 return S_OK; 5985 5984 } -
trunk/Source/WebKit/win/WebView.h
r154759 r155476 35 35 #include <WebCore/DragActions.h> 36 36 #include <WebCore/IntRect.h> 37 #include <WebCore/ RefCountedGDIHandle.h>37 #include <WebCore/SharedGDIObject.h> 38 38 #include <WebCore/SuspendableTimer.h> 39 39 #include <WebCore/WindowMessageListener.h> … … 70 70 class WebInspector; 71 71 class WebInspectorClient; 72 73 typedef WebCore::RefCountedGDIHandle<HBITMAP> RefCountedHBITMAP;74 typedef WebCore::RefCountedGDIHandle<HRGN> RefCountedHRGN;75 72 76 73 WebView* kit(WebCore::Page*); … … 881 878 bool ensureBackingStore(); 882 879 void addToDirtyRegion(const WebCore::IntRect&); 883 void addToDirtyRegion( HRGN);880 void addToDirtyRegion(GDIObject<HRGN>); 884 881 void scrollBackingStore(WebCore::FrameView*, int dx, int dy, const WebCore::IntRect& scrollViewRect, const WebCore::IntRect& clipRect); 885 882 void deleteBackingStore(); … … 1087 1084 #endif // ENABLE(INSPECTOR) 1088 1085 1089 RefPtr< RefCountedHBITMAP> m_backingStoreBitmap;1086 RefPtr<WebCore::SharedGDIObject<HBITMAP>> m_backingStoreBitmap; 1090 1087 SIZE m_backingStoreSize; 1091 RefPtr< RefCountedHRGN> m_backingStoreDirtyRegion;1088 RefPtr<WebCore::SharedGDIObject<HRGN>> m_backingStoreDirtyRegion; 1092 1089 1093 1090 COMPtr<IAccessibilityDelegate> m_accessibilityDelegate;
Note:
See TracChangeset
for help on using the changeset viewer.