Changeset 125212 in webkit


Ignore:
Timestamp:
Aug 9, 2012, 3:24:52 PM (13 years ago)
Author:
nduca@chromium.org
Message:

[chromium] Expose CCGraphicsContext as WebCompositorOutputSurface
https://bugs.webkit.org/show_bug.cgi?id=92890

Reviewed by James Robinson.

Source/Platform:

The CCGraphicsContext was introduced as a wrapper around the 2D
and 3D output for the compositor. However, it is a CC only
concept. We want to be able to make 2D and ubercomp-mode IPCs on
behalf of the compositor. This patch allows this by pushing this
abstraction out to the Chrome-visible layer of the compositor,
changing the name to OutputSurface based on discussions on
wkb.ug/90736. A future patch will rename the CCGraphicsContext to
CCOutputSurface.

  • Platform.gypi:
  • chromium/public/WebCompositorOutputSurface.h: Added.

(WebKit):
(WebCompositorOutputSurface):
(WebKit::WebCompositorOutputSurface::~WebCompositorOutputSurface):
(WebKit::WebCompositorOutputSurface::Capabilities::Capabilities):
(Capabilities):

  • chromium/public/WebCompositorOutputSurfaceClient.h: Added.

(WebKit):
(WebCompositorOutputSurfaceClient):
(WebKit::WebCompositorOutputSurfaceClient::~WebCompositorOutputSurfaceClient):

  • chromium/public/WebLayerTreeView.h:

(WebKit::WebLayerTreeView::Settings::Settings):
(Settings):

  • chromium/public/WebLayerTreeViewClient.h:

(WebKit):
(WebLayerTreeViewClient):
(WebKit::WebLayerTreeViewClient::createContext3D):
(WebKit::WebLayerTreeViewClient::createOutputSurface):

Source/WebCore:

  • platform/graphics/chromium/cc/CCGraphicsContext.h:

(WebCore):

  • platform/graphics/chromium/cc/CCLayerTreeHost.cpp:

(WebCore::CCLayerTreeHost::initializeLayerRenderer):
(WebCore::CCLayerTreeHost::recreateContext):
(WebCore::CCLayerTreeHost::createContext):

  • platform/graphics/chromium/cc/CCLayerTreeHost.h:

(WebCore):
(CCLayerTreeHostClient):
(WebCore::CCLayerTreeSettings::CCLayerTreeSettings):
(CCLayerTreeSettings):

  • platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:

(WebCore::CCLayerTreeHostImpl::onVSyncParametersChanged):
(WebCore):
(WebCore::CCLayerTreeHostImpl::initializeLayerRenderer):

  • platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:

(CCLayerTreeHostImplClient):

  • platform/graphics/chromium/cc/CCProxy.h:

(WebKit):
(WebCore):

  • platform/graphics/chromium/cc/CCRenderer.h:

(CCRendererClient):
(WebCore::CCRendererClient::~CCRendererClient):

  • platform/graphics/chromium/cc/CCResourceProvider.cpp:
  • platform/graphics/chromium/cc/CCResourceProvider.h:
  • platform/graphics/chromium/cc/CCSingleThreadProxy.h:
  • platform/graphics/chromium/cc/CCThreadProxy.cpp:

(WebCore::CCThreadProxy::recreateContext):
(WebCore::CCThreadProxy::onVSyncParametersChanged):
(WebCore):
(WebCore::CCThreadProxy::beginFrame):

  • platform/graphics/chromium/cc/CCThreadProxy.h:

Source/WebKit/chromium:

  • WebKit.gyp:
  • WebKit.gypi:
  • public/WebSettings.h:
  • public/WebViewClient.h:

(WebKit):
(WebViewClient):
(WebKit::WebViewClient::createOutputSurface):

  • src/WebLayerTreeView.cpp:

(WebKit::WebLayerTreeView::Settings::operator CCLayerTreeSettings):

  • src/WebLayerTreeViewImpl.cpp:

(WebKit):
(WebGraphicsContextToOutputSurfaceAdapter):
(WebKit::WebGraphicsContextToOutputSurfaceAdapter::WebGraphicsContextToOutputSurfaceAdapter):
(WebKit::WebLayerTreeViewClientAdapter::WebLayerTreeViewClientAdapter):

  • src/WebSettingsImpl.cpp:

(WebKit::WebSettingsImpl::WebSettingsImpl):

  • src/WebSettingsImpl.h:

(WebSettingsImpl):

  • src/WebViewImpl.cpp:

(WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
(WebKit::WebViewImpl::createOutputSurface):
(WebKit):
(WebKit::WebViewImpl::didRebindGraphicsContext):
(WebKit::WebViewImpl::didRebindOutputSurface):

  • src/WebViewImpl.h:

(WebViewImpl):

  • tests/CCLayerTreeHostImplTest.cpp:
  • tests/CCLayerTreeHostTest.cpp:

(WTF):
(WTF::CCLayerTreeHostTestSetSingleLostContext::didRecreateOutputSurface):
(WTF::CCLayerTreeHostTestSetRepeatedLostContext::didRecreateOutputSurface):

  • tests/CCResourceProviderTest.cpp:

(WebKit::CCResourceProviderTest::CCResourceProviderTest):

  • tests/CCTextureUpdateControllerTest.cpp:
  • tests/CCThreadedTest.cpp:

(WebKitTests::TestHooks::createOutputSurface):

  • tests/CCThreadedTest.h:

(WebKitTests::TestHooks::didRecreateOutputSurface):

  • tests/Canvas2DLayerBridgeTest.cpp:

(Canvas2DLayerBridgeTest::fullLifecycleTest):

  • tests/FakeCCGraphicsContext.h:

(WebKit::createFakeCCGraphicsContext):

  • tests/FakeCCLayerTreeHostClient.h:
  • tests/FakeWebCompositorOutputSurface.h: Copied from Source/WebCore/platform/graphics/chromium/cc/CCGraphicsContext.h.

(WebKit):
(FakeWebCompositorOutputSurface):
(WebKit::FakeWebCompositorOutputSurface::create):
(WebKit::FakeWebCompositorOutputSurface::FakeWebCompositorOutputSurface):

  • tests/LayerRendererChromiumTest.cpp:

(LayerRendererChromiumTest::LayerRendererChromiumTest):
(TEST):

  • tests/WebLayerTest.cpp:
  • tests/WebLayerTreeViewTest.cpp:
Location:
trunk/Source
Files:
1 added
40 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/Platform/ChangeLog

    r125130 r125212  
     12012-08-06  Nat Duca  <nduca@chromium.org>
     2
     3        [chromium] Expose CCGraphicsContext as WebCompositorOutputSurface
     4        https://bugs.webkit.org/show_bug.cgi?id=92890
     5
     6        Reviewed by James Robinson.
     7
     8        The CCGraphicsContext was introduced as a wrapper around the 2D
     9        and 3D output for the compositor. However, it is a CC only
     10        concept. We want to be able to make 2D and ubercomp-mode IPCs on
     11        behalf of the compositor. This patch allows this by pushing this
     12        abstraction out to the Chrome-visible layer of the compositor,
     13        changing the name to OutputSurface based on discussions on
     14        wkb.ug/90736. A future patch will rename the CCGraphicsContext to
     15        CCOutputSurface.
     16
     17        * Platform.gypi:
     18        * chromium/public/WebCompositorOutputSurface.h: Added.
     19        (WebKit):
     20        (WebCompositorOutputSurface):
     21        (WebKit::WebCompositorOutputSurface::~WebCompositorOutputSurface):
     22        (WebKit::WebCompositorOutputSurface::Capabilities::Capabilities):
     23        (Capabilities):
     24        * chromium/public/WebCompositorOutputSurfaceClient.h: Added.
     25        (WebKit):
     26        (WebCompositorOutputSurfaceClient):
     27        (WebKit::WebCompositorOutputSurfaceClient::~WebCompositorOutputSurfaceClient):
     28        * chromium/public/WebLayerTreeView.h:
     29        (WebKit::WebLayerTreeView::Settings::Settings):
     30        (Settings):
     31        * chromium/public/WebLayerTreeViewClient.h:
     32        (WebKit):
     33        (WebLayerTreeViewClient):
     34        (WebKit::WebLayerTreeViewClient::createContext3D):
     35        (WebKit::WebLayerTreeViewClient::createOutputSurface):
     36
    1372012-08-08  Adrienne Walker  <enne@google.com>
    238
  • trunk/Source/Platform/Platform.gypi

    r125061 r125212  
    4545            'chromium/public/WebColor.h',
    4646            'chromium/public/WebCommon.h',
     47            'chromium/public/WebCompositorOutputSurface.h',
     48            'chromium/public/WebCompositorOutputSurfaceClient.h',
    4749            'chromium/public/WebContentLayer.h',
    4850            'chromium/public/WebContentLayerClient.h',
  • trunk/Source/Platform/chromium/public/WebCompositorOutputSurfaceClient.h

    r125211 r125212  
    2424 */
    2525
    26 #ifndef FakeCCGraphicsContext_h
    27 #define FakeCCGraphicsContext_h
    28 
    29 #include "CompositorFakeWebGraphicsContext3D.h"
    30 #include "cc/CCGraphicsContext.h"
     26#ifndef WebCompositorOutputSurfaceClient_h
     27#define WebCompositorOutputSurfaceClient_h
    3128
    3229namespace WebKit {
    3330
    34 static inline PassOwnPtr<WebCore::CCGraphicsContext> createFakeCCGraphicsContext()
    35 {
    36     return WebCore::CCGraphicsContext::create3D(CompositorFakeWebGraphicsContext3D::create(WebGraphicsContext3D::Attributes()));
     31class WebCompositorOutputSurfaceClient {
     32public:
     33    virtual void onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) = 0;
     34
     35protected:
     36    ~WebCompositorOutputSurfaceClient() { }
     37};
     38
    3739}
    3840
    39 } // namespace WebKit
    40 
    41 #endif // FakeCCGraphicsContext_h
     41#endif
  • trunk/Source/Platform/chromium/public/WebLayerTreeView.h

    r124543 r125212  
    5353        Settings()
    5454            : acceleratePainting(false)
    55             , forceSoftwareCompositing(false)
    5655            , showFPSCounter(false)
    5756            , showPlatformLayerTree(false)
     
    6564
    6665        bool acceleratePainting;
    67         bool forceSoftwareCompositing;
    6866        bool showFPSCounter;
    6967        bool showPlatformLayerTree;
     
    7371        WebSize defaultTileSize;
    7472        WebSize maxUntiledLayerSize;
     73
    7574#if WEBKIT_IMPLEMENTATION
    7675        operator WebCore::CCLayerTreeSettings() const;
  • trunk/Source/Platform/chromium/public/WebLayerTreeViewClient.h

    r118513 r125212  
    2828
    2929namespace WebKit {
    30 class WebGraphicsContext3D;
     30class WebCompositorOutputSurface;
    3131struct WebSize;
    3232class WebThread;
     
    5656    virtual void applyScrollAndScale(const WebSize& scrollDelta, float scaleFactor) = 0;
    5757
    58     // Creates a 3D context suitable for the compositing. This may be called
    59     // more than once if the context gets lost.
    60     virtual WebGraphicsContext3D* createContext3D() = 0;
     58    // DEPRECATED: Creates a 3D context suitable for the compositing. This may be called
     59    // more than once if the context gets lost. This will be removed once
     60    // downstream dependencies have been removed.
     61    virtual WebGraphicsContext3D* createContext3D() { return 0; }
    6162
    62     // Signals a successful rebinding of the 3D context (e.g. after a lost
     63    // DEPRECATED: Signals a successful rebinding of the 3D context (e.g. after a lost
    6364    // context event).
    64     virtual void didRebindGraphicsContext(bool success) = 0;
     65    virtual void didRebindGraphicsContext(bool) { return; }
     66
     67    // Creates the output surface. This may be called more than once
     68    // if the context gets lost.
     69    virtual WebCompositorOutputSurface* createOutputSurface() { return 0; }
     70
     71    // Signals a successful recreation of the output surface (e.g. after a lost
     72    // 3D context event).
     73    virtual void didRecreateOutputSurface(bool success) { }
    6574
    6675    // Indicates that a frame will be committed to the impl side of the compositor
  • trunk/Source/WebCore/ChangeLog

    r125205 r125212  
     12012-08-06  Nat Duca  <nduca@chromium.org>
     2
     3        [chromium] Expose CCGraphicsContext as WebCompositorOutputSurface
     4        https://bugs.webkit.org/show_bug.cgi?id=92890
     5
     6        Reviewed by James Robinson.
     7
     8        * platform/graphics/chromium/cc/CCGraphicsContext.h:
     9        (WebCore):
     10        * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
     11        (WebCore::CCLayerTreeHost::initializeLayerRenderer):
     12        (WebCore::CCLayerTreeHost::recreateContext):
     13        (WebCore::CCLayerTreeHost::createContext):
     14        * platform/graphics/chromium/cc/CCLayerTreeHost.h:
     15        (WebCore):
     16        (CCLayerTreeHostClient):
     17        (WebCore::CCLayerTreeSettings::CCLayerTreeSettings):
     18        (CCLayerTreeSettings):
     19        * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
     20        (WebCore::CCLayerTreeHostImpl::onVSyncParametersChanged):
     21        (WebCore):
     22        (WebCore::CCLayerTreeHostImpl::initializeLayerRenderer):
     23        * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:
     24        (CCLayerTreeHostImplClient):
     25        * platform/graphics/chromium/cc/CCProxy.h:
     26        (WebKit):
     27        (WebCore):
     28        * platform/graphics/chromium/cc/CCRenderer.h:
     29        (CCRendererClient):
     30        (WebCore::CCRendererClient::~CCRendererClient):
     31        * platform/graphics/chromium/cc/CCResourceProvider.cpp:
     32        * platform/graphics/chromium/cc/CCResourceProvider.h:
     33        * platform/graphics/chromium/cc/CCSingleThreadProxy.h:
     34        * platform/graphics/chromium/cc/CCThreadProxy.cpp:
     35        (WebCore::CCThreadProxy::recreateContext):
     36        (WebCore::CCThreadProxy::onVSyncParametersChanged):
     37        (WebCore):
     38        (WebCore::CCThreadProxy::beginFrame):
     39        * platform/graphics/chromium/cc/CCThreadProxy.h:
     40
    1412012-08-09  Bruno de Oliveira Abinader  <bruno.abinader@basyskom.com>
    242
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCGraphicsContext.h

    r123416 r125212  
    2727#define CCGraphicsContext_h
    2828
     29#include <public/WebCompositorOutputSurface.h>
    2930#include <public/WebGraphicsContext3D.h>
    3031#include <wtf/Noncopyable.h>
     
    3435namespace WebCore {
    3536
    36 
    37 class CCGraphicsContext {
    38     WTF_MAKE_NONCOPYABLE(CCGraphicsContext);
    39 public:
    40     static PassOwnPtr<CCGraphicsContext> create2D()
    41     {
    42         return adoptPtr(new CCGraphicsContext());
    43     }
    44     static PassOwnPtr<CCGraphicsContext> create3D(PassOwnPtr<WebKit::WebGraphicsContext3D> context3D)
    45     {
    46         return adoptPtr(new CCGraphicsContext(context3D));
    47     }
    48 
    49     WebKit::WebGraphicsContext3D* context3D() { return m_context3D.get(); }
    50 
    51 private:
    52     CCGraphicsContext() { }
    53     explicit CCGraphicsContext(PassOwnPtr<WebKit::WebGraphicsContext3D> context3D)
    54         : m_context3D(context3D) { }
    55 
    56     OwnPtr<WebKit::WebGraphicsContext3D> m_context3D;
    57 };
     37// FIXME: rename fully to CCOutputSurface.
     38typedef WebKit::WebCompositorOutputSurface CCGraphicsContext;
    5839
    5940}
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp

    r125196 r125212  
    134134    if (!m_proxy->initializeLayerRenderer()) {
    135135        // Uh oh, better tell the client that we can't do anything with this context.
    136         m_client->didRecreateContext(false);
     136        m_client->didRecreateOutputSurface(false);
    137137        return;
    138138    }
     
    167167
    168168    if (recreated) {
    169         m_client->didRecreateContext(true);
     169        m_client->didRecreateOutputSurface(true);
    170170        m_contextLost = false;
    171171        return RecreateSucceeded;
     
    186186    // We have tried too many times to recreate the context. Tell the host to fall
    187187    // back to software rendering.
    188     m_client->didRecreateContext(false);
     188    m_client->didRecreateOutputSurface(false);
    189189    return RecreateFailedAndGaveUp;
    190190}
     
    283283PassOwnPtr<CCGraphicsContext> CCLayerTreeHost::createContext()
    284284{
    285     if (settings().forceSoftwareCompositing)
    286         return CCGraphicsContext::create2D();
    287     return CCGraphicsContext::create3D(m_client->createContext3D());
     285    return m_client->createOutputSurface();
    288286}
    289287
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h

    r124830 r125212  
    2626#define CCLayerTreeHost_h
    2727
    28 #include "GraphicsContext3D.h"
    29 #include "GraphicsTypes3D.h"
    3028#include "IntRect.h"
    3129#include "RateLimiter.h"
     
    4947
    5048class CCFontAtlas;
    51 class CCGraphicsContext;
    5249class CCLayerChromium;
    5350class CCLayerTreeHostImpl;
     
    6764    virtual void layout() = 0;
    6865    virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) = 0;
    69     virtual PassOwnPtr<WebKit::WebGraphicsContext3D> createContext3D() = 0;
    70     virtual void didRecreateContext(bool success) = 0;
     66    virtual PassOwnPtr<WebKit::WebCompositorOutputSurface> createOutputSurface() = 0;
     67    virtual void didRecreateOutputSurface(bool success) = 0;
    7168    virtual void willCommit() = 0;
    7269    virtual void didCommit() = 0;
     
    8481    CCLayerTreeSettings()
    8582            : acceleratePainting(false)
    86             , forceSoftwareCompositing(false)
    8783            , showFPSCounter(false)
    8884            , showPlatformLayerTree(false)
     
    10298
    10399    bool acceleratePainting;
    104     bool forceSoftwareCompositing;
    105100    bool showFPSCounter;
    106101    bool showPlatformLayerTree;
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp

    r125196 r125212  
    528528}
    529529
     530void CCLayerTreeHostImpl::onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds)
     531{
     532    m_client->onVSyncParametersChanged(monotonicTimebase, intervalInSeconds);
     533}
     534
    530535void CCLayerTreeHostImpl::drawLayers(const FrameData& frame)
    531536{
     
    677682bool CCLayerTreeHostImpl::initializeLayerRenderer(PassOwnPtr<CCGraphicsContext> context, TextureUploaderOption textureUploader)
    678683{
     684    if (!context->bindToClient(this))
     685        return false;
     686
    679687    WebKit::WebGraphicsContext3D* context3d = context->context3D();
     688
    680689    if (!context3d) {
    681690        // FIXME: Implement this path for software compositing.
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h

    r125196 r125212  
    3232#include "cc/CCRenderPass.h"
    3333#include "cc/CCRenderer.h"
     34#include <public/WebCompositorOutputSurfaceClient.h>
    3435#include <wtf/PassOwnPtr.h>
    3536#include <wtf/RefPtr.h>
     
    5556    virtual void didLoseContextOnImplThread() = 0;
    5657    virtual void onSwapBuffersCompleteOnImplThread() = 0;
     58    virtual void onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) = 0;
    5759    virtual void setNeedsRedrawOnImplThread() = 0;
    5860    virtual void setNeedsCommitOnImplThread() = 0;
     
    6163
    6264// CCLayerTreeHostImpl owns the CCLayerImpl tree as well as associated rendering state
    63 class CCLayerTreeHostImpl : public CCInputHandlerClient, CCRendererClient {
     65class CCLayerTreeHostImpl : public CCInputHandlerClient,
     66                            public CCRendererClient,
     67                            public WebKit::WebCompositorOutputSurfaceClient {
    6468    WTF_MAKE_NONCOPYABLE(CCLayerTreeHostImpl);
    6569    typedef Vector<CCLayerImpl*> CCLayerList;
     
    112116    virtual void releaseContentsTextures() OVERRIDE;
    113117    virtual void setMemoryAllocationLimitBytes(size_t) OVERRIDE;
     118
     119    // WebCompositorOutputSurfaceClient implementation.
     120    virtual void onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) OVERRIDE;
    114121
    115122    // Implementation
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h

    r123644 r125212  
    2727
    2828#include "IntRect.h"
     29#include <public/WebCompositorOutputSurface.h>
    2930#include <wtf/Noncopyable.h>
    3031#include <wtf/PassOwnPtr.h>
     
    3536
    3637class CCThread;
    37 class CCGraphicsContext;
    3838struct CCRenderingStats;
    3939struct LayerRendererCapabilities;
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderer.h

    r125196 r125212  
    4848    virtual void didLoseContext() = 0;
    4949    virtual void onSwapBuffersComplete() = 0;
     50    virtual void releaseContentsTextures() = 0;
    5051    virtual void setFullRootLayerDamage() = 0;
    51     virtual void releaseContentsTextures() = 0;
    5252    virtual void setMemoryAllocationLimitBytes(size_t) = 0;
     53protected:
     54    virtual ~CCRendererClient() { }
    5355};
    5456
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.cpp

    r124941 r125212  
    3131#include "LayerRendererChromium.h" // For the GLC() macro
    3232#include "LayerTextureSubImage.h"
    33 #include "cc/CCGraphicsContext.h"
    3433#include "cc/CCProxy.h"
    3534#include <public/WebGraphicsContext3D.h>
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.h

    r124093 r125212  
    3030#include "GraphicsContext3D.h"
    3131#include "IntSize.h"
     32#include "cc/CCGraphicsContext.h"
    3233#include <wtf/HashMap.h>
    3334#include <wtf/OwnPtr.h>
     
    4243namespace WebCore {
    4344
    44 class CCGraphicsContext;
    4545class CCScopedLockResourceForRead;
    4646class CCScopedLockResourceForWrite;
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h

    r124830 r125212  
    6969    virtual void didLoseContextOnImplThread() OVERRIDE { }
    7070    virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { ASSERT_NOT_REACHED(); }
     71    virtual void onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) OVERRIDE { }
    7172    virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_layerTreeHost->scheduleComposite(); }
    7273    virtual void setNeedsCommitOnImplThread() OVERRIDE { m_layerTreeHost->scheduleComposite(); }
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp

    r124830 r125212  
    238238    if (!context)
    239239        return false;
    240     if (m_layerTreeHost->needsSharedContext() && !m_layerTreeHost->settings().forceSoftwareCompositing)
     240    if (m_layerTreeHost->needsSharedContext())
    241241        if (!WebSharedGraphicsContext3D::createCompositorThreadContext())
    242242            return false;
     
    325325}
    326326
     327void CCThreadProxy::onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds)
     328{
     329    ASSERT(isImplThread());
     330    TRACE_EVENT0("cc", "CCThreadProxy::onVSyncParametersChanged");
     331    // FIXME: route this into the scheduler once the scheduler supports vsync.
     332}
     333
    327334void CCThreadProxy::setNeedsCommitOnImplThread()
    328335{
     
    469476    }
    470477
    471     if (m_layerTreeHost->needsSharedContext() && !m_layerTreeHost->settings().forceSoftwareCompositing && !WebSharedGraphicsContext3D::haveCompositorThreadContext())
     478    if (m_layerTreeHost->needsSharedContext() && !WebSharedGraphicsContext3D::haveCompositorThreadContext())
    472479        WebSharedGraphicsContext3D::createCompositorThreadContext();
    473480
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h

    r124830 r125212  
    7878    virtual void didLoseContextOnImplThread() OVERRIDE;
    7979    virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE;
     80    virtual void onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) OVERRIDE;
    8081    virtual void setNeedsRedrawOnImplThread() OVERRIDE;
    8182    virtual void setNeedsCommitOnImplThread() OVERRIDE;
  • trunk/Source/WebKit/chromium/ChangeLog

    r125211 r125212  
     12012-08-06  Nat Duca  <nduca@chromium.org>
     2
     3        [chromium] Expose CCGraphicsContext as WebCompositorOutputSurface
     4        https://bugs.webkit.org/show_bug.cgi?id=92890
     5
     6        Reviewed by James Robinson.
     7
     8        * WebKit.gyp:
     9        * WebKit.gypi:
     10        * public/WebSettings.h:
     11        * public/WebViewClient.h:
     12        (WebKit):
     13        (WebViewClient):
     14        (WebKit::WebViewClient::createOutputSurface):
     15        * src/WebLayerTreeView.cpp:
     16        (WebKit::WebLayerTreeView::Settings::operator CCLayerTreeSettings):
     17        * src/WebLayerTreeViewImpl.cpp:
     18        (WebKit):
     19        (WebGraphicsContextToOutputSurfaceAdapter):
     20        (WebKit::WebGraphicsContextToOutputSurfaceAdapter::WebGraphicsContextToOutputSurfaceAdapter):
     21        (WebKit::WebLayerTreeViewClientAdapter::WebLayerTreeViewClientAdapter):
     22        * src/WebSettingsImpl.cpp:
     23        (WebKit::WebSettingsImpl::WebSettingsImpl):
     24        * src/WebSettingsImpl.h:
     25        (WebSettingsImpl):
     26        * src/WebViewImpl.cpp:
     27        (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
     28        (WebKit::WebViewImpl::createOutputSurface):
     29        (WebKit):
     30        (WebKit::WebViewImpl::didRebindGraphicsContext):
     31        (WebKit::WebViewImpl::didRebindOutputSurface):
     32        * src/WebViewImpl.h:
     33        (WebViewImpl):
     34        * tests/CCLayerTreeHostImplTest.cpp:
     35        * tests/CCLayerTreeHostTest.cpp:
     36        (WTF):
     37        (WTF::CCLayerTreeHostTestSetSingleLostContext::didRecreateOutputSurface):
     38        (WTF::CCLayerTreeHostTestSetRepeatedLostContext::didRecreateOutputSurface):
     39        * tests/CCResourceProviderTest.cpp:
     40        (WebKit::CCResourceProviderTest::CCResourceProviderTest):
     41        * tests/CCTextureUpdateControllerTest.cpp:
     42        * tests/CCThreadedTest.cpp:
     43        (WebKitTests::TestHooks::createOutputSurface):
     44        * tests/CCThreadedTest.h:
     45        (WebKitTests::TestHooks::didRecreateOutputSurface):
     46        * tests/Canvas2DLayerBridgeTest.cpp:
     47        (Canvas2DLayerBridgeTest::fullLifecycleTest):
     48        * tests/FakeCCGraphicsContext.h:
     49        (WebKit::createFakeCCGraphicsContext):
     50        * tests/FakeCCLayerTreeHostClient.h:
     51        * tests/FakeWebCompositorOutputSurface.h: Copied from Source/WebCore/platform/graphics/chromium/cc/CCGraphicsContext.h.
     52        (WebKit):
     53        (FakeWebCompositorOutputSurface):
     54        (WebKit::FakeWebCompositorOutputSurface::create):
     55        (WebKit::FakeWebCompositorOutputSurface::FakeWebCompositorOutputSurface):
     56        * tests/LayerRendererChromiumTest.cpp:
     57        (LayerRendererChromiumTest::LayerRendererChromiumTest):
     58        (TEST):
     59        * tests/WebLayerTest.cpp:
     60        * tests/WebLayerTreeViewTest.cpp:
     61
    1622012-08-09  Alec Flett  <alecflett@chromium.org>
    263
  • trunk/Source/WebKit/chromium/WebKit.gyp

    r125184 r125212  
    301301                'public/platform/WebColor.h',
    302302                'public/platform/WebCommon.h',
     303                'public/platform/WebCompositorOutputSurface.h',
     304                'public/platform/WebCompositorOutputSurfaceClient.h',
    303305                'public/platform/WebContentLayer.h',
    304306                'public/platform/WebContentLayerClient.h',
  • trunk/Source/WebKit/chromium/WebKit.gypi

    r124974 r125212  
    105105            'tests/FakeCCLayerTreeHostClient.h',
    106106            'tests/FakeGraphicsContext3DTest.cpp',
     107            'tests/FakeWebCompositorOutputSurface.h',
    107108            'tests/FakeWebGraphicsContext3D.h',
    108109            'tests/FakeWebScrollbarThemeGeometry.h',
  • trunk/Source/WebKit/chromium/public/WebSettings.h

    r124372 r125212  
    5454    };
    5555
    56     virtual bool forceSoftwareCompositing() const = 0;
    5756    virtual bool scrollAnimatorEnabled() const = 0;
    5857    virtual bool viewportEnabled() const = 0;
     
    103102    virtual void setFontRenderingModeNormal() = 0;
    104103    virtual void setForceCompositingMode(bool) = 0;
    105     virtual void setForceSoftwareCompositing(bool) = 0;
    106104    virtual void setFrameFlatteningEnabled(bool) = 0;
    107105    virtual void setFullScreenEnabled(bool) = 0;
  • trunk/Source/WebKit/chromium/public/WebViewClient.h

    r124394 r125212  
    5454class WebColorChooser;
    5555class WebColorChooserClient;
     56class WebCompositorOutputSurface;
    5657class WebDeviceOrientationClient;
    5758class WebDragData;
     
    119120    virtual WebStorageNamespace* createSessionStorageNamespace(unsigned quota) { return 0; }
    120121
    121     // Creates a graphics context that renders to the client's WebView.
     122    // DEPRECATED: Creates a graphics context that renders to the client's WebView.
    122123    virtual WebGraphicsContext3D* createGraphicsContext3D(const WebGraphicsContext3D::Attributes&) { return 0; }
    123124
     125    // Creates the output surface that renders to the client's WebView.
     126    virtual WebCompositorOutputSurface* createOutputSurface() { return 0; }
    124127
    125128    // Misc ----------------------------------------------------------------
  • trunk/Source/WebKit/chromium/src/WebLayerTreeView.cpp

    r124543 r125212  
    4747{
    4848    CCLayerTreeSettings settings;
    49     settings.forceSoftwareCompositing = forceSoftwareCompositing;
    5049    settings.showFPSCounter = showFPSCounter;
    5150    settings.showPlatformLayerTree = showPlatformLayerTree;
  • trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp

    r124917 r125212  
    4040using namespace WebCore;
    4141
     42namespace {
     43
     44// Adapts a pure WebGraphicsContext3D into a WebCompositorOutputSurface until
     45// downstream code can be updated to produce output surfaces directly.
     46class WebGraphicsContextToOutputSurfaceAdapter : public WebKit::WebCompositorOutputSurface {
     47public:
     48    explicit WebGraphicsContextToOutputSurfaceAdapter(PassOwnPtr<WebKit::WebGraphicsContext3D> context)
     49        : m_context3D(context)
     50        , m_client(0)
     51    {
     52    }
     53
     54    virtual bool bindToClient(WebKit::WebCompositorOutputSurfaceClient* client) OVERRIDE
     55    {
     56        ASSERT(client);
     57        if (!m_context3D->makeContextCurrent())
     58            return false;
     59        m_client = client;
     60        return true;
     61    }
     62
     63    virtual const Capabilities& capabilities() const OVERRIDE
     64    {
     65        return m_capabilities;
     66    }
     67
     68    virtual WebKit::WebGraphicsContext3D* context3D() const OVERRIDE
     69    {
     70        return m_context3D.get();
     71    }
     72
     73    virtual void sendFrameToParentCompositor(const WebKit::WebCompositorFrame&) OVERRIDE
     74    {
     75    }
     76
     77private:
     78    OwnPtr<WebKit::WebGraphicsContext3D> m_context3D;
     79    Capabilities m_capabilities;
     80    WebKit::WebCompositorOutputSurfaceClient* m_client;
     81};
     82
     83}
     84
    4285namespace WebKit {
    4386
     
    4588class WebLayerTreeViewClientAdapter : public WebCore::CCLayerTreeHostClient {
    4689public:
    47     WebLayerTreeViewClientAdapter(WebLayerTreeViewClient* client) : m_client(client) { }
     90    WebLayerTreeViewClientAdapter(WebLayerTreeViewClient* client)
     91        : m_client(client)
     92        , m_usingRealOutputSurface(false)
     93    {
     94    }
    4895    virtual ~WebLayerTreeViewClientAdapter() { }
    4996
     
    54101    virtual void layout() OVERRIDE { m_client->layout(); }
    55102    virtual void applyScrollAndScale(const WebCore::IntSize& scrollDelta, float pageScale) OVERRIDE { m_client->applyScrollAndScale(scrollDelta, pageScale); }
    56     virtual PassOwnPtr<WebGraphicsContext3D> createContext3D() OVERRIDE
     103    virtual PassOwnPtr<WebCompositorOutputSurface> createOutputSurface() OVERRIDE
    57104    {
    58         return adoptPtr(m_client->createContext3D());
     105        WebCompositorOutputSurface* outputSurface = m_client->createOutputSurface();
     106        if (outputSurface) {
     107            m_usingRealOutputSurface = true;
     108            return adoptPtr(outputSurface);
     109        }
     110
     111        // Temporarily, if the output surface can't be created, create a WebGraphicsContext3D
     112        // directly. This allows bootstrapping the output surface system while downstream
     113        // users of the API still use the old approach.
     114        WebGraphicsContext3D* context = m_client->createContext3D();
     115        if (!context)
     116            return nullptr;
     117
     118        m_usingRealOutputSurface = false;
     119        return adoptPtr(new WebGraphicsContextToOutputSurfaceAdapter(adoptPtr(context)));
    59120    }
    60     virtual void didRecreateContext(bool success) OVERRIDE { m_client->didRebindGraphicsContext(success); }
     121
     122    virtual void didRecreateOutputSurface(bool success) OVERRIDE
     123    {
     124        if (m_usingRealOutputSurface) {
     125            m_client->didRecreateOutputSurface(success);
     126            return;
     127        }
     128        m_client->didRebindGraphicsContext(success);
     129    }
    61130    virtual void willCommit() OVERRIDE { m_client->willCommit(); }
    62131    virtual void didCommit() OVERRIDE { m_client->didCommit(); }
     
    67136private:
    68137    WebLayerTreeViewClient* m_client;
     138    bool m_usingRealOutputSurface;
    69139};
    70140
  • trunk/Source/WebKit/chromium/src/WebSettingsImpl.cpp

    r124372 r125212  
    4848WebSettingsImpl::WebSettingsImpl(Settings* settings)
    4949    : m_settings(settings)
    50     , m_forceSoftwareCompositing(false)
    5150    , m_showFPSCounter(false)
    5251    , m_showPlatformLayerTree(false)
     
    414413}
    415414
    416 void WebSettingsImpl::setForceSoftwareCompositing(bool enabled)
    417 {
    418     m_forceSoftwareCompositing = enabled;
    419 }
    420 
    421415void WebSettingsImpl::setMockScrollbarsEnabled(bool enabled)
    422416{
  • trunk/Source/WebKit/chromium/src/WebSettingsImpl.h

    r124372 r125212  
    4646
    4747    virtual bool deviceSupportsTouch();
    48     virtual bool forceSoftwareCompositing() const { return m_forceSoftwareCompositing; }
    4948    virtual bool scrollAnimatorEnabled() const;
    5049    virtual bool viewportEnabled() const { return m_viewportEnabled; }
     
    9594    virtual void setFontRenderingModeNormal();
    9695    virtual void setForceCompositingMode(bool);
    97     virtual void setForceSoftwareCompositing(bool);
    9896    virtual void setFrameFlatteningEnabled(bool);
    9997    virtual void setFullScreenEnabled(bool);
     
    165163private:
    166164    WebCore::Settings* m_settings;
    167     bool m_forceSoftwareCompositing;
    168165    bool m_showFPSCounter;
    169166    bool m_showPlatformLayerTree;
  • trunk/Source/WebKit/chromium/src/WebViewImpl.cpp

    r125108 r125212  
    150150#include <public/Platform.h>
    151151#include <public/WebCompositor.h>
     152#include <public/WebCompositorOutputSurface.h>
    152153#include <public/WebDragData.h>
    153154#include <public/WebFloatPoint.h>
     
    36363637        layerTreeViewSettings.showPaintRects = settingsImpl()->showPaintRects();
    36373638        layerTreeViewSettings.renderVSyncEnabled = settingsImpl()->renderVSyncEnabled();
    3638         layerTreeViewSettings.forceSoftwareCompositing = settings()->forceSoftwareCompositing();
    36393639
    36403640        layerTreeViewSettings.defaultTileSize = settingsImpl()->defaultTileSize();
     
    36883688#endif
    36893689
    3690 PassOwnPtr<WebKit::WebGraphicsContext3D> WebViewImpl::createCompositorGraphicsContext3D()
    3691 {
    3692     if (settings()->forceSoftwareCompositing())
    3693         CRASH();
    3694 
    3695     // Explicitly disable antialiasing for the compositor. As of the time of
    3696     // this writing, the only platform that supported antialiasing for the
    3697     // compositor was Mac OS X, because the on-screen OpenGL context creation
    3698     // code paths on Windows and Linux didn't yet have multisampling support.
    3699     // Mac OS X essentially always behaves as though it's rendering offscreen.
    3700     // Multisampling has a heavy cost especially on devices with relatively low
    3701     // fill rate like most notebooks, and the Mac implementation would need to
    3702     // be optimized to resolve directly into the IOSurface shared between the
    3703     // GPU and browser processes. For these reasons and to avoid platform
    3704     // disparities we explicitly disable antialiasing.
     3690namespace {
     3691
     3692// Adapts a pure WebGraphicsContext3D into a WebCompositorOutputSurface until
     3693// downstream code can be updated to produce output surfaces directly.
     3694class WebGraphicsContextToOutputSurfaceAdapter : public WebCompositorOutputSurface {
     3695public:
     3696    explicit WebGraphicsContextToOutputSurfaceAdapter(PassOwnPtr<WebGraphicsContext3D> context)
     3697        : m_context3D(context)
     3698        , m_client(0)
     3699    {
     3700    }
     3701
     3702    virtual bool bindToClient(WebCompositorOutputSurfaceClient* client) OVERRIDE
     3703    {
     3704        ASSERT(client);
     3705        if (!m_context3D->makeContextCurrent())
     3706            return false;
     3707        m_client = client;
     3708        return true;
     3709    }
     3710
     3711    virtual const Capabilities& capabilities() const OVERRIDE
     3712    {
     3713        return m_capabilities;
     3714    }
     3715
     3716    virtual WebGraphicsContext3D* context3D() const OVERRIDE
     3717    {
     3718        return m_context3D.get();
     3719    }
     3720
     3721    virtual void sendFrameToParentCompositor(const WebCompositorFrame&) OVERRIDE
     3722    {
     3723    }
     3724
     3725private:
     3726    OwnPtr<WebGraphicsContext3D> m_context3D;
     3727    Capabilities m_capabilities;
     3728    WebCompositorOutputSurfaceClient* m_client;
     3729};
     3730
     3731} // namespace
     3732
     3733WebGraphicsContext3D* WebViewImpl::createContext3D()
     3734{
     3735    // Temporarily, if the output surface can't be created, create a WebGraphicsContext3D
     3736    // directly. This allows bootstrapping the output surface system while downstream
     3737    // users of the API still use the old approach.
    37053738    WebKit::WebGraphicsContext3D::Attributes attributes;
    37063739    attributes.antialias = false;
    37073740    attributes.shareResources = true;
    3708 
    3709     OwnPtr<WebGraphicsContext3D> webContext = adoptPtr(client()->createGraphicsContext3D(attributes));
    3710     if (!webContext)
    3711         return nullptr;
    3712 
    3713     return webContext.release();
    3714 }
    3715 
    3716 WebKit::WebGraphicsContext3D* WebViewImpl::createContext3D()
    3717 {
    3718     if (settings()->forceSoftwareCompositing())
    3719         CRASH();
    3720 
    3721     OwnPtr<WebKit::WebGraphicsContext3D> webContext;
    3722 
    3723     // If we've already created an onscreen context for this view, return that.
    3724     if (m_temporaryOnscreenGraphicsContext3D)
    3725         webContext = m_temporaryOnscreenGraphicsContext3D.release();
    3726     else // Otherwise make a new one.
    3727         webContext = createCompositorGraphicsContext3D();
    3728     // The caller takes ownership of this object, but since there's no equivalent of PassOwnPtr<> in the WebKit API
    3729     // we return a raw pointer.
    3730     return webContext.leakPtr();
     3741    return m_client->createGraphicsContext3D(attributes);
     3742}
     3743
     3744WebCompositorOutputSurface* WebViewImpl::createOutputSurface()
     3745{
     3746    return m_client->createOutputSurface();
    37313747}
    37323748
     
    37783794void WebViewImpl::didRebindGraphicsContext(bool success)
    37793795{
    3780 
     3796    didRecreateOutputSurface(success);
     3797}
     3798
     3799void WebViewImpl::didRecreateOutputSurface(bool success)
     3800{
    37813801    // Switch back to software rendering mode, if necessary
    37823802    if (!success) {
  • trunk/Source/WebKit/chromium/src/WebViewImpl.h

    r124478 r125212  
    313313    virtual void updateAnimations(double monotonicFrameBeginTime);
    314314    virtual void applyScrollAndScale(const WebSize&, float);
    315     virtual WebGraphicsContext3D* createContext3D();
    316     virtual void didRebindGraphicsContext(bool);
     315    virtual WebGraphicsContext3D* createContext3D() OVERRIDE;
     316    virtual void didRebindGraphicsContext(bool success) OVERRIDE;
     317    virtual WebCompositorOutputSurface* createOutputSurface() OVERRIDE;
     318    virtual void didRecreateOutputSurface(bool success) OVERRIDE;
    317319    virtual void willCommit();
    318320    virtual void didCommit();
     
    537539
    538540    virtual WebGraphicsContext3D* sharedGraphicsContext3D();
    539 
    540     PassOwnPtr<WebGraphicsContext3D> createCompositorGraphicsContext3D();
    541541
    542542    virtual void setVisibilityState(WebPageVisibilityState, bool);
     
    833833#endif
    834834
    835     // If we attempt to fetch the on-screen GraphicsContext3D before
    836     // the compositor has been turned on, we need to instantiate it
    837     // early. This member holds on to the GC3D in this case.
    838     OwnPtr<WebGraphicsContext3D> m_temporaryOnscreenGraphicsContext3D;
    839835    OwnPtr<DeviceOrientationClientProxy> m_deviceOrientationClientProxy;
    840836    OwnPtr<GeolocationClientProxy> m_geolocationClientProxy;
  • trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp

    r125196 r125212  
    3131#include "CCLayerTreeTestCommon.h"
    3232#include "CCTestCommon.h"
     33#include "FakeWebCompositorOutputSurface.h"
    3334#include "FakeWebGraphicsContext3D.h"
    3435#include "FakeWebScrollbarThemeGeometry.h"
     
    8283    virtual void didLoseContextOnImplThread() OVERRIDE { }
    8384    virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { }
     85    virtual void onVSyncParametersChanged(double, double) OVERRIDE { }
    8486    virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = true; }
    8587    virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = true; }
     
    177179    PassOwnPtr<CCGraphicsContext> createContext()
    178180    {
    179         return CCGraphicsContext::create3D(adoptPtr(new FakeWebGraphicsContext3D));
     181        return FakeWebCompositorOutputSurface::create(adoptPtr(new FakeWebGraphicsContext3D));
    180182    }
    181183
     
    15791581TEST_F(CCLayerTreeHostImplTest, reshapeNotCalledUntilDraw)
    15801582{
    1581     OwnPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(adoptPtr(new ReshapeTrackerContext));
     1583    OwnPtr<CCGraphicsContext> ccContext = FakeWebCompositorOutputSurface::create(adoptPtr(new ReshapeTrackerContext));
    15821584    ReshapeTrackerContext* reshapeTracker = static_cast<ReshapeTrackerContext*>(ccContext->context3D());
    15831585    m_hostImpl->initializeLayerRenderer(ccContext.release(), UnthrottledUploader);
     
    16221624TEST_F(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect)
    16231625{
    1624     OwnPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(adoptPtr(new PartialSwapTrackerContext));
     1626    OwnPtr<CCGraphicsContext> ccContext = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapTrackerContext));
    16251627    PartialSwapTrackerContext* partialSwapTracker = static_cast<PartialSwapTrackerContext*>(ccContext->context3D());
    16261628
     
    18341836TEST_F(CCLayerTreeHostImplTest, noPartialSwap)
    18351837{
    1836     OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new MockContext));
     1838    OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new MockContext));
    18371839    MockContext* mockContext = static_cast<MockContext*>(context->context3D());
    18381840    MockContextHarness harness(mockContext);
     
    18531855TEST_F(CCLayerTreeHostImplTest, partialSwap)
    18541856{
    1855     OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new MockContext));
     1857    OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new MockContext));
    18561858    MockContext* mockContext = static_cast<MockContext*>(context->context3D());
    18571859    MockContextHarness harness(mockContext);
     
    19111913    CCSettings::setPartialSwapEnabled(partialSwap);
    19121914
    1913     OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext));
     1915    OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapContext));
    19141916
    19151917    CCLayerTreeSettings settings;
     
    20692071{
    20702072    // The context initialization will fail, but we should still be able to call finishAllRendering() without any ill effects.
    2071     m_hostImpl->initializeLayerRenderer(CCGraphicsContext::create3D(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails)), UnthrottledUploader);
     2073    m_hostImpl->initializeLayerRenderer(FakeWebCompositorOutputSurface::create(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails)), UnthrottledUploader);
    20722074    m_hostImpl->finishAllRendering();
    20732075}
     
    23512353
    23522354    // Use a context that supports IOSurfaces
    2353     m_hostImpl->initializeLayerRenderer(CCGraphicsContext::create3D(adoptPtr(new FakeWebGraphicsContext3DWithIOSurface)), UnthrottledUploader);
     2355    m_hostImpl->initializeLayerRenderer(FakeWebCompositorOutputSurface::create(adoptPtr(new FakeWebGraphicsContext3DWithIOSurface)), UnthrottledUploader);
    23542356
    23552357    hwVideoFrame.setTextureId(m_hostImpl->resourceProvider()->graphicsContext3D()->createTexture());
     
    23672369    // Lose the context, replacing it with a StrictWebGraphicsContext3DWithIOSurface,
    23682370    // that will warn if any resource from the previous context gets used.
    2369     m_hostImpl->initializeLayerRenderer(CCGraphicsContext::create3D(adoptPtr(new StrictWebGraphicsContext3DWithIOSurface)), UnthrottledUploader);
     2371    m_hostImpl->initializeLayerRenderer(FakeWebCompositorOutputSurface::create(adoptPtr(new StrictWebGraphicsContext3DWithIOSurface)), UnthrottledUploader);
    23702372
    23712373    // Create dummy resources so that looking up an old resource will get an
     
    24782480
    24792481    // Lose the context, replacing it with a TrackingWebGraphicsContext3D (which the CCLayerTreeHostImpl takes ownership of).
    2480     OwnPtr<CCGraphicsContext> ccContext(CCGraphicsContext::create3D(adoptPtr(new TrackingWebGraphicsContext3D)));
     2482    OwnPtr<CCGraphicsContext> ccContext(FakeWebCompositorOutputSurface::create(adoptPtr(new TrackingWebGraphicsContext3D)));
    24812483    TrackingWebGraphicsContext3D* trackingWebGraphicsContext = static_cast<TrackingWebGraphicsContext3D*>(ccContext->context3D());
    24822484    m_hostImpl->initializeLayerRenderer(ccContext.release(), UnthrottledUploader);
     
    25062508TEST_F(CCLayerTreeHostImplTest, hasTransparentBackground)
    25072509{
    2508     OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new MockDrawQuadsToFillScreenContext));
     2510    OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new MockDrawQuadsToFillScreenContext));
    25092511    MockDrawQuadsToFillScreenContext* mockContext = static_cast<MockDrawQuadsToFillScreenContext*>(context->context3D());
    25102512
     
    25502552static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl, CCLayerImpl*& rootPtr, CCLayerImpl*& intermediateLayerPtr, CCLayerImpl*& surfaceLayerPtr, CCLayerImpl*& childPtr, const IntSize& rootSize)
    25512553{
    2552     OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext));
     2554    OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapContext));
    25532555
    25542556    layerTreeHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader);
     
    25942596    CCLayerImpl* surfaceLayerPtr;
    25952597
    2596     OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext));
     2598    OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapContext));
    25972599
    25982600    IntSize rootSize(100, 100);
     
    27062708    CCLayerImpl* layerS2Ptr;
    27072709
    2708     OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext));
     2710    OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapContext));
    27092711
    27102712    IntSize rootSize(1000, 1000);
     
    28192821    CCLayerImpl* layerS2Ptr;
    28202822
    2821     OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext));
     2823    OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapContext));
    28222824
    28232825    IntSize rootSize(1000, 1000);
     
    29332935    CCLayerImpl* layerS2Ptr;
    29342936
    2935     OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext));
     2937    OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapContext));
    29362938
    29372939    IntSize rootSize(1000, 1000);
     
    30163018    CCLayerImpl* layerS1Ptr;
    30173019
    3018     OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext));
     3020    OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapContext));
    30193021
    30203022    IntSize rootSize(1000, 1000);
     
    31013103    CCLayerImpl* layerS2Ptr;
    31023104
    3103     OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext));
     3105    OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapContext));
    31043106
    31053107    IntSize rootSize(1000, 1000);
     
    32223224    IntRect grandChildRect(5, 5, 150, 150);
    32233225
    3224     OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext));
     3226    OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapContext));
    32253227    myHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader);
    32263228
  • trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp

    r125117 r125212  
    19491949SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestManySurfaces)
    19501950
    1951 // A loseContext(1) should lead to a didRecreateContext(true)
     1951// A loseContext(1) should lead to a didRecreateOutputSurface(true)
    19521952class CCLayerTreeHostTestSetSingleLostContext : public CCLayerTreeHostTest {
    19531953public:
     
    19661966    }
    19671967
    1968     virtual void didRecreateContext(bool succeeded)
     1968    virtual void didRecreateOutputSurface(bool succeeded)
    19691969    {
    19701970        EXPECT_TRUE(succeeded);
     
    19821982}
    19831983
    1984 // A loseContext(10) should lead to a didRecreateContext(false), and
     1984// A loseContext(10) should lead to a didRecreateOutputSurface(false), and
    19851985// a finishAllRendering() should not hang.
    19861986class CCLayerTreeHostTestSetRepeatedLostContext : public CCLayerTreeHostTest {
     
    20002000    }
    20012001
    2002     virtual void didRecreateContext(bool succeeded)
     2002    virtual void didRecreateOutputSurface(bool succeeded)
    20032003    {
    20042004        EXPECT_FALSE(succeeded);
  • trunk/Source/WebKit/chromium/tests/CCResourceProviderTest.cpp

    r123370 r125212  
    2929#include "CompositorFakeWebGraphicsContext3D.h"
    3030#include "Extensions3DChromium.h"
     31#include "FakeWebCompositorOutputSurface.h"
    3132#include "cc/CCGraphicsContext.h"
    3233#include "cc/CCSingleThreadProxy.h" // For DebugScopedSetImplThread
     
    189190public:
    190191    CCResourceProviderTest()
    191         : m_context(CCGraphicsContext::create3D(ResourceProviderContext::create()))
     192        : m_context(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create()))
    192193        , m_resourceProvider(CCResourceProvider::create(m_context.get()))
    193194    {
  • trunk/Source/WebKit/chromium/tests/CCTextureUpdateControllerTest.cpp

    r125095 r125212  
    2929#include "CCSchedulerTestCommon.h"
    3030#include "CCTiledLayerTestCommon.h"
     31#include "FakeWebCompositorOutputSurface.h"
    3132#include "FakeWebGraphicsContext3D.h"
    3233#include "cc/CCSingleThreadProxy.h" // For DebugScopedSetImplThread
     
    174175        WebCompositor::initialize(thread.get());
    175176
    176         m_context = CCGraphicsContext::create3D(
    177                     adoptPtr(new WebGraphicsContext3DForUploadTest(this)));
     177        m_context = FakeWebCompositorOutputSurface::create(adoptPtr(new WebGraphicsContext3DForUploadTest(this)));
    178178        DebugScopedSetImplThread implThread;
    179179        m_resourceProvider = CCResourceProvider::create(m_context.get());
  • trunk/Source/WebKit/chromium/tests/CCThreadedTest.cpp

    r125095 r125212  
    3131#include "CCTiledLayerTestCommon.h"
    3232#include "ContentLayerChromium.h"
     33#include "FakeWebCompositorOutputSurface.h"
    3334#include "FakeWebGraphicsContext3D.h"
    3435#include "LayerChromium.h"
     
    99100}
    100101
    101 PassOwnPtr<WebGraphicsContext3D> TestHooks::createContext()
    102 {
    103     return CompositorFakeWebGraphicsContext3DWithTextureTracking::create(WebGraphicsContext3D::Attributes());
     102PassOwnPtr<WebCompositorOutputSurface> TestHooks::createOutputSurface()
     103{
     104    return FakeWebCompositorOutputSurface::create(CompositorFakeWebGraphicsContext3DWithTextureTracking::create(WebGraphicsContext3D::Attributes()));
    104105}
    105106
     
    223224    }
    224225
    225     virtual PassOwnPtr<WebGraphicsContext3D> createContext3D() OVERRIDE
    226     {
    227         return m_testHooks->createContext();
     226    virtual PassOwnPtr<WebCompositorOutputSurface> createOutputSurface() OVERRIDE
     227    {
     228        return m_testHooks->createOutputSurface();
    228229    }
    229230
     
    246247    }
    247248
    248     virtual void didRecreateContext(bool succeeded) OVERRIDE
    249     {
    250         m_testHooks->didRecreateContext(succeeded);
     249    virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE
     250    {
     251        m_testHooks->didRecreateOutputSurface(succeeded);
    251252    }
    252253
  • trunk/Source/WebKit/chromium/tests/CCThreadedTest.h

    r124239 r125212  
    5959    virtual void updateAnimations(double monotonicTime) { }
    6060    virtual void layout() { }
    61     virtual void didRecreateContext(bool succeeded) { }
     61    virtual void didRecreateOutputSurface(bool succeeded) { }
    6262    virtual void didAddAnimation() { }
    6363    virtual void didCommit() { }
     
    6969    virtual void notifyAnimationFinished(double time) OVERRIDE { }
    7070
    71     virtual PassOwnPtr<WebKit::WebGraphicsContext3D> createContext();
     71    virtual PassOwnPtr<WebKit::WebCompositorOutputSurface> createOutputSurface();
    7272};
    7373
  • trunk/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp

    r124927 r125212  
    2727#include "Canvas2DLayerBridge.h"
    2828
     29#include "FakeWebCompositorOutputSurface.h"
    2930#include "FakeWebGraphicsContext3D.h"
    3031#include "GraphicsContext3DPrivate.h"
     
    7677    {
    7778        RefPtr<GraphicsContext3D> mainContext = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockCanvasContext));
    78         OwnPtr<CCGraphicsContext> ccImplContext = CCGraphicsContext::create3D(adoptPtr(new MockCanvasContext));
     79        OwnPtr<CCGraphicsContext> ccImplContext = FakeWebCompositorOutputSurface::create(adoptPtr(new MockCanvasContext));
    7980
    8081        MockCanvasContext& mainMock = *static_cast<MockCanvasContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(mainContext.get()));
  • trunk/Source/WebKit/chromium/tests/FakeCCGraphicsContext.h

    r123065 r125212  
    2828
    2929#include "CompositorFakeWebGraphicsContext3D.h"
     30#include "FakeWebCompositorOutputSurface.h"
    3031#include "cc/CCGraphicsContext.h"
     32#include <public/WebCompositorOutputSurface.h>
    3133
    3234namespace WebKit {
     
    3436static inline PassOwnPtr<WebCore::CCGraphicsContext> createFakeCCGraphicsContext()
    3537{
    36     return WebCore::CCGraphicsContext::create3D(CompositorFakeWebGraphicsContext3D::create(WebGraphicsContext3D::Attributes()));
     38    return FakeWebCompositorOutputSurface::create(CompositorFakeWebGraphicsContext3D::create(WebGraphicsContext3D::Attributes()));
    3739}
    3840
  • trunk/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h

    r121204 r125212  
    2929
    3030#include "CompositorFakeWebGraphicsContext3D.h"
     31#include "FakeWebCompositorOutputSurface.h"
     32
    3133#include "cc/CCLayerTreeHost.h"
    3234
     
    4042    virtual void layout() OVERRIDE { }
    4143    virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) OVERRIDE { }
    42     virtual PassOwnPtr<WebKit::WebGraphicsContext3D> createContext3D() OVERRIDE
     44
     45    virtual PassOwnPtr<WebKit::WebCompositorOutputSurface> createOutputSurface() OVERRIDE
    4346    {
    4447        WebKit::WebGraphicsContext3D::Attributes attrs;
    45         return WebKit::CompositorFakeWebGraphicsContext3D::create(WebKit::WebGraphicsContext3D::Attributes());
     48        return WebKit::FakeWebCompositorOutputSurface::create(WebKit::CompositorFakeWebGraphicsContext3D::create(attrs));
    4649    }
    47     virtual void didRecreateContext(bool success) OVERRIDE { }
     50    virtual void didRecreateOutputSurface(bool success) OVERRIDE { }
    4851    virtual void willCommit() OVERRIDE { }
    4952    virtual void didCommit() OVERRIDE { }
  • trunk/Source/WebKit/chromium/tests/FakeWebCompositorOutputSurface.h

    r125211 r125212  
    2424 */
    2525
    26 #ifndef CCGraphicsContext_h
    27 #define CCGraphicsContext_h
     26#ifndef FakeWebCompositorOutputSurface_h
     27#define FakeWebCompositorOutputSurface_h
    2828
     29#include <public/WebCompositorOutputSurface.h>
    2930#include <public/WebGraphicsContext3D.h>
    30 #include <wtf/Noncopyable.h>
    31 #include <wtf/OwnPtr.h>
    32 #include <wtf/PassOwnPtr.h>
    3331
    34 namespace WebCore {
     32namespace WebKit {
     33
     34class FakeWebCompositorOutputSurface : public WebCompositorOutputSurface {
     35public:
     36    static inline PassOwnPtr<FakeWebCompositorOutputSurface> create(PassOwnPtr<WebGraphicsContext3D> context3D)
     37    {
     38        return adoptPtr(new FakeWebCompositorOutputSurface(context3D));
     39    }
    3540
    3641
    37 class CCGraphicsContext {
    38     WTF_MAKE_NONCOPYABLE(CCGraphicsContext);
    39 public:
    40     static PassOwnPtr<CCGraphicsContext> create2D()
     42    virtual bool bindToClient(WebCompositorOutputSurfaceClient* client) OVERRIDE
    4143    {
    42         return adoptPtr(new CCGraphicsContext());
    43     }
    44     static PassOwnPtr<CCGraphicsContext> create3D(PassOwnPtr<WebKit::WebGraphicsContext3D> context3D)
    45     {
    46         return adoptPtr(new CCGraphicsContext(context3D));
     44        ASSERT(client);
     45        if (!m_context3D->makeContextCurrent())
     46            return false;
     47        m_client = client;
     48        return true;
    4749    }
    4850
    49     WebKit::WebGraphicsContext3D* context3D() { return m_context3D.get(); }
     51    virtual const Capabilities& capabilities() const OVERRIDE
     52    {
     53        return m_capabilities;
     54    }
     55
     56    virtual WebGraphicsContext3D* context3D() const OVERRIDE
     57    {
     58        return m_context3D.get();
     59    }
     60
     61    virtual void sendFrameToParentCompositor(const WebCompositorFrame&) OVERRIDE
     62    {
     63    }
    5064
    5165private:
    52     CCGraphicsContext() { }
    53     explicit CCGraphicsContext(PassOwnPtr<WebKit::WebGraphicsContext3D> context3D)
    54         : m_context3D(context3D) { }
     66    explicit FakeWebCompositorOutputSurface(PassOwnPtr<WebGraphicsContext3D> context3D)
     67    {
     68        m_context3D = context3D;
     69    }
    5570
    56     OwnPtr<WebKit::WebGraphicsContext3D> m_context3D;
     71    OwnPtr<WebGraphicsContext3D> m_context3D;
     72    Capabilities m_capabilities;
     73    WebCompositorOutputSurfaceClient* m_client;
    5774};
    5875
    59 }
     76} // namespace WebKit
    6077
    61 #endif // CCGraphicsContext_h
     78#endif // FakeWebCompositorOutputSurface_h
  • trunk/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp

    r125196 r125212  
    2727
    2828#include "CCTestCommon.h"
     29#include "FakeWebCompositorOutputSurface.h"
    2930#include "FakeWebGraphicsContext3D.h"
    3031#include "GraphicsContext3D.h"
     
    129130        : m_suggestHaveBackbufferYes(1, true)
    130131        , m_suggestHaveBackbufferNo(1, false)
    131         , m_context(CCGraphicsContext::create3D(adoptPtr(new FrameCountingMemoryAllocationSettingContext())))
     132        , m_context(FakeWebCompositorOutputSurface::create(adoptPtr(new FrameCountingMemoryAllocationSettingContext())))
    132133        , m_resourceProvider(CCResourceProvider::create(m_context.get()))
    133134        , m_layerRendererChromium(&m_mockClient, m_resourceProvider.get())
     
    319320    CCScopedSettings scopedSettings;
    320321    FakeCCRendererClient mockClient;
    321     OwnPtr<CCGraphicsContext> context(CCGraphicsContext::create3D(adoptPtr(new ForbidSynchronousCallContext)));
     322    OwnPtr<CCGraphicsContext> context(FakeWebCompositorOutputSurface::create(adoptPtr(new ForbidSynchronousCallContext)));
    322323    OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(context.get()));
    323324    FakeLayerRendererChromium layerRendererChromium(&mockClient, resourceProvider.get());
     
    363364    CCScopedSettings scopedSettings;
    364365    FakeCCRendererClient mockClient;
    365     OwnPtr<CCGraphicsContext> context(CCGraphicsContext::create3D(adoptPtr(new LoseContextOnFirstGetContext)));
     366    OwnPtr<CCGraphicsContext> context(FakeWebCompositorOutputSurface::create(adoptPtr(new LoseContextOnFirstGetContext)));
    366367    OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(context.get()));
    367368    FakeLayerRendererChromium layerRendererChromium(&mockClient, resourceProvider.get());
     
    385386{
    386387    FakeCCRendererClient mockClient;
    387     OwnPtr<CCGraphicsContext> context(CCGraphicsContext::create3D(adoptPtr(new ContextThatDoesNotSupportMemoryManagmentExtensions)));
     388    OwnPtr<CCGraphicsContext> context(FakeWebCompositorOutputSurface::create(adoptPtr(new ContextThatDoesNotSupportMemoryManagmentExtensions)));
    388389    OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(context.get()));
    389390    FakeLayerRendererChromium layerRendererChromium(&mockClient, resourceProvider.get());
     
    412413{
    413414    FakeCCRendererClient mockClient;
    414     OwnPtr<CCGraphicsContext> ccContext(CCGraphicsContext::create3D(adoptPtr(new ClearCountingContext)));
     415    OwnPtr<CCGraphicsContext> ccContext(FakeWebCompositorOutputSurface::create(adoptPtr(new ClearCountingContext)));
    415416    ClearCountingContext* context = static_cast<ClearCountingContext*>(ccContext->context3D());
    416417    OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(ccContext.get()));
     
    435436{
    436437    FakeCCRendererClient mockClient;
    437     OwnPtr<CCGraphicsContext> ccContext(CCGraphicsContext::create3D(adoptPtr(new ClearCountingContext)));
     438    OwnPtr<CCGraphicsContext> ccContext(FakeWebCompositorOutputSurface::create(adoptPtr(new ClearCountingContext)));
    438439    ClearCountingContext* context = static_cast<ClearCountingContext*>(ccContext->context3D());
    439440    OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(ccContext.get()));
  • trunk/Source/WebKit/chromium/tests/WebLayerTest.cpp

    r125095 r125212  
    5959    virtual WebGraphicsContext3D* createContext3D() { return CompositorFakeWebGraphicsContext3D::create(WebGraphicsContext3D::Attributes()).leakPtr(); }
    6060    virtual void didRebindGraphicsContext(bool success) { }
     61    virtual WebCompositorOutputSurface* createOutputSurface() { return 0; }
     62    virtual void didRebindOutputSurface(bool success) { }
    6163    virtual void willCommit() { }
    6264    virtual void didCommitAndDrawFrame() { }
  • trunk/Source/WebKit/chromium/tests/WebLayerTreeViewTest.cpp

    r125095 r125212  
    2828
    2929#include "CompositorFakeWebGraphicsContext3D.h"
     30#include "FakeWebCompositorOutputSurface.h"
    3031#include <gmock/gmock.h>
    3132#include <public/Platform.h>
     
    4950    virtual void layout() OVERRIDE { }
    5051    virtual void applyScrollAndScale(const WebSize& scrollDelta, float scaleFactor) OVERRIDE { }
    51     virtual WebGraphicsContext3D* createContext3D() OVERRIDE { return CompositorFakeWebGraphicsContext3D::create(WebGraphicsContext3D::Attributes()).leakPtr(); }
    52     virtual void didRebindGraphicsContext(bool success) OVERRIDE { }
     52
     53    virtual WebCompositorOutputSurface* createOutputSurface() OVERRIDE
     54    {
     55        return FakeWebCompositorOutputSurface::create(CompositorFakeWebGraphicsContext3D::create(WebGraphicsContext3D::Attributes())).leakPtr();
     56    }
     57    virtual void didRebindOutputSurface(bool) OVERRIDE { }
     58
    5359    MOCK_METHOD0(willCommit, void());
    5460    MOCK_METHOD0(didCommit, void());
Note: See TracChangeset for help on using the changeset viewer.