Move WebCore/platform/graphics/surfaces to std::unique_ptr
authorgyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Dec 2014 03:25:44 +0000 (03:25 +0000)
committergyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Dec 2014 03:25:44 +0000 (03:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=139641

Reviewed by Andreas Kling.

Source/WebCore:

Replace OwnPtr|PassOwnPtr with std::make_unique<>|std::unique_ptr<>.

* platform/graphics/GLContext.cpp:
(WebCore::GLContext::sharingContext):
(WebCore::GLContext::createContextForWindow):
(WebCore::GLContext::createOffscreenContext):
* platform/graphics/GLContext.h:
* platform/graphics/GraphicsContext3DPrivate.cpp:
(WebCore::GraphicsContext3DPrivate::paintToTextureMapper):
* platform/graphics/GraphicsContext3DPrivate.h:
* platform/graphics/egl/GLContextEGL.cpp:
(WebCore::GLContextEGL::createWindowContext):
(WebCore::GLContextEGL::createPbufferContext):
(WebCore::GLContextEGL::createPixmapContext):
(WebCore::GLContextEGL::createContext):
* platform/graphics/egl/GLContextEGL.h:
* platform/graphics/glx/GLContextGLX.cpp:
(WebCore::GLContextGLX::createWindowContext):
(WebCore::GLContextGLX::createPbufferContext):
(WebCore::GLContextGLX::createPixmapContext):
(WebCore::GLContextGLX::createContext):
* platform/graphics/glx/GLContextGLX.h:
* platform/graphics/surfaces/GLTransportSurface.cpp:
(WebCore::GLTransportSurface::createTransportSurface):
(WebCore::GLTransportSurfaceClient::createTransportSurfaceClient):
* platform/graphics/surfaces/GLTransportSurface.h:
* platform/graphics/surfaces/GraphicsSurface.h:
* platform/graphics/surfaces/GraphicsSurfaceToken.h:
* platform/graphics/surfaces/efl/GraphicsSurfaceCommon.cpp:
* platform/graphics/surfaces/egl/EGLSurface.cpp:
(WebCore::EGLTransportSurface::createTransportSurface):
(WebCore::EGLTransportSurface::createTransportSurfaceClient):
(WebCore::EGLTransportSurface::EGLTransportSurface):
* platform/graphics/surfaces/egl/EGLSurface.h:
* platform/graphics/surfaces/egl/EGLXSurface.cpp:
(WebCore::EGLXTransportSurfaceClient::EGLXTransportSurfaceClient):
* platform/graphics/surfaces/egl/EGLXSurface.h:
* platform/graphics/surfaces/glx/GLXSurface.cpp:
(WebCore::GLXTransportSurface::GLXTransportSurface):
(WebCore::GLXOffScreenSurface::initialize):
* platform/graphics/surfaces/glx/GLXSurface.h:

Source/WebKit2:

* WebProcess/WebPage/gtk/LayerTreeHostGtk.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@177429 268f45cc-cd09-0410-ab3c-d52691b4dbfc

22 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/GLContext.cpp
Source/WebCore/platform/graphics/GLContext.h
Source/WebCore/platform/graphics/GraphicsContext3DPrivate.cpp
Source/WebCore/platform/graphics/GraphicsContext3DPrivate.h
Source/WebCore/platform/graphics/egl/GLContextEGL.cpp
Source/WebCore/platform/graphics/egl/GLContextEGL.h
Source/WebCore/platform/graphics/glx/GLContextGLX.cpp
Source/WebCore/platform/graphics/glx/GLContextGLX.h
Source/WebCore/platform/graphics/surfaces/GLTransportSurface.cpp
Source/WebCore/platform/graphics/surfaces/GLTransportSurface.h
Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h
Source/WebCore/platform/graphics/surfaces/GraphicsSurfaceToken.h
Source/WebCore/platform/graphics/surfaces/efl/GraphicsSurfaceCommon.cpp
Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.cpp
Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.h
Source/WebCore/platform/graphics/surfaces/egl/EGLXSurface.cpp
Source/WebCore/platform/graphics/surfaces/egl/EGLXSurface.h
Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.cpp
Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.h
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.h

index 48c95f8..83cdf82 100644 (file)
@@ -1,3 +1,52 @@
+2014-12-16  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
+
+        Move WebCore/platform/graphics/surfaces to std::unique_ptr
+        https://bugs.webkit.org/show_bug.cgi?id=139641
+
+        Reviewed by Andreas Kling.
+
+        Replace OwnPtr|PassOwnPtr with std::make_unique<>|std::unique_ptr<>.
+
+        * platform/graphics/GLContext.cpp:
+        (WebCore::GLContext::sharingContext):
+        (WebCore::GLContext::createContextForWindow):
+        (WebCore::GLContext::createOffscreenContext):
+        * platform/graphics/GLContext.h:
+        * platform/graphics/GraphicsContext3DPrivate.cpp:
+        (WebCore::GraphicsContext3DPrivate::paintToTextureMapper):
+        * platform/graphics/GraphicsContext3DPrivate.h:
+        * platform/graphics/egl/GLContextEGL.cpp:
+        (WebCore::GLContextEGL::createWindowContext):
+        (WebCore::GLContextEGL::createPbufferContext):
+        (WebCore::GLContextEGL::createPixmapContext):
+        (WebCore::GLContextEGL::createContext):
+        * platform/graphics/egl/GLContextEGL.h:
+        * platform/graphics/glx/GLContextGLX.cpp:
+        (WebCore::GLContextGLX::createWindowContext):
+        (WebCore::GLContextGLX::createPbufferContext):
+        (WebCore::GLContextGLX::createPixmapContext):
+        (WebCore::GLContextGLX::createContext):
+        * platform/graphics/glx/GLContextGLX.h:
+        * platform/graphics/surfaces/GLTransportSurface.cpp:
+        (WebCore::GLTransportSurface::createTransportSurface):
+        (WebCore::GLTransportSurfaceClient::createTransportSurfaceClient):
+        * platform/graphics/surfaces/GLTransportSurface.h:
+        * platform/graphics/surfaces/GraphicsSurface.h:
+        * platform/graphics/surfaces/GraphicsSurfaceToken.h:
+        * platform/graphics/surfaces/efl/GraphicsSurfaceCommon.cpp:
+        * platform/graphics/surfaces/egl/EGLSurface.cpp:
+        (WebCore::EGLTransportSurface::createTransportSurface):
+        (WebCore::EGLTransportSurface::createTransportSurfaceClient):
+        (WebCore::EGLTransportSurface::EGLTransportSurface):
+        * platform/graphics/surfaces/egl/EGLSurface.h:
+        * platform/graphics/surfaces/egl/EGLXSurface.cpp:
+        (WebCore::EGLXTransportSurfaceClient::EGLXTransportSurfaceClient):
+        * platform/graphics/surfaces/egl/EGLXSurface.h:
+        * platform/graphics/surfaces/glx/GLXSurface.cpp:
+        (WebCore::GLXTransportSurface::GLXTransportSurface):
+        (WebCore::GLXOffScreenSurface::initialize):
+        * platform/graphics/surfaces/glx/GLXSurface.h:
+
 2014-12-16  Timothy Horton  <timothy_horton@apple.com>
 
         Implement and adopt two new TextIndicator presentation animations
index 75aa367..a7fa988 100644 (file)
@@ -68,7 +68,7 @@ inline ThreadGlobalGLContext* currentContext()
 
 GLContext* GLContext::sharingContext()
 {
-    DEPRECATED_DEFINE_STATIC_LOCAL(OwnPtr<GLContext>, sharing, (createOffscreenContext()));
+    DEPRECATED_DEFINE_STATIC_LOCAL(std::unique_ptr<GLContext>, sharing, (createOffscreenContext()));
     return sharing.get();
 }
 
@@ -142,25 +142,25 @@ void GLContext::cleanupActiveContextsAtExit()
 #endif // PLATFORM(X11)
 
 
-PassOwnPtr<GLContext> GLContext::createContextForWindow(GLNativeWindowType windowHandle, GLContext* sharingContext)
+std::unique_ptr<GLContext> GLContext::createContextForWindow(GLNativeWindowType windowHandle, GLContext* sharingContext)
 {
 #if PLATFORM(GTK) && PLATFORM(WAYLAND) && !defined(GTK_API_VERSION_2) && defined(GDK_WINDOWING_WAYLAND) && USE(EGL)
     GdkDisplay* display = gdk_display_manager_get_default_display(gdk_display_manager_get());
 
     if (GDK_IS_WAYLAND_DISPLAY(display)) {
-        if (OwnPtr<GLContext> eglContext = GLContextEGL::createContext(windowHandle, sharingContext))
-            return eglContext.release();
+        if (auto eglContext = GLContextEGL::createContext(windowHandle, sharingContext))
+            return WTF::move(eglContext);
         return nullptr;
     }
 #endif
 
 #if USE(GLX)
-    if (OwnPtr<GLContext> glxContext = GLContextGLX::createContext(windowHandle, sharingContext))
-        return glxContext.release();
+    if (auto glxContext = GLContextGLX::createContext(windowHandle, sharingContext))
+        return WTF::move(glxContext);
 #endif
 #if USE(EGL)
-    if (OwnPtr<GLContext> eglContext = GLContextEGL::createContext(windowHandle, sharingContext))
-        return eglContext.release();
+    if (auto eglContext = GLContextEGL::createContext(windowHandle, sharingContext))
+        return WTF::move(eglContext);
 #endif
     return nullptr;
 }
@@ -172,7 +172,7 @@ GLContext::GLContext()
 #endif
 }
 
-PassOwnPtr<GLContext> GLContext::createOffscreenContext(GLContext* sharingContext)
+std::unique_ptr<GLContext> GLContext::createOffscreenContext(GLContext* sharingContext)
 {
     return createContextForWindow(0, sharingContext);
 }
index 03b57b5..04653b6 100644 (file)
@@ -23,7 +23,6 @@
 #include "GraphicsContext3D.h"
 #include "Widget.h"
 #include <wtf/Noncopyable.h>
-#include <wtf/PassOwnPtr.h>
 
 #if USE(EGL) && !PLATFORM(GTK)
 #include "eglplatform.h"
@@ -45,8 +44,8 @@ namespace WebCore {
 class GLContext {
     WTF_MAKE_NONCOPYABLE(GLContext);
 public:
-    static PassOwnPtr<GLContext> createContextForWindow(GLNativeWindowType windowHandle, GLContext* sharingContext);
-    static PassOwnPtr<GLContext> createOffscreenContext(GLContext* sharing = 0);
+    static std::unique_ptr<GLContext> createContextForWindow(GLNativeWindowType windowHandle, GLContext* sharingContext);
+    static std::unique_ptr<GLContext> createOffscreenContext(GLContext* sharing = 0);
     static GLContext* getCurrent();
     static GLContext* sharingContext();
 
index 25a07c8..548b0b0 100644 (file)
@@ -131,13 +131,13 @@ void GraphicsContext3DPrivate::paintToTextureMapper(TextureMapper* textureMapper
 #if USE(TEXTURE_MAPPER_GL)
     if (m_context->m_attrs.antialias && m_context->m_state.boundFBO == m_context->m_multisampleFBO) {
         GLContext* previousActiveContext = GLContext::getCurrent();
-        if (previousActiveContext != m_glContext)
+        if (previousActiveContext != m_glContext.get())
             m_context->makeContextCurrent();
 
         m_context->resolveMultisamplingIfNecessary();
         ::glBindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_context->m_state.boundFBO);
 
-        if (previousActiveContext && previousActiveContext != m_glContext)
+        if (previousActiveContext && previousActiveContext != m_glContext.get())
             previousActiveContext->makeContextCurrent();
     }
 
index 1566da0..387edad 100644 (file)
@@ -49,7 +49,7 @@ public:
 
 private:
     GraphicsContext3D* m_context;
-    OwnPtr<GLContext> m_glContext;
+    std::unique_ptr<GLContext> m_glContext;
     GraphicsContext3D::RenderStyle m_renderStyle;
 };
 
index 10241c0..d235ebd 100644 (file)
@@ -121,7 +121,7 @@ static bool getEGLConfig(EGLConfig* config, GLContextEGL::EGLSurfaceType surface
     return eglChooseConfig(sharedEGLDisplay(), attributeList, config, 1, &numberConfigsReturned) && numberConfigsReturned;
 }
 
-PassOwnPtr<GLContextEGL> GLContextEGL::createWindowContext(EGLNativeWindowType window, GLContext* sharingContext)
+std::unique_ptr<GLContextEGL> GLContextEGL::createWindowContext(EGLNativeWindowType window, GLContext* sharingContext)
 {
     EGLContext eglSharingContext = sharingContext ? static_cast<GLContextEGL*>(sharingContext)->m_context : 0;
 
@@ -141,10 +141,10 @@ PassOwnPtr<GLContextEGL> GLContextEGL::createWindowContext(EGLNativeWindowType w
     if (surface == EGL_NO_SURFACE)
         return nullptr;
 
-    return adoptPtr(new GLContextEGL(context, surface, WindowSurface));
+    return std::make_unique<GLContextEGL>(context, surface, WindowSurface);
 }
 
-PassOwnPtr<GLContextEGL> GLContextEGL::createPbufferContext(EGLContext sharingContext)
+std::unique_ptr<GLContextEGL> GLContextEGL::createPbufferContext(EGLContext sharingContext)
 {
     EGLDisplay display = sharedEGLDisplay();
     if (display == EGL_NO_DISPLAY)
@@ -165,10 +165,10 @@ PassOwnPtr<GLContextEGL> GLContextEGL::createPbufferContext(EGLContext sharingCo
         return nullptr;
     }
 
-    return adoptPtr(new GLContextEGL(context, surface, PbufferSurface));
+    return std::make_unique<GLContextEGL>(context, surface, PbufferSurface);
 }
 
-PassOwnPtr<GLContextEGL> GLContextEGL::createPixmapContext(EGLContext sharingContext)
+std::unique_ptr<GLContextEGL> GLContextEGL::createPixmapContext(EGLContext sharingContext)
 {
 #if PLATFORM(X11)
     EGLDisplay display = sharedEGLDisplay();
@@ -196,13 +196,13 @@ PassOwnPtr<GLContextEGL> GLContextEGL::createPixmapContext(EGLContext sharingCon
     if (surface == EGL_NO_SURFACE)
         return nullptr;
 
-    return adoptPtr(new GLContextEGL(context, surface, PixmapSurface));
+    return std::make_unique<GLContextEGL>(context, surface, PixmapSurface);
 #else
     return nullptr;
 #endif
 }
 
-PassOwnPtr<GLContextEGL> GLContextEGL::createContext(EGLNativeWindowType window, GLContext* sharingContext)
+std::unique_ptr<GLContextEGL> GLContextEGL::createContext(EGLNativeWindowType window, GLContext* sharingContext)
 {
     if (!sharedEGLDisplay())
         return nullptr;
@@ -219,14 +219,14 @@ PassOwnPtr<GLContextEGL> GLContextEGL::createContext(EGLNativeWindowType window,
         return nullptr;
 
     EGLContext eglSharingContext = sharingContext ? static_cast<GLContextEGL*>(sharingContext)->m_context : 0;
-    OwnPtr<GLContextEGL> context = window ? createWindowContext(window, sharingContext) : nullptr;
+    auto context = window ? createWindowContext(window, sharingContext) : nullptr;
     if (!context)
         context = createPixmapContext(eglSharingContext);
 
     if (!context)
         context = createPbufferContext(eglSharingContext);
     
-    return context.release();
+    return WTF::move(context);
 }
 
 GLContextEGL::GLContextEGL(EGLContext context, EGLSurface surface, EGLSurfaceType type)
index d1b28ea..4d8d8e4 100644 (file)
@@ -32,9 +32,10 @@ class GLContextEGL : public GLContext {
     WTF_MAKE_NONCOPYABLE(GLContextEGL);
 public:
     enum EGLSurfaceType { PbufferSurface, WindowSurface, PixmapSurface };
-    static PassOwnPtr<GLContextEGL> createContext(EGLNativeWindowType, GLContext* sharingContext = 0);
-    static PassOwnPtr<GLContextEGL> createWindowContext(EGLNativeWindowType, GLContext* sharingContext);
+    static std::unique_ptr<GLContextEGL> createContext(EGLNativeWindowType, GLContext* sharingContext = 0);
+    static std::unique_ptr<GLContextEGL> createWindowContext(EGLNativeWindowType, GLContext* sharingContext);
 
+    GLContextEGL(EGLContext, EGLSurface, EGLSurfaceType);
     virtual ~GLContextEGL();
     virtual bool makeContextCurrent();
     virtual void swapBuffers();
@@ -50,14 +51,12 @@ public:
 #endif
 
 private:
-    static PassOwnPtr<GLContextEGL> createPbufferContext(EGLContext sharingContext);
-    static PassOwnPtr<GLContextEGL> createPixmapContext(EGLContext sharingContext);
+    static std::unique_ptr<GLContextEGL> createPbufferContext(EGLContext sharingContext);
+    static std::unique_ptr<GLContextEGL> createPixmapContext(EGLContext sharingContext);
 
     static void addActiveContext(GLContextEGL*);
     static void cleanupSharedEGLDisplay(void);
 
-    GLContextEGL(EGLContext, EGLSurface, EGLSurfaceType);
-
     EGLContext m_context;
     EGLSurface m_surface;
     EGLSurfaceType m_type;
index 176f772..7890d8d 100644 (file)
@@ -32,7 +32,7 @@
 
 namespace WebCore {
 
-PassOwnPtr<GLContextGLX> GLContextGLX::createWindowContext(XID window, GLContext* sharingContext)
+std::unique_ptr<GLContextGLX> GLContextGLX::createWindowContext(XID window, GLContext* sharingContext)
 {
     Display* display = sharedX11Display();
     XWindowAttributes attributes;
@@ -54,12 +54,12 @@ PassOwnPtr<GLContextGLX> GLContextGLX::createWindowContext(XID window, GLContext
 
     // GLXPbuffer and XID are both the same types underneath, so we have to share
     // a constructor here with the window path.
-    GLContextGLX* contextWrapper = new GLContextGLX(context);
+    auto contextWrapper = std::make_unique<GLContextGLX>(context);
     contextWrapper->m_window = window;
-    return adoptPtr(contextWrapper);
+    return WTF::move(contextWrapper);
 }
 
-PassOwnPtr<GLContextGLX> GLContextGLX::createPbufferContext(GLXContext sharingContext)
+std::unique_ptr<GLContextGLX> GLContextGLX::createPbufferContext(GLXContext sharingContext)
 {
     int fbConfigAttributes[] = {
         GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT,
@@ -97,12 +97,12 @@ PassOwnPtr<GLContextGLX> GLContextGLX::createPbufferContext(GLXContext sharingCo
 
     // GLXPbuffer and XID are both the same types underneath, so we have to share
     // a constructor here with the window path.
-    GLContextGLX* contextWrapper = new GLContextGLX(context);
+    auto contextWrapper = std::make_unique<GLContextGLX>(context);
     contextWrapper->m_pbuffer = pbuffer;
-    return adoptPtr(contextWrapper);
+    return WTF::move(contextWrapper);
 }
 
-PassOwnPtr<GLContextGLX> GLContextGLX::createPixmapContext(GLXContext sharingContext)
+std::unique_ptr<GLContextGLX> GLContextGLX::createPixmapContext(GLXContext sharingContext)
 {
     static int visualAttributes[] = {
         GLX_RGBA,
@@ -138,10 +138,10 @@ PassOwnPtr<GLContextGLX> GLContextGLX::createPixmapContext(GLXContext sharingCon
     }
 
     XFree(visualInfo);
-    return adoptPtr(new GLContextGLX(context, pixmap, glxPixmap));
+    return std::make_unique<GLContextGLX>(context, pixmap, glxPixmap);
 }
 
-PassOwnPtr<GLContextGLX> GLContextGLX::createContext(XID window, GLContext* sharingContext)
+std::unique_ptr<GLContextGLX> GLContextGLX::createContext(XID window, GLContext* sharingContext)
 {
     if (!sharedX11Display())
         return nullptr;
@@ -156,7 +156,7 @@ PassOwnPtr<GLContextGLX> GLContextGLX::createContext(XID window, GLContext* shar
         return nullptr;
 
     GLXContext glxSharingContext = sharingContext ? static_cast<GLContextGLX*>(sharingContext)->m_context : 0;
-    OwnPtr<GLContextGLX> context = window ? createWindowContext(window, sharingContext) : nullptr;
+    auto context = window ? createWindowContext(window, sharingContext) : nullptr;
     if (!context)
         context = createPbufferContext(glxSharingContext);
     if (!context)
@@ -164,7 +164,7 @@ PassOwnPtr<GLContextGLX> GLContextGLX::createContext(XID window, GLContext* shar
     if (!context)
         return nullptr;
 
-    return context.release();
+    return WTF::move(context);
 }
 
 GLContextGLX::GLContextGLX(GLXContext context)
index edefc04..3ef4ced 100644 (file)
@@ -37,9 +37,11 @@ namespace WebCore {
 class GLContextGLX : public GLContext {
     WTF_MAKE_NONCOPYABLE(GLContextGLX);
 public:
-    static PassOwnPtr<GLContextGLX> createContext(XID window, GLContext* sharingContext);
-    static PassOwnPtr<GLContextGLX> createWindowContext(XID window, GLContext* sharingContext);
+    static std::unique_ptr<GLContextGLX> createContext(XID window, GLContext* sharingContext);
+    static std::unique_ptr<GLContextGLX> createWindowContext(XID window, GLContext* sharingContext);
 
+    GLContextGLX(GLXContext);
+    GLContextGLX(GLXContext, Pixmap, GLXPixmap);
     virtual ~GLContextGLX();
     virtual bool makeContextCurrent();
     virtual void swapBuffers();
@@ -53,11 +55,8 @@ public:
 #endif
 
 private:
-    static PassOwnPtr<GLContextGLX> createPbufferContext(GLXContext sharingContext);
-    static PassOwnPtr<GLContextGLX> createPixmapContext(GLXContext sharingContext);
-
-    GLContextGLX(GLXContext);
-    GLContextGLX(GLXContext, Pixmap, GLXPixmap);
+    static std::unique_ptr<GLContextGLX> createPbufferContext(GLXContext sharingContext);
+    static std::unique_ptr<GLContextGLX> createPixmapContext(GLXContext sharingContext);
 
     GLXContext m_context;
     XID m_window;
index 25d6ce9..23d5bf8 100644 (file)
@@ -43,17 +43,17 @@ namespace WebCore {
 static const GLfloat vertices[] = { 0, 0, 1, 0, 1, 1, 0, 1 };
 static bool vertexArrayObjectSupported = false;
 
-PassOwnPtr<GLTransportSurface> GLTransportSurface::createTransportSurface(const IntSize& size, SurfaceAttributes attributes)
+std::unique_ptr<GLTransportSurface> GLTransportSurface::createTransportSurface(const IntSize& size, SurfaceAttributes attributes)
 {
-    OwnPtr<GLTransportSurface> surface;
+    std::unique_ptr<GLTransportSurface> surface;
 #if USE(GLX)
-    surface = adoptPtr(new GLXTransportSurface(size, attributes));
+    surface = std::make_unique<GLXTransportSurface>(size, attributes);
 #elif USE(EGL)
     surface = EGLTransportSurface::createTransportSurface(size, attributes);
 #endif
 
     if (surface && surface->handle() && surface->drawable())
-        return surface.release();
+        return WTF::move(surface);
 
     return nullptr;
 }
@@ -205,11 +205,11 @@ void GLTransportSurface::initializeShaderProgram()
     updateTransformationMatrix();
 }
 
-PassOwnPtr<GLTransportSurfaceClient> GLTransportSurfaceClient::createTransportSurfaceClient(const PlatformBufferHandle handle, const IntSize& size, bool hasAlpha)
+std::unique_ptr<GLTransportSurfaceClient> GLTransportSurfaceClient::createTransportSurfaceClient(const PlatformBufferHandle handle, const IntSize& size, bool hasAlpha)
 {
-    OwnPtr<GLTransportSurfaceClient> client;
+    std::unique_ptr<GLTransportSurfaceClient> client;
 #if USE(GLX)
-    client = adoptPtr(new GLXTransportSurfaceClient(handle, hasAlpha));
+    client = std::make_unique<GLXTransportSurfaceClient>(handle, hasAlpha);
     UNUSED_PARAM(size);
 #else
     client = EGLTransportSurface::createTransportSurfaceClient(handle, size, hasAlpha);
@@ -220,7 +220,7 @@ PassOwnPtr<GLTransportSurfaceClient> GLTransportSurfaceClient::createTransportSu
         return nullptr;
     }
 
-    return client.release();
+    return WTF::move(client);
 }
 
 
index b579c85..dccc65b 100644 (file)
@@ -27,7 +27,6 @@
 #define GLTransportSurface_h
 
 #include "GLPlatformSurface.h"
-#include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
 
@@ -37,7 +36,7 @@ class GLTransportSurface : public GLPlatformSurface {
 
 public:
     // Creates a GL surface whose results can be transported to the UI process for display.
-    static PassOwnPtr<GLTransportSurface> createTransportSurface(const IntSize&, SurfaceAttributes = GLPlatformSurface::Default);
+    static std::unique_ptr<GLTransportSurface> createTransportSurface(const IntSize&, SurfaceAttributes = GLPlatformSurface::Default);
     virtual ~GLTransportSurface();
     virtual void updateContents(const uint32_t) override;
     virtual void setGeometry(const IntRect&) override;
@@ -60,7 +59,7 @@ protected:
 class GLTransportSurfaceClient {
 
 public:
-    static PassOwnPtr<GLTransportSurfaceClient> createTransportSurfaceClient(const PlatformBufferHandle, const IntSize&, bool);
+    static std::unique_ptr<GLTransportSurfaceClient> createTransportSurfaceClient(const PlatformBufferHandle, const IntSize&, bool);
     virtual ~GLTransportSurfaceClient();
     virtual void prepareTexture();
     virtual void destroy();
index b471c92..5bb812c 100644 (file)
@@ -26,7 +26,6 @@
 #include "GraphicsContext3D.h"
 #include "GraphicsSurfaceToken.h"
 #include "IntRect.h"
-#include <wtf/OwnPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
 
index 0b8a651..aff9c49 100644 (file)
@@ -22,7 +22,6 @@
 
 #include "GraphicsContext.h"
 #include "IntRect.h"
-#include <wtf/OwnPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
 
index ec4f122..e06a128 100644 (file)
@@ -147,9 +147,9 @@ private:
     FloatRect m_rect;
     IntSize m_size;
     PlatformBufferHandle m_sharedHandle;
-    OwnPtr<GLTransportSurfaceClient> m_client;
+    std::unique_ptr<GLTransportSurfaceClient> m_client;
     std::unique_ptr<GLPlatformContext> m_sharedContext;
-    OwnPtr<GLTransportSurface> m_sharedSurface;
+    std::unique_ptr<GLTransportSurface> m_sharedSurface;
 };
 
 GraphicsSurfaceToken GraphicsSurface::platformExport()
index 6c3c5e3..eae30cd 100644 (file)
 
 namespace WebCore {
 
-PassOwnPtr<GLTransportSurface> EGLTransportSurface::createTransportSurface(const IntSize& size, SurfaceAttributes attributes)
+std::unique_ptr<GLTransportSurface> EGLTransportSurface::createTransportSurface(const IntSize& size, SurfaceAttributes attributes)
 {
-    OwnPtr<GLTransportSurface> surface;
+    std::unique_ptr<GLTransportSurface> surface;
 #if PLATFORM(X11)
-    surface = adoptPtr(new EGLWindowTransportSurface(size, attributes));
+    surface = std::make_unique<EGLWindowTransportSurface>(size, attributes);
 #else
     UNUSED_PARAM(size);
     UNUSED_PARAM(attributes);
 #endif
 
     if (surface)
-        return surface.release();
+        return WTF::move(surface);
 
     return nullptr;
 }
 
-PassOwnPtr<GLTransportSurfaceClient> EGLTransportSurface::createTransportSurfaceClient(const PlatformBufferHandle handle, const IntSize& size, bool hasAlpha)
+std::unique_ptr<GLTransportSurfaceClient> EGLTransportSurface::createTransportSurfaceClient(const PlatformBufferHandle handle, const IntSize& size, bool hasAlpha)
 {
     EGLHelper::resolveEGLBindings();
-    OwnPtr<GLTransportSurfaceClient> client;
+    std::unique_ptr<GLTransportSurfaceClient> client;
 #if PLATFORM(X11)
-    client = adoptPtr(new EGLXTransportSurfaceClient(handle, size, hasAlpha));
+    client = std::make_unique<EGLXTransportSurfaceClient>(handle, size, hasAlpha);
 #else
     UNUSED_PARAM(handle);
     UNUSED_PARAM(size);
@@ -67,7 +67,7 @@ PassOwnPtr<GLTransportSurfaceClient> EGLTransportSurface::createTransportSurface
 #endif
 
     if (client)
-        return client.release();
+        return WTF::move(client);
 
     return nullptr;
 }
@@ -80,7 +80,7 @@ EGLTransportSurface::EGLTransportSurface(const IntSize& size, SurfaceAttributes
     if (m_sharedDisplay == EGL_NO_DISPLAY)
         return;
 
-    m_configSelector = adoptPtr(new EGLConfigSelector(attributes));
+    m_configSelector = std::make_unique<EGLConfigSelector>(attributes);
 }
 
 GLPlatformSurface::SurfaceAttributes EGLTransportSurface::attributes() const
index 5debe7e..93713ba 100644 (file)
@@ -31,7 +31,6 @@
 #include "GLTransportSurface.h"
 
 #include <wtf/Noncopyable.h>
-#include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
 
@@ -39,8 +38,8 @@ class EGLConfigSelector;
 
 class EGLTransportSurface : public GLTransportSurface {
 public:
-    static PassOwnPtr<GLTransportSurface> createTransportSurface(const IntSize&, SurfaceAttributes);
-    static PassOwnPtr<GLTransportSurfaceClient> createTransportSurfaceClient(const PlatformBufferHandle, const IntSize&, bool);
+    static std::unique_ptr<GLTransportSurface> createTransportSurface(const IntSize&, SurfaceAttributes);
+    static std::unique_ptr<GLTransportSurfaceClient> createTransportSurfaceClient(const PlatformBufferHandle, const IntSize&, bool);
     virtual ~EGLTransportSurface();
     virtual PlatformSurfaceConfig configuration() override;
     virtual void destroy() override;
@@ -48,7 +47,7 @@ public:
 
 protected:
     EGLTransportSurface(const IntSize&, SurfaceAttributes);
-    OwnPtr<EGLConfigSelector> m_configSelector;
+    std::unique_ptr<EGLConfigSelector> m_configSelector;
 };
 
 class EGLOffScreenSurface : public GLPlatformSurface {
@@ -61,7 +60,7 @@ public:
 
 protected:
     EGLOffScreenSurface(SurfaceAttributes);
-    OwnPtr<EGLConfigSelector> m_configSelector;
+    std::unique_ptr<EGLConfigSelector> m_configSelector;
 };
 
 }
index 546619c..792a98b 100644 (file)
@@ -161,7 +161,7 @@ EGLXTransportSurfaceClient::EGLXTransportSurfaceClient(const PlatformBufferHandl
 
     EGLConfigSelector configSelector(sharedSurfaceAttributes);
     EGLConfig config = configSelector.surfaceClientConfig(XVisualIDFromVisual(attr.visual));
-    m_eglImage = adoptPtr(new EGLTextureFromPixmap(m_handle, hasAlpha, config));
+    m_eglImage = std::make_unique<EGLTextureFromPixmap>(m_handle, hasAlpha, config);
 
     if (!m_eglImage->isValid() || eglGetError() != EGL_SUCCESS)
         destroy();
index 4ff128c..96c8a66 100644 (file)
@@ -79,7 +79,7 @@ private:
     PlatformBufferHandle m_handle;
     GLuint m_format;
     unsigned m_totalBytes;
-    OwnPtr<EGLTextureFromPixmap> m_eglImage;
+    std::unique_ptr<EGLTextureFromPixmap> m_eglImage;
 };
 
 }
index 16f56c1..2b35302 100644 (file)
@@ -66,7 +66,7 @@ GLXTransportSurface::GLXTransportSurface(const IntSize& size, SurfaceAttributes
 {
     m_sharedDisplay = X11Helper::nativeDisplay();
     attributes |= GLPlatformSurface::DoubleBuffered;
-    m_configSelector = adoptPtr(new GLXConfigSelector(attributes));
+    m_configSelector = std::make_unique<GLXConfigSelector>(attributes);
     OwnPtrX11<XVisualInfo> visInfo(m_configSelector->visualInfo(m_configSelector->surfaceContextConfig()));
 
     if (!visInfo.get()) {
@@ -143,7 +143,7 @@ void GLXOffScreenSurface::initialize(SurfaceAttributes attributes)
 {
     m_sharedDisplay = X11Helper::nativeDisplay();
 
-    m_configSelector = adoptPtr(new GLXConfigSelector(attributes));
+    m_configSelector = std::make_unique<GLXConfigSelector>(attributes);
 
     OwnPtrX11<XVisualInfo> visualInfo(m_configSelector->visualInfo(m_configSelector->pixmapContextConfig()));
     X11Helper::createPixmap(&m_pixmap, *visualInfo.get());
index 0b19fe3..7c0e969 100644 (file)
@@ -46,7 +46,7 @@ public:
     virtual void destroy() override;
 
 private:
-    OwnPtr<GLXConfigSelector> m_configSelector;
+    std::unique_ptr<GLXConfigSelector> m_configSelector;
 };
 
 class GLXOffScreenSurface : public GLPlatformSurface {
@@ -60,7 +60,7 @@ public:
 private:
     void initialize(SurfaceAttributes);
     void freeResources();
-    OwnPtr<GLXConfigSelector> m_configSelector;
+    std::unique_ptr<GLXConfigSelector> m_configSelector;
     Pixmap m_pixmap;
     GLXPixmap m_glxPixmap;
 };
index 88b0fa2..ec57543 100644 (file)
@@ -1,3 +1,12 @@
+2014-12-16  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
+
+        Move WebCore/platform/graphics/surfaces to std::unique_ptr
+        https://bugs.webkit.org/show_bug.cgi?id=139641
+
+        Reviewed by Andreas Kling.
+
+        * WebProcess/WebPage/gtk/LayerTreeHostGtk.h:
+
 2014-12-16  Timothy Horton  <timothy_horton@apple.com>
 
         Implement and adopt two new TextIndicator presentation animations
index a76eef0..16f68ab 100644 (file)
@@ -36,7 +36,6 @@
 #include <WebCore/GraphicsLayerClient.h>
 #include <WebCore/PageOverlay.h>
 #include <wtf/HashMap.h>
-#include <wtf/OwnPtr.h>
 #include <wtf/gobject/GMainLoopSource.h>
 
 namespace WebKit {
@@ -99,7 +98,7 @@ private:
     typedef HashMap<WebCore::PageOverlay*, std::unique_ptr<WebCore::GraphicsLayer>> PageOverlayLayerMap;
     PageOverlayLayerMap m_pageOverlayLayers;
     std::unique_ptr<WebCore::TextureMapper> m_textureMapper;
-    OwnPtr<WebCore::GLContext> m_context;
+    std::unique_ptr<WebCore::GLContext> m_context;
     double m_lastImmediateFlushTime;
     bool m_layerFlushSchedulingEnabled;
     GMainLoopSource m_layerFlushTimerCallback;