Title: [209584] trunk/Source/WebCore
Revision
209584
Author
[email protected]
Date
2016-12-08 17:21:07 -0800 (Thu, 08 Dec 2016)

Log Message

Reduce PassRefPtr use in platform/graphics
https://bugs.webkit.org/show_bug.cgi?id=165636

Reviewed by Dean Jackson.

No change in behavior.

* platform/graphics/GraphicsContext3D.h:
* platform/graphics/mac/DisplayRefreshMonitorMac.h:
(WebCore::DisplayRefreshMonitorMac::create):
* platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
(WebCore::GraphicsContext3D::createForCurrentGLContext):
(WebCore::GraphicsContext3D::paintRenderingResultsToImageData):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (209583 => 209584)


--- trunk/Source/WebCore/ChangeLog	2016-12-09 00:56:48 UTC (rev 209583)
+++ trunk/Source/WebCore/ChangeLog	2016-12-09 01:21:07 UTC (rev 209584)
@@ -1,3 +1,19 @@
+2016-12-08  Alex Christensen  <[email protected]>
+
+        Reduce PassRefPtr use in platform/graphics
+        https://bugs.webkit.org/show_bug.cgi?id=165636
+
+        Reviewed by Dean Jackson.
+
+        No change in behavior.
+
+        * platform/graphics/GraphicsContext3D.h:
+        * platform/graphics/mac/DisplayRefreshMonitorMac.h:
+        (WebCore::DisplayRefreshMonitorMac::create):
+        * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
+        (WebCore::GraphicsContext3D::createForCurrentGLContext):
+        (WebCore::GraphicsContext3D::paintRenderingResultsToImageData):
+
 2016-12-08  Keith Rollin  <[email protected]>
 
         Move FileHandle to WebCore FileHandle.h

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h (209583 => 209584)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h	2016-12-09 00:56:48 UTC (rev 209583)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h	2016-12-09 01:21:07 UTC (rev 209584)
@@ -740,7 +740,7 @@
     void setErrorMessageCallback(std::unique_ptr<ErrorMessageCallback>);
 
     static RefPtr<GraphicsContext3D> create(GraphicsContext3DAttributes, HostWindow*, RenderStyle = RenderOffscreen);
-    static PassRefPtr<GraphicsContext3D> createForCurrentGLContext();
+    static RefPtr<GraphicsContext3D> createForCurrentGLContext();
     ~GraphicsContext3D();
 
 #if PLATFORM(COCOA)
@@ -1131,7 +1131,7 @@
     void recycleContext();
 
     void paintRenderingResultsToCanvas(ImageBuffer*);
-    PassRefPtr<ImageData> paintRenderingResultsToImageData();
+    RefPtr<ImageData> paintRenderingResultsToImageData();
     bool paintCompositedResultsToCanvas(ImageBuffer*);
 
 #if PLATFORM(IOS)

Modified: trunk/Source/WebCore/platform/graphics/mac/DisplayRefreshMonitorMac.h (209583 => 209584)


--- trunk/Source/WebCore/platform/graphics/mac/DisplayRefreshMonitorMac.h	2016-12-09 00:56:48 UTC (rev 209583)
+++ trunk/Source/WebCore/platform/graphics/mac/DisplayRefreshMonitorMac.h	2016-12-09 01:21:07 UTC (rev 209584)
@@ -23,8 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef DisplayRefreshMonitorMac_h
-#define DisplayRefreshMonitorMac_h
+#pragma once
 
 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
 
@@ -37,9 +36,9 @@
 
 class DisplayRefreshMonitorMac : public DisplayRefreshMonitor {
 public:
-    static PassRefPtr<DisplayRefreshMonitorMac> create(PlatformDisplayID displayID)
+    static Ref<DisplayRefreshMonitorMac> create(PlatformDisplayID displayID)
     {
-        return adoptRef(new DisplayRefreshMonitorMac(displayID));
+        return adoptRef(*new DisplayRefreshMonitorMac(displayID));
     }
     
     virtual ~DisplayRefreshMonitorMac();
@@ -57,5 +56,3 @@
 }
 
 #endif // USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
-
-#endif

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp (209583 => 209584)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp	2016-12-09 00:56:48 UTC (rev 209583)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp	2016-12-09 01:21:07 UTC (rev 209584)
@@ -130,7 +130,7 @@
     return result;
 }
 
-PassRefPtr<GraphicsContext3D> GraphicsContext3D::createForCurrentGLContext()
+RefPtr<GraphicsContext3D> GraphicsContext3D::createForCurrentGLContext()
 {
     auto context = adoptRef(*new GraphicsContext3D({ }, 0, GraphicsContext3D::RenderToCurrentGLContext));
     if (!context->m_private)
@@ -195,12 +195,12 @@
     return false;
 }
 
-PassRefPtr<ImageData> GraphicsContext3D::paintRenderingResultsToImageData()
+RefPtr<ImageData> GraphicsContext3D::paintRenderingResultsToImageData()
 {
     // Reading premultiplied alpha would involve unpremultiplying, which is
     // lossy.
     if (m_attrs.premultipliedAlpha)
-        return 0;
+        return nullptr;
 
     auto imageData = ImageData::create(IntSize(m_currentWidth, m_currentHeight));
     unsigned char* pixels = imageData->data()->data();
@@ -212,7 +212,7 @@
     for (int i = 0; i < totalBytes; i += 4)
         std::swap(pixels[i], pixels[i + 2]);
 
-    return WTFMove(imageData);
+    return imageData;
 }
 
 void GraphicsContext3D::prepareTexture()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to