Title: [110325] trunk/Source/WebKit/chromium
Revision
110325
Author
[email protected]
Date
2012-03-09 13:32:04 -0800 (Fri, 09 Mar 2012)

Log Message

[chromium] Expose the shared graphics context on WebView so callers can allocate resources on the main thread for the compositor to use
https://bugs.webkit.org/show_bug.cgi?id=80670

Reviewed by Stephen White.

This exposes a context on WebView that is in the compositor's share group and can be used directly from the main
thread. This is useful for content that needs to allocate resources for the compositor to use, but cannot
directly use the compositor's context either because it cannot access the correct thread or because it needs to
initialize in situations where we cannot initialize a compositor (view) context - for instance before the native
window is created.

* public/WebView.h:
(WebView):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::sharedGraphicsContext3D):
(WebKit):
* src/WebViewImpl.h:
(WebViewImpl):

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (110324 => 110325)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-03-09 21:14:59 UTC (rev 110324)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-03-09 21:32:04 UTC (rev 110325)
@@ -1,3 +1,24 @@
+2012-03-08  James Robinson  <[email protected]>
+
+        [chromium] Expose the shared graphics context on WebView so callers can allocate resources on the main thread for the compositor to use
+        https://bugs.webkit.org/show_bug.cgi?id=80670
+
+        Reviewed by Stephen White.
+
+        This exposes a context on WebView that is in the compositor's share group and can be used directly from the main
+        thread. This is useful for content that needs to allocate resources for the compositor to use, but cannot
+        directly use the compositor's context either because it cannot access the correct thread or because it needs to
+        initialize in situations where we cannot initialize a compositor (view) context - for instance before the native
+        window is created.
+
+        * public/WebView.h:
+        (WebView):
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::sharedGraphicsContext3D):
+        (WebKit):
+        * src/WebViewImpl.h:
+        (WebViewImpl):
+
 2012-03-09  Dana Jansens  <[email protected]>
 
         [chromium] Use opaque paints in CCOcclusionTracker

Modified: trunk/Source/WebKit/chromium/public/WebView.h (110324 => 110325)


--- trunk/Source/WebKit/chromium/public/WebView.h	2012-03-09 21:14:59 UTC (rev 110324)
+++ trunk/Source/WebKit/chromium/public/WebView.h	2012-03-09 21:32:04 UTC (rev 110325)
@@ -430,6 +430,10 @@
     // APIs.
     virtual WebGraphicsContext3D* graphicsContext3D() = 0;
 
+    // Context that's in the compositor's share group, but is not the compositor context itself.
+    // Can be used for allocating resources that the compositor will later access.
+    virtual WebGraphicsContext3D* sharedGraphicsContext3D() = 0;
+
     // Visibility -----------------------------------------------------------
 
     // Sets the visibility of the WebView.

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (110324 => 110325)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-03-09 21:14:59 UTC (rev 110324)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-03-09 21:32:04 UTC (rev 110325)
@@ -104,6 +104,7 @@
 #include "SecurityOrigin.h"
 #include "SecurityPolicy.h"
 #include "Settings.h"
+#include "SharedGraphicsContext3D.h"
 #include "SpeechInputClientImpl.h"
 #include "TextIterator.h"
 #include "Timer.h"
@@ -3337,6 +3338,14 @@
     return 0;
 }
 
+WebGraphicsContext3D* WebViewImpl::sharedGraphicsContext3D()
+{
+    if (!m_page->settings()->acceleratedCompositingEnabled() || !allowsAcceleratedCompositing())
+        return 0;
+
+    return GraphicsContext3DPrivate::extractWebGraphicsContext3D(SharedGraphicsContext3D::get());
+}
+
 void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState,
                                      bool isInitialState) {
     if (!page())

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.h (110324 => 110325)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.h	2012-03-09 21:14:59 UTC (rev 110324)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.h	2012-03-09 21:32:04 UTC (rev 110325)
@@ -457,6 +457,8 @@
     // we could not successfully instantiate a context.
     virtual WebGraphicsContext3D* graphicsContext3D();
 
+    virtual WebGraphicsContext3D* sharedGraphicsContext3D();
+
     PassOwnPtr<WebGraphicsContext3D> createCompositorGraphicsContext3D();
 
     virtual void setVisibilityState(WebPageVisibilityState, bool);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to