Title: [104895] trunk/Source
Revision
104895
Author
[email protected]
Date
2012-01-12 20:44:06 -0800 (Thu, 12 Jan 2012)

Log Message

HwndDC is a better name than OwnGetDC.
https://bugs.webkit.org/show_bug.cgi?id=76235

Reviewed by Dmitry Titov.

Source/_javascript_Core:

This is a better name for two reasons:
1. "Own" implies "delete". In this case, the final call is a release (ReleaseDC).
2. "Ref" would be a better name due to the release but the RefPtr (and OwnPtr)
   classes always take something to hold on to. In this case, the object (the DC)
   is created by the class once it is given a Window to ensure that the HDC
   was actually created using GetDC.

* _javascript_Core.gyp/_javascript_Core.gyp:
* _javascript_Core.gypi:
* wtf/win/HwndDCWin.h: Renamed from Source/_javascript_Core/wtf/win/OwnGetDCWin.h.
(WTF::HwndDC::HwndDC):
(WTF::HwndDC::~HwndDC):
(WTF::HwndDC::operator HDC):

Source/WebKit/chromium:

* src/win/WebScreenInfoFactory.cpp:
(WebKit::WebScreenInfoFactory::screenInfo):

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (104894 => 104895)


--- trunk/Source/_javascript_Core/ChangeLog	2012-01-13 04:35:19 UTC (rev 104894)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-01-13 04:44:06 UTC (rev 104895)
@@ -1,3 +1,24 @@
+2012-01-12  David Levin  <[email protected]>
+
+        HwndDC is a better name than OwnGetDC.
+        https://bugs.webkit.org/show_bug.cgi?id=76235
+
+        Reviewed by Dmitry Titov.
+
+        This is a better name for two reasons:
+        1. "Own" implies "delete". In this case, the final call is a release (ReleaseDC).
+        2. "Ref" would be a better name due to the release but the RefPtr (and OwnPtr)
+           classes always take something to hold on to. In this case, the object (the DC)
+           is created by the class once it is given a Window to ensure that the HDC
+           was actually created using GetDC.
+
+        * _javascript_Core.gyp/_javascript_Core.gyp:
+        * _javascript_Core.gypi:
+        * wtf/win/HwndDCWin.h: Renamed from Source/_javascript_Core/wtf/win/OwnGetDCWin.h.
+        (WTF::HwndDC::HwndDC):
+        (WTF::HwndDC::~HwndDC):
+        (WTF::HwndDC::operator HDC):
+
 2012-01-12  Gavin Barraclough  <[email protected]>
 
         Clean up putDirect (part 1)

Modified: trunk/Source/_javascript_Core/_javascript_Core.gyp/_javascript_Core.gyp (104894 => 104895)


--- trunk/Source/_javascript_Core/_javascript_Core.gyp/_javascript_Core.gyp	2012-01-13 04:35:19 UTC (rev 104894)
+++ trunk/Source/_javascript_Core/_javascript_Core.gyp/_javascript_Core.gyp	2012-01-13 04:44:06 UTC (rev 104895)
@@ -173,7 +173,7 @@
             ['include', 'Thread(ing|Specific)Win\\.cpp$'],
             ['exclude', 'OSAllocatorPosix\\.cpp$'],
             ['include', 'OSAllocatorWin\\.cpp$'],
-            ['include', 'win/OwnGetDCWin\\.h$'],
+            ['include', 'win/HwndDCWin\\.h$'],
           ],
           'include_dirs!': [
             '<(SHARED_INTERMEDIATE_DIR)/webkit',

Modified: trunk/Source/_javascript_Core/_javascript_Core.gypi (104894 => 104895)


--- trunk/Source/_javascript_Core/_javascript_Core.gypi	2012-01-13 04:35:19 UTC (rev 104894)
+++ trunk/Source/_javascript_Core/_javascript_Core.gypi	2012-01-13 04:44:06 UTC (rev 104895)
@@ -648,7 +648,7 @@
             'wtf/unicode/wince/UnicodeWinCE.cpp',
             'wtf/unicode/wince/UnicodeWinCE.h',
             'wtf/win/MainThreadWin.cpp',
-            'wtf/win/OwnGetDCWin.h',
+            'wtf/win/HwndDCWin.h',
             'wtf/win/OwnPtrWin.cpp',
             'wtf/wince/FastMallocWinCE.h',
             'wtf/wince/MemoryManager.cpp',

Copied: trunk/Source/_javascript_Core/wtf/win/HwndDCWin.h (from rev 104894, trunk/Source/_javascript_Core/wtf/win/OwnGetDCWin.h) (0 => 104895)


--- trunk/Source/_javascript_Core/wtf/win/HwndDCWin.h	                        (rev 0)
+++ trunk/Source/_javascript_Core/wtf/win/HwndDCWin.h	2012-01-13 04:44:06 UTC (rev 104895)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <windows.h>
+
+namespace WTF {
+
+class HwndDC {
+public:
+    explicit HwndDC(HWND hwnd)
+        : m_hwnd(hwnd)
+        , m_hdc(::GetDC(hwnd))
+    {
+    }
+
+    ~HwndDC()
+    {
+        if (m_hdc)
+            ::ReleaseDC(m_hwnd, m_hdc);
+    }
+
+    operator HDC()
+    {
+        return m_hdc;
+    }
+
+private:
+    HWND m_hwnd;
+    HDC m_hdc;
+};
+
+}
+
+using WTF::HwndDC;

Deleted: trunk/Source/_javascript_Core/wtf/win/OwnGetDCWin.h (104894 => 104895)


--- trunk/Source/_javascript_Core/wtf/win/OwnGetDCWin.h	2012-01-13 04:35:19 UTC (rev 104894)
+++ trunk/Source/_javascript_Core/wtf/win/OwnGetDCWin.h	2012-01-13 04:44:06 UTC (rev 104895)
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <windows.h>
-
-namespace WTF {
-
-class OwnGetDC {
-public:
-    explicit OwnGetDC(HWND hwnd)
-        : m_hwnd(hwnd)
-        , m_hdc(::GetDC(hwnd))
-    {
-    }
-
-    ~OwnGetDC()
-    {
-        if (m_hdc)
-            ::ReleaseDC(m_hwnd, m_hdc);
-    }
-
-    operator HDC()
-    {
-        return m_hdc;
-    }
-
-private:
-    HWND m_hwnd;
-    HDC m_hdc;
-};
-
-}
-
-using WTF::OwnGetDC;

Modified: trunk/Source/WebKit/chromium/ChangeLog (104894 => 104895)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-01-13 04:35:19 UTC (rev 104894)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-01-13 04:44:06 UTC (rev 104895)
@@ -1,5 +1,15 @@
 2012-01-12  David Levin  <[email protected]>
 
+        HwndDC is a better name than OwnGetDC.
+        https://bugs.webkit.org/show_bug.cgi?id=76235
+
+        Reviewed by Dmitry Titov.
+
+        * src/win/WebScreenInfoFactory.cpp:
+        (WebKit::WebScreenInfoFactory::screenInfo):
+
+2012-01-12  David Levin  <[email protected]>
+
         [chromium] Fix DC leak in WebScreenInfoFactory.
         https://bugs.webkit.org/show_bug.cgi?id=76203
 

Modified: trunk/Source/WebKit/chromium/src/win/WebScreenInfoFactory.cpp (104894 => 104895)


--- trunk/Source/WebKit/chromium/src/win/WebScreenInfoFactory.cpp	2012-01-13 04:35:19 UTC (rev 104894)
+++ trunk/Source/WebKit/chromium/src/win/WebScreenInfoFactory.cpp	2012-01-13 04:44:06 UTC (rev 104895)
@@ -33,7 +33,7 @@
 
 #include "WebScreenInfo.h"
 
-#include <wtf/win/OwnGetDCWin.h>
+#include <wtf/win/HwndDCWin.h>
 
 #include <windows.h>
 
@@ -62,7 +62,7 @@
     devMode.dmDriverExtra = 0;
     EnumDisplaySettings(monitorInfo.szDevice, ENUM_CURRENT_SETTINGS, &devMode);
 
-    OwnGetDC hdc(0);
+    HwndDC hdc(0);
     ASSERT(hdc);
 
     WebScreenInfo results;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to