[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

jamesr at google.com jamesr at google.com
Wed Dec 22 11:12:16 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit c4a4a7659d09b93fbe0a0b9110dd06f399213c00
Author: jamesr at google.com <jamesr at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jul 15 00:36:28 2010 +0000

    2010-07-14  James Robinson  <jamesr at chromium.org>
    
            Reviewed by Darin Fisher.
    
            Breaks all dependencies on Page from platform/ and cleans up GLES2Context lifetime
            https://bugs.webkit.org/show_bug.cgi?id=42203
    
            Rather than constructing a GLES2Context from a Page, pass the LayerRendererChromium
            a GLES2Context in from the constructor.  This way the platform/ directory can remain
            ignorant of Page and friends.  Also adds functions on ChromeClientChromium to request
            onscreen and offscreen GLES2Contexts for callers in WebCore that need them.
    
            * WebKit.gyp:
            * src/ChromeClientImpl.cpp:
            (WebKit::ChromeClientImpl::getOnscreenGLES2Context):
            (WebKit::ChromeClientImpl::getOffscreenGLES2Context):
            * src/ChromeClientImpl.h:
            * src/GLES2Context.cpp:
            (WebCore::GLES2ContextInternal::create):
            (WebCore::GLES2Context::create):
            (WebCore::GLES2Context::GLES2Context):
            * src/GLES2ContextInternal.cpp: Added.
            (WebCore::GLES2ContextInternal::~GLES2ContextInternal):
            * src/GLES2ContextInternal.h: Added.
            (WebCore::GLES2ContextInternal::getWebGLES2Context):
            (WebCore::GLES2ContextInternal::GLES2ContextInternal):
            * src/WebViewImpl.cpp:
            (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
            (WebKit::WebViewImpl::getOnscreenGLES2Context):
            (WebKit::WebViewImpl::getOffscreenGLES2Context):
            * src/WebViewImpl.h:
    2010-07-14  James Robinson  <jamesr at chromium.org>
    
            Reviewed by Darin Fisher.
    
            Breaks all dependencies on Page from platform/ and cleans up GLES2Context lifetime
            https://bugs.webkit.org/show_bug.cgi?id=42203
    
            Rather than constructing a GLES2Context from a Page, pass the LayerRendererChromium
            a GLES2Context in from the constructor.  This way the platform/ directory can remain
            ignorant of Page and friends.  Also adds functions on ChromeClientChromium to request
            onscreen and offscreen GLES2Contexts for callers in WebCore that need them.
    
            * page/chromium/ChromeClientChromium.h:
            * platform/chromium/GLES2Context.h:
            * platform/graphics/chromium/LayerRendererChromium.cpp:
            (WebCore::LayerRendererChromium::create):
            (WebCore::LayerRendererChromium::LayerRendererChromium):
            * platform/graphics/chromium/LayerRendererChromium.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63383 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index a4af0f2..d1b0dd1 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2010-07-14  James Robinson  <jamesr at chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        Breaks all dependencies on Page from platform/ and cleans up GLES2Context lifetime
+        https://bugs.webkit.org/show_bug.cgi?id=42203
+
+        Rather than constructing a GLES2Context from a Page, pass the LayerRendererChromium
+        a GLES2Context in from the constructor.  This way the platform/ directory can remain
+        ignorant of Page and friends.  Also adds functions on ChromeClientChromium to request
+        onscreen and offscreen GLES2Contexts for callers in WebCore that need them.
+
+        * page/chromium/ChromeClientChromium.h:
+        * platform/chromium/GLES2Context.h:
+        * platform/graphics/chromium/LayerRendererChromium.cpp:
+        (WebCore::LayerRendererChromium::create):
+        (WebCore::LayerRendererChromium::LayerRendererChromium):
+        * platform/graphics/chromium/LayerRendererChromium.h:
+
 2010-07-14  Andreas Kling  <andreas.kling at nokia.com>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/page/chromium/ChromeClientChromium.h b/WebCore/page/chromium/ChromeClientChromium.h
index e897c15..46985b1 100644
--- a/WebCore/page/chromium/ChromeClientChromium.h
+++ b/WebCore/page/chromium/ChromeClientChromium.h
@@ -39,6 +39,10 @@ class AccessibilityObject;
 class IntRect;
 class PopupContainer;
 
+#if USE(ACCELERATED_COMPOSITING)
+class GLES2Context;
+#endif
+
 // Contains Chromium-specific extensions to the ChromeClient.  Only put
 // things here that don't make sense for other ports.
 class ChromeClientChromium : public ChromeClient {
@@ -55,6 +59,12 @@ public:
 
     // Notifies embedder that the state of an accessibility object has changed.
     virtual void didChangeAccessibilityObjectState(AccessibilityObject*) = 0;
+
+#if USE(ACCELERATED_COMPOSITING)
+    // Request a GL ES 2 context to use for compositing this page's content.
+    virtual PassOwnPtr<GLES2Context> getOnscreenGLES2Context() = 0;
+    virtual PassOwnPtr<GLES2Context> getOffscreenGLES2Context() = 0;
+#endif
 };
 
 } // namespace WebCore
diff --git a/WebCore/platform/chromium/GLES2Context.h b/WebCore/platform/chromium/GLES2Context.h
index b72329a..d37885a 100644
--- a/WebCore/platform/chromium/GLES2Context.h
+++ b/WebCore/platform/chromium/GLES2Context.h
@@ -43,14 +43,8 @@ class Page;
 
 class GLES2Context : public Noncopyable {
 public:
-    // Creates a GL ES context that draws directly to the window associated with
-    // the Page.
-    static PassOwnPtr<GLES2Context> createOnscreen(Page*);
-
-    // Creates a GL ES context that renders offscreen, optionally as a child
-    // of the given parent if specified.
-    static PassOwnPtr<GLES2Context> createOffscreen(GLES2Context* parent);
-
+    // Used by the implementation only
+    static PassOwnPtr<GLES2Context> create(PassOwnPtr<GLES2ContextInternal>);
     ~GLES2Context();
 
     bool makeCurrent();
@@ -65,6 +59,8 @@ public:
     unsigned getOffscreenContentParentTextureId();
 
 private:
+    GLES2Context();
+
     friend class GLES2ContextInternal;
     OwnPtr<GLES2ContextInternal> m_internal;
 };
diff --git a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
index 9ac506c..b071385 100644
--- a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
+++ b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
@@ -37,7 +37,6 @@
 #include "GLES2Context.h"
 #include "LayerChromium.h"
 #include "NotImplemented.h"
-#include "Page.h"
 #include "TransformLayerChromium.h"
 #include "WebGLLayerChromium.h"
 #if PLATFORM(SKIA)
@@ -190,24 +189,24 @@ ShaderProgram::ShaderProgram()
 {
 }
 
-PassOwnPtr<LayerRendererChromium> LayerRendererChromium::create(Page* page)
+PassOwnPtr<LayerRendererChromium> LayerRendererChromium::create(PassOwnPtr<GLES2Context> gles2Context)
 {
-    return new LayerRendererChromium(page);
+    return new LayerRendererChromium(gles2Context);
 }
 
-LayerRendererChromium::LayerRendererChromium(Page* page)
+LayerRendererChromium::LayerRendererChromium(PassOwnPtr<GLES2Context> gles2Context)
     : m_rootLayer(0)
     , m_needsDisplay(false)
     , m_positionLocation(0)
     , m_texCoordLocation(1)
-    , m_page(page)
     , m_rootLayerTextureWidth(0)
     , m_rootLayerTextureHeight(0)
     , m_scrollPosition(IntPoint(-1, -1))
     , m_currentShaderProgramType(NumShaderProgramTypes)
+    , m_gles2Context(gles2Context)
 {
     m_quadVboIds[Vertices] = m_quadVboIds[LayerElements] = 0;
-    m_hardwareCompositing = (initGL() && initializeSharedGLObjects());
+    m_hardwareCompositing = (m_gles2Context && initializeSharedGLObjects());
 }
 
 LayerRendererChromium::~LayerRendererChromium()
@@ -645,16 +644,6 @@ bool LayerRendererChromium::makeContextCurrent()
     return m_gles2Context->makeCurrent();
 }
 
-bool LayerRendererChromium::initGL()
-{
-    m_gles2Context = GLES2Context::createOnscreen(m_page);
-
-    if (!m_gles2Context)
-        return false;
-
-    return true;
-}
-
 void LayerRendererChromium::bindCommonAttribLocations(ShaderProgramType program)
 {
     unsigned programId = m_shaderPrograms[program].m_shaderProgramId;
diff --git a/WebCore/platform/graphics/chromium/LayerRendererChromium.h b/WebCore/platform/graphics/chromium/LayerRendererChromium.h
index dc7ea70..3b89dc6 100644
--- a/WebCore/platform/graphics/chromium/LayerRendererChromium.h
+++ b/WebCore/platform/graphics/chromium/LayerRendererChromium.h
@@ -45,7 +45,6 @@
 namespace WebCore {
 
 class GLES2Context;
-class Page;
 
 class ShaderProgram {
 public:
@@ -60,9 +59,9 @@ public:
 // Class that handles drawing of composited render layers using GL.
 class LayerRendererChromium : public Noncopyable {
 public:
-    static PassOwnPtr<LayerRendererChromium> create(Page* page);
+    static PassOwnPtr<LayerRendererChromium> create(PassOwnPtr<GLES2Context> gles2Context);
 
-    LayerRendererChromium(Page* page);
+    LayerRendererChromium(PassOwnPtr<GLES2Context> gles2Context);
     ~LayerRendererChromium();
 
     // Updates the contents of the root layer that fall inside the updateRect and recomposites
@@ -105,7 +104,6 @@ private:
     enum VboIds { Vertices, LayerElements };
 
     // These are here only temporarily and should be removed once we switch over to GGL
-    bool initGL();
     bool makeContextCurrent();
 
     bool initializeSharedGLObjects();
@@ -151,9 +149,6 @@ private:
     IntSize m_rootLayerCanvasSize;
 
     OwnPtr<GLES2Context> m_gles2Context;
-
-    // The WebCore Page that the compositor renders into.
-    Page* m_page;
 };
 
 }
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index b0fd32f..f85c3f9 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,35 @@
+2010-07-14  James Robinson  <jamesr at chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        Breaks all dependencies on Page from platform/ and cleans up GLES2Context lifetime
+        https://bugs.webkit.org/show_bug.cgi?id=42203
+
+        Rather than constructing a GLES2Context from a Page, pass the LayerRendererChromium
+        a GLES2Context in from the constructor.  This way the platform/ directory can remain
+        ignorant of Page and friends.  Also adds functions on ChromeClientChromium to request
+        onscreen and offscreen GLES2Contexts for callers in WebCore that need them. 
+
+        * WebKit.gyp:
+        * src/ChromeClientImpl.cpp:
+        (WebKit::ChromeClientImpl::getOnscreenGLES2Context):
+        (WebKit::ChromeClientImpl::getOffscreenGLES2Context):
+        * src/ChromeClientImpl.h:
+        * src/GLES2Context.cpp:
+        (WebCore::GLES2ContextInternal::create):
+        (WebCore::GLES2Context::create):
+        (WebCore::GLES2Context::GLES2Context):
+        * src/GLES2ContextInternal.cpp: Added.
+        (WebCore::GLES2ContextInternal::~GLES2ContextInternal):
+        * src/GLES2ContextInternal.h: Added.
+        (WebCore::GLES2ContextInternal::getWebGLES2Context):
+        (WebCore::GLES2ContextInternal::GLES2ContextInternal):
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+        (WebKit::WebViewImpl::getOnscreenGLES2Context):
+        (WebKit::WebViewImpl::getOffscreenGLES2Context):
+        * src/WebViewImpl.h:
+
 2010-07-14  James Hawkins  <jhawkins at chromium.org>
 
         Reviewed by Darin Fisher.
diff --git a/WebKit/chromium/WebKit.gyp b/WebKit/chromium/WebKit.gyp
index cdd602a..7198f37 100644
--- a/WebKit/chromium/WebKit.gyp
+++ b/WebKit/chromium/WebKit.gyp
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2009 Google Inc. All rights reserved.
+# Copyright (C) 2010 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
@@ -300,6 +300,8 @@
                 'src/FrameLoaderClientImpl.cpp',
                 'src/FrameLoaderClientImpl.h',
                 'src/GLES2Context.cpp',
+                'src/GLES2ContextInternal.cpp',
+                'src/GLES2ContextInternal.h',
                 'src/gtk/WebFontInfo.cpp',
                 'src/gtk/WebFontInfo.h',
                 'src/gtk/WebInputEventFactory.cpp',
diff --git a/WebKit/chromium/src/ChromeClientImpl.cpp b/WebKit/chromium/src/ChromeClientImpl.cpp
index 54c81aa..a4dc10b 100644
--- a/WebKit/chromium/src/ChromeClientImpl.cpp
+++ b/WebKit/chromium/src/ChromeClientImpl.cpp
@@ -31,8 +31,8 @@
 #include "config.h"
 #include "ChromeClientImpl.h"
 
-#include "AccessibilityObject.h"
 #include "AXObjectCache.h"
+#include "AccessibilityObject.h"
 #include "CharacterNames.h"
 #include "Console.h"
 #include "Cursor.h"
@@ -43,9 +43,9 @@
 #include "FloatRect.h"
 #include "FrameLoadRequest.h"
 #include "FrameView.h"
+#include "GLES2Context.h"
 #include "Geolocation.h"
 #include "GeolocationService.h"
-#include "WebGeolocationService.h"
 #include "GeolocationServiceChromium.h"
 #include "GraphicsLayer.h"
 #include "HTMLNames.h"
@@ -56,6 +56,7 @@
 #include "Page.h"
 #include "PopupMenuChromium.h"
 #include "ScriptController.h"
+#include "WebGeolocationService.h"
 #if USE(V8)
 #include "V8Proxy.h"
 #endif
@@ -728,6 +729,16 @@ void ChromeClientImpl::scheduleCompositingLayerSync()
 {
     m_webView->setRootLayerNeedsDisplay();
 }
+
+PassOwnPtr<GLES2Context> ChromeClientImpl::getOnscreenGLES2Context()
+{
+    return m_webView->getOnscreenGLES2Context();
+}
+
+PassOwnPtr<GLES2Context> ChromeClientImpl::getOffscreenGLES2Context()
+{
+    return m_webView->getOffscreenGLES2Context();
+}
 #endif
 
 bool ChromeClientImpl::supportsFullscreenForNode(const WebCore::Node* node)
diff --git a/WebKit/chromium/src/ChromeClientImpl.h b/WebKit/chromium/src/ChromeClientImpl.h
index fa3dbca..e824381 100644
--- a/WebKit/chromium/src/ChromeClientImpl.h
+++ b/WebKit/chromium/src/ChromeClientImpl.h
@@ -145,7 +145,11 @@ public:
     // Sets a flag to specify that the view needs to be updated, so we need
     // to do an eager layout before the drawing.
     virtual void scheduleCompositingLayerSync();
+
+    virtual PassOwnPtr<WebCore::GLES2Context> getOnscreenGLES2Context();
+    virtual PassOwnPtr<WebCore::GLES2Context> getOffscreenGLES2Context();
 #endif
+
     virtual bool supportsFullscreenForNode(const WebCore::Node*);
     virtual void enterFullscreenForNode(WebCore::Node*);
     virtual void exitFullscreenForNode(WebCore::Node*);
diff --git a/WebKit/chromium/src/GLES2Context.cpp b/WebKit/chromium/src/GLES2Context.cpp
index f342436..b4b4bb2 100644
--- a/WebKit/chromium/src/GLES2Context.cpp
+++ b/WebKit/chromium/src/GLES2Context.cpp
@@ -31,6 +31,7 @@
 #include "config.h"
 
 #include "GLES2Context.h"
+#include "GLES2ContextInternal.h"
 #include "IntSize.h"
 #include "WebGLES2Context.h"
 #include "WebKit.h"
@@ -52,68 +53,23 @@ using namespace WebKit;
 
 namespace WebCore {
 
-class GLES2ContextInternal {
-public:
-    GLES2ContextInternal() {}
-    ~GLES2ContextInternal() {}
-
-    bool initializeOnscreen(Page*);
-    bool initializeOffscreen(GLES2Context*);
-
-    WebGLES2Context* getWebGLES2Context() { return m_impl; }
-
-private:
-    WebGLES2Context* m_impl;
-};
-
-bool GLES2ContextInternal::initializeOnscreen(Page* page)
+PassOwnPtr<GLES2ContextInternal> GLES2ContextInternal::create(WebGLES2Context* impl, bool owns)
 {
-    ASSERT(page);
-    WebViewImpl* webView = WebViewImpl::fromPage(page);
-    m_impl = webView->gles2Context();
-    if (!m_impl)
-        return false;
-
-    return true;
-}
-
-bool GLES2ContextInternal::initializeOffscreen(GLES2Context* parent)
-{
-    m_impl = webKitClient()->createGLES2Context();
-    if (!m_impl)
-        return false;
-    if (!m_impl->initialize(0, parent ? parent->m_internal->m_impl : 0)) {
-        delete m_impl;
-        return false;
-    }
-    return true;
+    PassOwnPtr<GLES2ContextInternal> result = new GLES2ContextInternal(impl, owns);
+    return result;
 }
 
-PassOwnPtr<GLES2Context> GLES2Context::createOnscreen(Page* page)
+PassOwnPtr<GLES2Context> GLES2Context::create(PassOwnPtr<GLES2ContextInternal> internal)
 {
-    GLES2ContextInternal* internal = new GLES2ContextInternal();
-    if (!internal->initializeOnscreen(page)) {
-        delete internal;
-        return 0;
-    }
     PassOwnPtr<GLES2Context> result = new GLES2Context();
-    result->m_internal.set(internal);
+    result->m_internal = internal;
     return result;
 }
 
-PassOwnPtr<GLES2Context> GLES2Context::createOffscreen(GLES2Context* parent)
+GLES2Context::GLES2Context()
 {
-    GLES2ContextInternal* internal = new GLES2ContextInternal();
-    if (!internal->initializeOffscreen(parent)) {
-        delete internal;
-        return 0;
-    }
-    PassOwnPtr<GLES2Context> result = new GLES2Context();
-    result->m_internal.set(internal);
-    return result;
 }
 
-
 GLES2Context::~GLES2Context()
 {
 }
diff --git a/WebKit/chromium/src/GLES2ContextInternal.cpp b/WebKit/chromium/src/GLES2ContextInternal.cpp
new file mode 100644
index 0000000..33eb602
--- /dev/null
+++ b/WebKit/chromium/src/GLES2ContextInternal.cpp
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2010 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "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 THE COPYRIGHT
+ * OWNER 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 "config.h"
+
+#include "GLES2ContextInternal.h"
+
+#include "WebGLES2Context.h"
+
+namespace WebCore {
+
+GLES2ContextInternal::GLES2ContextInternal(WebKit::WebGLES2Context* impl, bool owns)
+    : m_impl(impl)
+    , m_owns(owns)
+{
+}
+
+GLES2ContextInternal::~GLES2ContextInternal()
+{
+    if (m_owns)
+        delete m_impl;
+}
+
+} // namespace WebCore
+
diff --git a/WebKit/chromium/src/GLES2ContextInternal.h b/WebKit/chromium/src/GLES2ContextInternal.h
new file mode 100644
index 0000000..7840050
--- /dev/null
+++ b/WebKit/chromium/src/GLES2ContextInternal.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2010 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "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 THE COPYRIGHT
+ * OWNER 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 <wtf/PassOwnPtr.h>
+
+namespace WebKit {
+class WebGLES2Context;
+}
+
+namespace WebCore {
+
+class GLES2ContextInternal {
+public:
+    // If 'owns' is set to true, this GLES2ContextInternal takes ownership of the passed in WebKit::WebGLES2Context.
+    static PassOwnPtr<GLES2ContextInternal> create(WebKit::WebGLES2Context* impl, bool owns);
+
+    WebKit::WebGLES2Context* getWebGLES2Context() { return m_impl; }
+
+    ~GLES2ContextInternal();
+
+private:
+    GLES2ContextInternal(WebKit::WebGLES2Context* impl, bool owns);
+
+    bool m_owns;
+    WebKit::WebGLES2Context* m_impl;
+};
+
+}
diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp
index 5a1cfc2..251fd04 100644
--- a/WebKit/chromium/src/WebViewImpl.cpp
+++ b/WebKit/chromium/src/WebViewImpl.cpp
@@ -54,10 +54,12 @@
 #include "FrameLoader.h"
 #include "FrameTree.h"
 #include "FrameView.h"
+#include "GLES2Context.h"
+#include "GLES2ContextInternal.h"
 #include "GraphicsContext.h"
-#include "HitTestResult.h"
 #include "HTMLInputElement.h"
 #include "HTMLMediaElement.h"
+#include "HitTestResult.h"
 #include "HTMLNames.h"
 #include "Image.h"
 #include "InspectorController.h"
@@ -2072,7 +2074,7 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
         return;
 
     if (active) {
-        m_layerRenderer = LayerRendererChromium::create(page());
+        m_layerRenderer = LayerRendererChromium::create(getOnscreenGLES2Context());
         if (m_layerRenderer->hardwareCompositing())
             m_isAcceleratedCompositingActive = true;
         else {
@@ -2146,6 +2148,18 @@ void WebViewImpl::setRootLayerNeedsDisplay()
 }
 #endif // USE(ACCELERATED_COMPOSITING)
 
+PassOwnPtr<GLES2Context> WebViewImpl::getOnscreenGLES2Context()
+{
+    return GLES2Context::create(GLES2ContextInternal::create(gles2Context(), false));
+}
+
+PassOwnPtr<GLES2Context> WebViewImpl::getOffscreenGLES2Context()
+{
+    WebGLES2Context* context = webKitClient()->createGLES2Context();
+    context->initialize(0, gles2Context());
+    return GLES2Context::create(GLES2ContextInternal::create(context, true));
+}
+
 // Returns the GLES2 context associated with this View. If one doesn't exist
 // it will get created first.
 WebGLES2Context* WebViewImpl::gles2Context()
diff --git a/WebKit/chromium/src/WebViewImpl.h b/WebKit/chromium/src/WebViewImpl.h
index c07ceec..312f20f 100644
--- a/WebKit/chromium/src/WebViewImpl.h
+++ b/WebKit/chromium/src/WebViewImpl.h
@@ -53,6 +53,7 @@
 namespace WebCore {
 class ChromiumDataObject;
 class Frame;
+class GLES2Context;
 class HistoryItem;
 class HitTestResult;
 class KeyboardEvent;
@@ -190,7 +191,6 @@ public:
                                     unsigned inactiveBackgroundColor,
                                     unsigned inactiveForegroundColor);
     virtual void performCustomContextMenuAction(unsigned action);
-    virtual WebGLES2Context* gles2Context();
 
     // WebViewImpl
 
@@ -321,6 +321,14 @@ public:
     void setRootLayerNeedsDisplay();
     void setRootGraphicsLayer(WebCore::PlatformLayer*);
 #endif
+    // Onscreen contexts display to the screen associated with this view.
+    // Offscreen contexts render offscreen but can share resources with the
+    // onscreen context and thus can be composited.
+    PassOwnPtr<WebCore::GLES2Context> getOnscreenGLES2Context();
+    PassOwnPtr<WebCore::GLES2Context> getOffscreenGLES2Context();
+
+    // Returns an onscreen context
+    virtual WebGLES2Context* gles2Context();
 
     WebCore::PopupContainer* selectPopup() const { return m_selectPopup.get(); }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list