Title: [141943] trunk/Source
Revision
141943
Author
[email protected]
Date
2013-02-05 15:42:19 -0800 (Tue, 05 Feb 2013)

Log Message

[chromium] Provide compositor offscreen context through the WebLayerTreeViewClient interface
https://bugs.webkit.org/show_bug.cgi?id=107776

Source/Platform:

Make "createGrGLInterface" the preferred virtual method for
WebGraphicsContext3D implementations to override. For now it
just calls the old method in its default implementation.

Reviewed by James Robinson.

* chromium/public/WebGraphicsContext3D.h:
(WebGraphicsContext3D):
(WebKit::WebGraphicsContext3D::createGrGLInterface):

Source/WebCore:

Reviewed by James Robinson.

Allow the compositor thread's context to be retrieved on either thread,
so the main thread can create and pass the context to the impl thread
via its own mechanisms.

Move the code to bind the GrGLInterface to a WebGraphicsContext3D into
chromium's GraphicsContext3DPrivate. The chromium-side code will need
to implement this code itself.

* platform/chromium/support/GraphicsContext3DPrivate.cpp:
(WebCore::GraphicsContext3DPrivate::~GraphicsContext3DPrivate):
(WebCore):
(WebCore::GraphicsContext3DPrivate::grContext):
* platform/chromium/support/GraphicsContext3DPrivate.h:
* platform/graphics/gpu/SharedGraphicsContext3D.cpp:
(WebCore::SharedGraphicsContext3D::getForImplThread):

Source/WebKit/chromium:

Reviewed by James Robinson.

* WebKit.gyp:
* src/WebGraphicsContext3D.cpp: Removed.

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/Platform/ChangeLog (141942 => 141943)


--- trunk/Source/Platform/ChangeLog	2013-02-05 23:40:30 UTC (rev 141942)
+++ trunk/Source/Platform/ChangeLog	2013-02-05 23:42:19 UTC (rev 141943)
@@ -1,3 +1,18 @@
+2013-02-05  Dana Jansens  <[email protected]>
+
+        [chromium] Provide compositor offscreen context through the WebLayerTreeViewClient interface
+        https://bugs.webkit.org/show_bug.cgi?id=107776
+
+        Make "createGrGLInterface" the preferred virtual method for
+        WebGraphicsContext3D implementations to override. For now it
+        just calls the old method in its default implementation.
+
+        Reviewed by James Robinson.
+
+        * chromium/public/WebGraphicsContext3D.h:
+        (WebGraphicsContext3D):
+        (WebKit::WebGraphicsContext3D::createGrGLInterface):
+
 2013-02-05  James Robinson  <[email protected]>
 
         [chromium] Remove optionalness of second parameter to WebLayerTreeView::setViewportSize

Modified: trunk/Source/Platform/chromium/public/WebGraphicsContext3D.h (141942 => 141943)


--- trunk/Source/Platform/chromium/public/WebGraphicsContext3D.h	2013-02-05 23:40:30 UTC (rev 141942)
+++ trunk/Source/Platform/chromium/public/WebGraphicsContext3D.h	2013-02-05 23:42:19 UTC (rev 141943)
@@ -472,7 +472,8 @@
     virtual void asyncTexImage2DCHROMIUM(WGC3Denum target, WGC3Dint level, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border, WGC3Denum format, WGC3Denum type, const void* pixels) { }
     virtual void asyncTexSubImage2DCHROMIUM(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Denum type, const void* pixels) { }
 
-    GrGLInterface* createGrGLInterface();
+    // FIXME: Make implementations of this class override this method instead and then remove onCreateGrGLInterface().
+    virtual GrGLInterface* createGrGLInterface() { return onCreateGrGLInterface(); }
 
 protected:
     virtual GrGLInterface* onCreateGrGLInterface() { return 0; }

Modified: trunk/Source/WebCore/ChangeLog (141942 => 141943)


--- trunk/Source/WebCore/ChangeLog	2013-02-05 23:40:30 UTC (rev 141942)
+++ trunk/Source/WebCore/ChangeLog	2013-02-05 23:42:19 UTC (rev 141943)
@@ -1,3 +1,26 @@
+2013-02-05  Dana Jansens  <[email protected]>
+
+        [chromium] Provide compositor offscreen context through the WebLayerTreeViewClient interface
+        https://bugs.webkit.org/show_bug.cgi?id=107776
+
+        Reviewed by James Robinson.
+
+        Allow the compositor thread's context to be retrieved on either thread,
+        so the main thread can create and pass the context to the impl thread
+        via its own mechanisms.
+
+        Move the code to bind the GrGLInterface to a WebGraphicsContext3D into
+        chromium's GraphicsContext3DPrivate. The chromium-side code will need
+        to implement this code itself.
+
+        * platform/chromium/support/GraphicsContext3DPrivate.cpp:
+        (WebCore::GraphicsContext3DPrivate::~GraphicsContext3DPrivate):
+        (WebCore):
+        (WebCore::GraphicsContext3DPrivate::grContext):
+        * platform/chromium/support/GraphicsContext3DPrivate.h:
+        * platform/graphics/gpu/SharedGraphicsContext3D.cpp:
+        (WebCore::SharedGraphicsContext3D::getForImplThread):
+
 2013-02-05  Tony Gentilcore  <[email protected]>
 
         Continue making XSSAuditor thread safe: Remove dependency on the parser's tokenizer

Modified: trunk/Source/WebCore/platform/chromium/support/GraphicsContext3DPrivate.cpp (141942 => 141943)


--- trunk/Source/WebCore/platform/chromium/support/GraphicsContext3DPrivate.cpp	2013-02-05 23:40:30 UTC (rev 141942)
+++ trunk/Source/WebCore/platform/chromium/support/GraphicsContext3DPrivate.cpp	2013-02-05 23:42:19 UTC (rev 141943)
@@ -71,7 +71,6 @@
     if (m_grContext) {
         m_impl->setMemoryAllocationChangedCallbackCHROMIUM(0);
         m_grContext->contextDestroyed();
-        GrSafeUnref(m_grContext);
     }
 }
 
@@ -114,17 +113,33 @@
     GrContext* m_context;
 };
 
+namespace {
+void bindWebGraphicsContext3DGLContextCallback(const GrGLInterface* interface)
+{
+    reinterpret_cast<WebKit::WebGraphicsContext3D*>(interface->fCallbackData)->makeContextCurrent();
+}
+}
+
 GrContext* GraphicsContext3DPrivate::grContext()
 {
-    if (!m_grContext) {
-        SkAutoTUnref<GrGLInterface> interface(m_impl->createGrGLInterface());
-        m_grContext = GrContext::Create(kOpenGL_Shaders_GrEngine, reinterpret_cast<GrPlatform3DContext>(interface.get()));
-        if (m_grContext) {
-            m_grContext->setTextureCacheLimits(maxGaneshTextureCacheCount, maxGaneshTextureCacheBytes);
-            m_grContextMemoryAllocationCallbackAdapter = adoptPtr(new GrMemoryAllocationChangedCallbackAdapter(m_grContext));
-            m_impl->setMemoryAllocationChangedCallbackCHROMIUM(m_grContextMemoryAllocationCallbackAdapter.get());
-        }
-    }
+    if (m_grContext)
+        return m_grContext;
+
+    SkAutoTUnref<GrGLInterface> interface(m_impl->createGrGLInterface());
+    if (!interface)
+        return 0;
+
+    interface->fCallback = bindWebGraphicsContext3DGLContextCallback;
+    interface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(m_impl.get());
+
+    m_grContext.reset(GrContext::Create(kOpenGL_Shaders_GrEngine, reinterpret_cast<GrPlatform3DContext>(interface.get())));
+    if (!m_grContext)
+        return 0;
+
+    m_grContext->setTextureCacheLimits(maxGaneshTextureCacheCount, maxGaneshTextureCacheBytes);
+    m_grContextMemoryAllocationCallbackAdapter = adoptPtr(new GrMemoryAllocationChangedCallbackAdapter(m_grContext));
+    m_impl->setMemoryAllocationChangedCallbackCHROMIUM(m_grContextMemoryAllocationCallbackAdapter.get());
+
     return m_grContext;
 }
 

Modified: trunk/Source/WebCore/platform/chromium/support/GraphicsContext3DPrivate.h (141942 => 141943)


--- trunk/Source/WebCore/platform/chromium/support/GraphicsContext3DPrivate.h	2013-02-05 23:40:30 UTC (rev 141942)
+++ trunk/Source/WebCore/platform/chromium/support/GraphicsContext3DPrivate.h	2013-02-05 23:42:19 UTC (rev 141943)
@@ -114,7 +114,7 @@
     // used to resize the Canvas.
     SkBitmap m_resizingBitmap;
 
-    GrContext* m_grContext;
+    SkAutoTUnref<GrContext> m_grContext;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp (141942 => 141943)


--- trunk/Source/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp	2013-02-05 23:40:30 UTC (rev 141942)
+++ trunk/Source/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp	2013-02-05 23:42:19 UTC (rev 141943)
@@ -95,7 +95,6 @@
 
 PassRefPtr<GraphicsContext3D> SharedGraphicsContext3D::getForImplThread()
 {
-    ASSERT(!isMainThread());
     return getOrCreateContextForImplThread(Get);
 }
 

Modified: trunk/Source/WebKit/chromium/ChangeLog (141942 => 141943)


--- trunk/Source/WebKit/chromium/ChangeLog	2013-02-05 23:40:30 UTC (rev 141942)
+++ trunk/Source/WebKit/chromium/ChangeLog	2013-02-05 23:42:19 UTC (rev 141943)
@@ -1,3 +1,13 @@
+2013-02-05  Dana Jansens  <[email protected]>
+
+        [chromium] Provide compositor offscreen context through the WebLayerTreeViewClient interface
+        https://bugs.webkit.org/show_bug.cgi?id=107776
+
+        Reviewed by James Robinson.
+
+        * WebKit.gyp:
+        * src/WebGraphicsContext3D.cpp: Removed.
+
 2013-02-05  Mark Lam  <[email protected]>
 
         Introduced back-end database classes + a few small fixes.

Modified: trunk/Source/WebKit/chromium/WebKit.gyp (141942 => 141943)


--- trunk/Source/WebKit/chromium/WebKit.gyp	2013-02-05 23:40:30 UTC (rev 141942)
+++ trunk/Source/WebKit/chromium/WebKit.gyp	2013-02-05 23:42:19 UTC (rev 141943)
@@ -488,7 +488,6 @@
                 'src/WebGeolocationPermissionRequestManager.cpp',
                 'src/WebGeolocationPosition.cpp',
                 'src/WebGlyphCache.cpp',
-                'src/WebGraphicsContext3D.cpp',
                 'src/WebHistoryItem.cpp',
                 'src/WebHitTestResult.cpp',
                 'src/WebIconLoadingCompletionImpl.cpp',

Deleted: trunk/Source/WebKit/chromium/src/WebGraphicsContext3D.cpp (141942 => 141943)


--- trunk/Source/WebKit/chromium/src/WebGraphicsContext3D.cpp	2013-02-05 23:40:30 UTC (rev 141942)
+++ trunk/Source/WebKit/chromium/src/WebGraphicsContext3D.cpp	2013-02-05 23:42:19 UTC (rev 141943)
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2011 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 AND ITS 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 APPLE OR ITS 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 <public/WebGraphicsContext3D.h>
-
-#include "GrGLInterface.h"
-
-namespace WebKit {
-
-namespace {
-    void bindWebGraphicsContext3DGLContextCallback(const GrGLInterface* interface)
-    {
-        reinterpret_cast<WebGraphicsContext3D*>(interface->fCallbackData)->makeContextCurrent();
-    }
-}
-
-GrGLInterface* WebGraphicsContext3D::createGrGLInterface()
-{
-    GrGLInterface* interface = onCreateGrGLInterface();
-    if (interface) {
-        interface->fCallback = bindWebGraphicsContext3DGLContextCallback;
-        interface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(this);
-    }
-    return interface;
-}
-
-} // namespace WebKit
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to