These usages are where I changed (usually buggy) functionality. Usually these were leaks. In one case, I reduced the lifetime of a dc because it allowed for simpler code (when using an RAII class like HWndDC). In another case, the code was using OwnPtr<HDC> when it should not have been so the HDC was getting deleted when it should have been released.
Created attachment 123402 [details] Patch
Attachment 123402 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1 Source/WebKit/win/WebNodeHighlight.cpp:138: Use OwnPtr<HDC> when calling CreateCompatibleDC to avoid potential memory leaks. [runtime/leaky_pattern] [5] Source/WebKit/win/FullscreenVideoController.cpp:489: Use OwnPtr<HDC> when calling CreateCompatibleDC to avoid potential memory leaks. [runtime/leaky_pattern] [5] Source/WebKit2/Shared/win/ShareableBitmapWin.cpp:46: Use OwnPtr<HDC> when calling CreateCompatibleDC to avoid potential memory leaks. [runtime/leaky_pattern] [5] Source/WebKit/chromium/ChangeLog:3: ChangeLog entry has no bug number [changelog/bugnumber] [5] Total errors found: 4 in 31 files If any of these errors are false positives, please file a bug against check-webkit-style.
(In reply to comment #2) > Attachment 123402 [details] did not pass style-queue: > > Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1 > > Source/WebKit/win/WebNodeHighlight.cpp:138: Use OwnPtr<HDC> when calling CreateCompatibleDC to avoid potential memory leaks. [runtime/leaky_pattern] [5] > Source/WebKit/win/FullscreenVideoController.cpp:489: Use OwnPtr<HDC> when calling CreateCompatibleDC to avoid potential memory leaks. [runtime/leaky_pattern] [5] > Source/WebKit2/Shared/win/ShareableBitmapWin.cpp:46: Use OwnPtr<HDC> when calling CreateCompatibleDC to avoid potential memory leaks. [runtime/leaky_pattern] [5] > Source/WebKit/chromium/ChangeLog:3: ChangeLog entry has no bug number [changelog/bugnumber] [5] > Total errors found: 4 in 31 files > > > If any of these errors are false positives, please file a bug against check-webkit-style. Filed: https://bugs.webkit.org/show_bug.cgi?id=76752
Comment on attachment 123402 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=123402&action=review > Source/WebKit/win/FullscreenVideoController.cpp:494 > - HDC windowDC = GetDC(m_hudWindow); > - HDC bitmapDC = CreateCompatibleDC(windowDC); > - ::ReleaseDC(m_hudWindow, windowDC); > - HGDIOBJ oldBitmap = SelectObject(bitmapDC, m_bitmap.get()); > + OwnPtr<HDC> bitmapDC = createCompatibleDCForWindow(m_hudWindow); I don't think the separate function is needed. You can just do: OwnPtr<HDC> bitmapDC = CreateCompatibleDC(HwndDC(m_hudWindow));
Committed as http://trac.webkit.org/changeset/105667 (In reply to comment #4) > (From update of attachment 123402 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=123402&action=review > > + OwnPtr<HDC> bitmapDC = createCompatibleDCForWindow(m_hudWindow); > > I don't think the separate function is needed. You can just do: OwnPtr<HDC> bitmapDC = CreateCompatibleDC(HwndDC(m_hudWindow)); Done.