Changeset 125212 in webkit
- Timestamp:
- Aug 9, 2012, 3:24:52 PM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 1 added
- 40 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/Platform/ChangeLog
r125130 r125212 1 2012-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 1 37 2012-08-08 Adrienne Walker <enne@google.com> 2 38 -
trunk/Source/Platform/Platform.gypi
r125061 r125212 45 45 'chromium/public/WebColor.h', 46 46 'chromium/public/WebCommon.h', 47 'chromium/public/WebCompositorOutputSurface.h', 48 'chromium/public/WebCompositorOutputSurfaceClient.h', 47 49 'chromium/public/WebContentLayer.h', 48 50 'chromium/public/WebContentLayerClient.h', -
trunk/Source/Platform/chromium/public/WebCompositorOutputSurfaceClient.h
r125211 r125212 24 24 */ 25 25 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 31 28 32 29 namespace WebKit { 33 30 34 static inline PassOwnPtr<WebCore::CCGraphicsContext> createFakeCCGraphicsContext() 35 { 36 return WebCore::CCGraphicsContext::create3D(CompositorFakeWebGraphicsContext3D::create(WebGraphicsContext3D::Attributes())); 31 class WebCompositorOutputSurfaceClient { 32 public: 33 virtual void onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) = 0; 34 35 protected: 36 ~WebCompositorOutputSurfaceClient() { } 37 }; 38 37 39 } 38 40 39 } // namespace WebKit 40 41 #endif // FakeCCGraphicsContext_h 41 #endif -
trunk/Source/Platform/chromium/public/WebLayerTreeView.h
r124543 r125212 53 53 Settings() 54 54 : acceleratePainting(false) 55 , forceSoftwareCompositing(false)56 55 , showFPSCounter(false) 57 56 , showPlatformLayerTree(false) … … 65 64 66 65 bool acceleratePainting; 67 bool forceSoftwareCompositing;68 66 bool showFPSCounter; 69 67 bool showPlatformLayerTree; … … 73 71 WebSize defaultTileSize; 74 72 WebSize maxUntiledLayerSize; 73 75 74 #if WEBKIT_IMPLEMENTATION 76 75 operator WebCore::CCLayerTreeSettings() const; -
trunk/Source/Platform/chromium/public/WebLayerTreeViewClient.h
r118513 r125212 28 28 29 29 namespace WebKit { 30 class Web GraphicsContext3D;30 class WebCompositorOutputSurface; 31 31 struct WebSize; 32 32 class WebThread; … … 56 56 virtual void applyScrollAndScale(const WebSize& scrollDelta, float scaleFactor) = 0; 57 57 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; } 61 62 62 // Signals a successful rebinding of the 3D context (e.g. after a lost63 // DEPRECATED: Signals a successful rebinding of the 3D context (e.g. after a lost 63 64 // 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) { } 65 74 66 75 // Indicates that a frame will be committed to the impl side of the compositor -
trunk/Source/WebCore/ChangeLog
r125205 r125212 1 2012-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 1 41 2012-08-09 Bruno de Oliveira Abinader <bruno.abinader@basyskom.com> 2 42 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCGraphicsContext.h
r123416 r125212 27 27 #define CCGraphicsContext_h 28 28 29 #include <public/WebCompositorOutputSurface.h> 29 30 #include <public/WebGraphicsContext3D.h> 30 31 #include <wtf/Noncopyable.h> … … 34 35 namespace WebCore { 35 36 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. 38 typedef WebKit::WebCompositorOutputSurface CCGraphicsContext; 58 39 59 40 } -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
r125196 r125212 134 134 if (!m_proxy->initializeLayerRenderer()) { 135 135 // Uh oh, better tell the client that we can't do anything with this context. 136 m_client->didRecreate Context(false);136 m_client->didRecreateOutputSurface(false); 137 137 return; 138 138 } … … 167 167 168 168 if (recreated) { 169 m_client->didRecreate Context(true);169 m_client->didRecreateOutputSurface(true); 170 170 m_contextLost = false; 171 171 return RecreateSucceeded; … … 186 186 // We have tried too many times to recreate the context. Tell the host to fall 187 187 // back to software rendering. 188 m_client->didRecreate Context(false);188 m_client->didRecreateOutputSurface(false); 189 189 return RecreateFailedAndGaveUp; 190 190 } … … 283 283 PassOwnPtr<CCGraphicsContext> CCLayerTreeHost::createContext() 284 284 { 285 if (settings().forceSoftwareCompositing) 286 return CCGraphicsContext::create2D(); 287 return CCGraphicsContext::create3D(m_client->createContext3D()); 285 return m_client->createOutputSurface(); 288 286 } 289 287 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h
r124830 r125212 26 26 #define CCLayerTreeHost_h 27 27 28 #include "GraphicsContext3D.h"29 #include "GraphicsTypes3D.h"30 28 #include "IntRect.h" 31 29 #include "RateLimiter.h" … … 49 47 50 48 class CCFontAtlas; 51 class CCGraphicsContext;52 49 class CCLayerChromium; 53 50 class CCLayerTreeHostImpl; … … 67 64 virtual void layout() = 0; 68 65 virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) = 0; 69 virtual PassOwnPtr<WebKit::Web GraphicsContext3D> createContext3D() = 0;70 virtual void didRecreate Context(bool success) = 0;66 virtual PassOwnPtr<WebKit::WebCompositorOutputSurface> createOutputSurface() = 0; 67 virtual void didRecreateOutputSurface(bool success) = 0; 71 68 virtual void willCommit() = 0; 72 69 virtual void didCommit() = 0; … … 84 81 CCLayerTreeSettings() 85 82 : acceleratePainting(false) 86 , forceSoftwareCompositing(false)87 83 , showFPSCounter(false) 88 84 , showPlatformLayerTree(false) … … 102 98 103 99 bool acceleratePainting; 104 bool forceSoftwareCompositing;105 100 bool showFPSCounter; 106 101 bool showPlatformLayerTree; -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp
r125196 r125212 528 528 } 529 529 530 void CCLayerTreeHostImpl::onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) 531 { 532 m_client->onVSyncParametersChanged(monotonicTimebase, intervalInSeconds); 533 } 534 530 535 void CCLayerTreeHostImpl::drawLayers(const FrameData& frame) 531 536 { … … 677 682 bool CCLayerTreeHostImpl::initializeLayerRenderer(PassOwnPtr<CCGraphicsContext> context, TextureUploaderOption textureUploader) 678 683 { 684 if (!context->bindToClient(this)) 685 return false; 686 679 687 WebKit::WebGraphicsContext3D* context3d = context->context3D(); 688 680 689 if (!context3d) { 681 690 // FIXME: Implement this path for software compositing. -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h
r125196 r125212 32 32 #include "cc/CCRenderPass.h" 33 33 #include "cc/CCRenderer.h" 34 #include <public/WebCompositorOutputSurfaceClient.h> 34 35 #include <wtf/PassOwnPtr.h> 35 36 #include <wtf/RefPtr.h> … … 55 56 virtual void didLoseContextOnImplThread() = 0; 56 57 virtual void onSwapBuffersCompleteOnImplThread() = 0; 58 virtual void onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) = 0; 57 59 virtual void setNeedsRedrawOnImplThread() = 0; 58 60 virtual void setNeedsCommitOnImplThread() = 0; … … 61 63 62 64 // CCLayerTreeHostImpl owns the CCLayerImpl tree as well as associated rendering state 63 class CCLayerTreeHostImpl : public CCInputHandlerClient, CCRendererClient { 65 class CCLayerTreeHostImpl : public CCInputHandlerClient, 66 public CCRendererClient, 67 public WebKit::WebCompositorOutputSurfaceClient { 64 68 WTF_MAKE_NONCOPYABLE(CCLayerTreeHostImpl); 65 69 typedef Vector<CCLayerImpl*> CCLayerList; … … 112 116 virtual void releaseContentsTextures() OVERRIDE; 113 117 virtual void setMemoryAllocationLimitBytes(size_t) OVERRIDE; 118 119 // WebCompositorOutputSurfaceClient implementation. 120 virtual void onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) OVERRIDE; 114 121 115 122 // Implementation -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h
r123644 r125212 27 27 28 28 #include "IntRect.h" 29 #include <public/WebCompositorOutputSurface.h> 29 30 #include <wtf/Noncopyable.h> 30 31 #include <wtf/PassOwnPtr.h> … … 35 36 36 37 class CCThread; 37 class CCGraphicsContext;38 38 struct CCRenderingStats; 39 39 struct LayerRendererCapabilities; -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderer.h
r125196 r125212 48 48 virtual void didLoseContext() = 0; 49 49 virtual void onSwapBuffersComplete() = 0; 50 virtual void releaseContentsTextures() = 0; 50 51 virtual void setFullRootLayerDamage() = 0; 51 virtual void releaseContentsTextures() = 0;52 52 virtual void setMemoryAllocationLimitBytes(size_t) = 0; 53 protected: 54 virtual ~CCRendererClient() { } 53 55 }; 54 56 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.cpp
r124941 r125212 31 31 #include "LayerRendererChromium.h" // For the GLC() macro 32 32 #include "LayerTextureSubImage.h" 33 #include "cc/CCGraphicsContext.h"34 33 #include "cc/CCProxy.h" 35 34 #include <public/WebGraphicsContext3D.h> -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.h
r124093 r125212 30 30 #include "GraphicsContext3D.h" 31 31 #include "IntSize.h" 32 #include "cc/CCGraphicsContext.h" 32 33 #include <wtf/HashMap.h> 33 34 #include <wtf/OwnPtr.h> … … 42 43 namespace WebCore { 43 44 44 class CCGraphicsContext;45 45 class CCScopedLockResourceForRead; 46 46 class CCScopedLockResourceForWrite; -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h
r124830 r125212 69 69 virtual void didLoseContextOnImplThread() OVERRIDE { } 70 70 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { ASSERT_NOT_REACHED(); } 71 virtual void onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) OVERRIDE { } 71 72 virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_layerTreeHost->scheduleComposite(); } 72 73 virtual void setNeedsCommitOnImplThread() OVERRIDE { m_layerTreeHost->scheduleComposite(); } -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp
r124830 r125212 238 238 if (!context) 239 239 return false; 240 if (m_layerTreeHost->needsSharedContext() && !m_layerTreeHost->settings().forceSoftwareCompositing)240 if (m_layerTreeHost->needsSharedContext()) 241 241 if (!WebSharedGraphicsContext3D::createCompositorThreadContext()) 242 242 return false; … … 325 325 } 326 326 327 void 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 327 334 void CCThreadProxy::setNeedsCommitOnImplThread() 328 335 { … … 469 476 } 470 477 471 if (m_layerTreeHost->needsSharedContext() && ! m_layerTreeHost->settings().forceSoftwareCompositing && !WebSharedGraphicsContext3D::haveCompositorThreadContext())478 if (m_layerTreeHost->needsSharedContext() && !WebSharedGraphicsContext3D::haveCompositorThreadContext()) 472 479 WebSharedGraphicsContext3D::createCompositorThreadContext(); 473 480 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h
r124830 r125212 78 78 virtual void didLoseContextOnImplThread() OVERRIDE; 79 79 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE; 80 virtual void onVSyncParametersChanged(double monotonicTimebase, double intervalInSeconds) OVERRIDE; 80 81 virtual void setNeedsRedrawOnImplThread() OVERRIDE; 81 82 virtual void setNeedsCommitOnImplThread() OVERRIDE; -
trunk/Source/WebKit/chromium/ChangeLog
r125211 r125212 1 2012-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 1 62 2012-08-09 Alec Flett <alecflett@chromium.org> 2 63 -
trunk/Source/WebKit/chromium/WebKit.gyp
r125184 r125212 301 301 'public/platform/WebColor.h', 302 302 'public/platform/WebCommon.h', 303 'public/platform/WebCompositorOutputSurface.h', 304 'public/platform/WebCompositorOutputSurfaceClient.h', 303 305 'public/platform/WebContentLayer.h', 304 306 'public/platform/WebContentLayerClient.h', -
trunk/Source/WebKit/chromium/WebKit.gypi
r124974 r125212 105 105 'tests/FakeCCLayerTreeHostClient.h', 106 106 'tests/FakeGraphicsContext3DTest.cpp', 107 'tests/FakeWebCompositorOutputSurface.h', 107 108 'tests/FakeWebGraphicsContext3D.h', 108 109 'tests/FakeWebScrollbarThemeGeometry.h', -
trunk/Source/WebKit/chromium/public/WebSettings.h
r124372 r125212 54 54 }; 55 55 56 virtual bool forceSoftwareCompositing() const = 0;57 56 virtual bool scrollAnimatorEnabled() const = 0; 58 57 virtual bool viewportEnabled() const = 0; … … 103 102 virtual void setFontRenderingModeNormal() = 0; 104 103 virtual void setForceCompositingMode(bool) = 0; 105 virtual void setForceSoftwareCompositing(bool) = 0;106 104 virtual void setFrameFlatteningEnabled(bool) = 0; 107 105 virtual void setFullScreenEnabled(bool) = 0; -
trunk/Source/WebKit/chromium/public/WebViewClient.h
r124394 r125212 54 54 class WebColorChooser; 55 55 class WebColorChooserClient; 56 class WebCompositorOutputSurface; 56 57 class WebDeviceOrientationClient; 57 58 class WebDragData; … … 119 120 virtual WebStorageNamespace* createSessionStorageNamespace(unsigned quota) { return 0; } 120 121 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. 122 123 virtual WebGraphicsContext3D* createGraphicsContext3D(const WebGraphicsContext3D::Attributes&) { return 0; } 123 124 125 // Creates the output surface that renders to the client's WebView. 126 virtual WebCompositorOutputSurface* createOutputSurface() { return 0; } 124 127 125 128 // Misc ---------------------------------------------------------------- -
trunk/Source/WebKit/chromium/src/WebLayerTreeView.cpp
r124543 r125212 47 47 { 48 48 CCLayerTreeSettings settings; 49 settings.forceSoftwareCompositing = forceSoftwareCompositing;50 49 settings.showFPSCounter = showFPSCounter; 51 50 settings.showPlatformLayerTree = showPlatformLayerTree; -
trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp
r124917 r125212 40 40 using namespace WebCore; 41 41 42 namespace { 43 44 // Adapts a pure WebGraphicsContext3D into a WebCompositorOutputSurface until 45 // downstream code can be updated to produce output surfaces directly. 46 class WebGraphicsContextToOutputSurfaceAdapter : public WebKit::WebCompositorOutputSurface { 47 public: 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 77 private: 78 OwnPtr<WebKit::WebGraphicsContext3D> m_context3D; 79 Capabilities m_capabilities; 80 WebKit::WebCompositorOutputSurfaceClient* m_client; 81 }; 82 83 } 84 42 85 namespace WebKit { 43 86 … … 45 88 class WebLayerTreeViewClientAdapter : public WebCore::CCLayerTreeHostClient { 46 89 public: 47 WebLayerTreeViewClientAdapter(WebLayerTreeViewClient* client) : m_client(client) { } 90 WebLayerTreeViewClientAdapter(WebLayerTreeViewClient* client) 91 : m_client(client) 92 , m_usingRealOutputSurface(false) 93 { 94 } 48 95 virtual ~WebLayerTreeViewClientAdapter() { } 49 96 … … 54 101 virtual void layout() OVERRIDE { m_client->layout(); } 55 102 virtual void applyScrollAndScale(const WebCore::IntSize& scrollDelta, float pageScale) OVERRIDE { m_client->applyScrollAndScale(scrollDelta, pageScale); } 56 virtual PassOwnPtr<Web GraphicsContext3D> createContext3D() OVERRIDE103 virtual PassOwnPtr<WebCompositorOutputSurface> createOutputSurface() OVERRIDE 57 104 { 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))); 59 120 } 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 } 61 130 virtual void willCommit() OVERRIDE { m_client->willCommit(); } 62 131 virtual void didCommit() OVERRIDE { m_client->didCommit(); } … … 67 136 private: 68 137 WebLayerTreeViewClient* m_client; 138 bool m_usingRealOutputSurface; 69 139 }; 70 140 -
trunk/Source/WebKit/chromium/src/WebSettingsImpl.cpp
r124372 r125212 48 48 WebSettingsImpl::WebSettingsImpl(Settings* settings) 49 49 : m_settings(settings) 50 , m_forceSoftwareCompositing(false)51 50 , m_showFPSCounter(false) 52 51 , m_showPlatformLayerTree(false) … … 414 413 } 415 414 416 void WebSettingsImpl::setForceSoftwareCompositing(bool enabled)417 {418 m_forceSoftwareCompositing = enabled;419 }420 421 415 void WebSettingsImpl::setMockScrollbarsEnabled(bool enabled) 422 416 { -
trunk/Source/WebKit/chromium/src/WebSettingsImpl.h
r124372 r125212 46 46 47 47 virtual bool deviceSupportsTouch(); 48 virtual bool forceSoftwareCompositing() const { return m_forceSoftwareCompositing; }49 48 virtual bool scrollAnimatorEnabled() const; 50 49 virtual bool viewportEnabled() const { return m_viewportEnabled; } … … 95 94 virtual void setFontRenderingModeNormal(); 96 95 virtual void setForceCompositingMode(bool); 97 virtual void setForceSoftwareCompositing(bool);98 96 virtual void setFrameFlatteningEnabled(bool); 99 97 virtual void setFullScreenEnabled(bool); … … 165 163 private: 166 164 WebCore::Settings* m_settings; 167 bool m_forceSoftwareCompositing;168 165 bool m_showFPSCounter; 169 166 bool m_showPlatformLayerTree; -
trunk/Source/WebKit/chromium/src/WebViewImpl.cpp
r125108 r125212 150 150 #include <public/Platform.h> 151 151 #include <public/WebCompositor.h> 152 #include <public/WebCompositorOutputSurface.h> 152 153 #include <public/WebDragData.h> 153 154 #include <public/WebFloatPoint.h> … … 3636 3637 layerTreeViewSettings.showPaintRects = settingsImpl()->showPaintRects(); 3637 3638 layerTreeViewSettings.renderVSyncEnabled = settingsImpl()->renderVSyncEnabled(); 3638 layerTreeViewSettings.forceSoftwareCompositing = settings()->forceSoftwareCompositing();3639 3639 3640 3640 layerTreeViewSettings.defaultTileSize = settingsImpl()->defaultTileSize(); … … 3688 3688 #endif 3689 3689 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. 3690 namespace { 3691 3692 // Adapts a pure WebGraphicsContext3D into a WebCompositorOutputSurface until 3693 // downstream code can be updated to produce output surfaces directly. 3694 class WebGraphicsContextToOutputSurfaceAdapter : public WebCompositorOutputSurface { 3695 public: 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 3725 private: 3726 OwnPtr<WebGraphicsContext3D> m_context3D; 3727 Capabilities m_capabilities; 3728 WebCompositorOutputSurfaceClient* m_client; 3729 }; 3730 3731 } // namespace 3732 3733 WebGraphicsContext3D* 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. 3705 3738 WebKit::WebGraphicsContext3D::Attributes attributes; 3706 3739 attributes.antialias = false; 3707 3740 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 3744 WebCompositorOutputSurface* WebViewImpl::createOutputSurface() 3745 { 3746 return m_client->createOutputSurface(); 3731 3747 } 3732 3748 … … 3778 3794 void WebViewImpl::didRebindGraphicsContext(bool success) 3779 3795 { 3780 3796 didRecreateOutputSurface(success); 3797 } 3798 3799 void WebViewImpl::didRecreateOutputSurface(bool success) 3800 { 3781 3801 // Switch back to software rendering mode, if necessary 3782 3802 if (!success) { -
trunk/Source/WebKit/chromium/src/WebViewImpl.h
r124478 r125212 313 313 virtual void updateAnimations(double monotonicFrameBeginTime); 314 314 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; 317 319 virtual void willCommit(); 318 320 virtual void didCommit(); … … 537 539 538 540 virtual WebGraphicsContext3D* sharedGraphicsContext3D(); 539 540 PassOwnPtr<WebGraphicsContext3D> createCompositorGraphicsContext3D();541 541 542 542 virtual void setVisibilityState(WebPageVisibilityState, bool); … … 833 833 #endif 834 834 835 // If we attempt to fetch the on-screen GraphicsContext3D before836 // the compositor has been turned on, we need to instantiate it837 // early. This member holds on to the GC3D in this case.838 OwnPtr<WebGraphicsContext3D> m_temporaryOnscreenGraphicsContext3D;839 835 OwnPtr<DeviceOrientationClientProxy> m_deviceOrientationClientProxy; 840 836 OwnPtr<GeolocationClientProxy> m_geolocationClientProxy; -
trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp
r125196 r125212 31 31 #include "CCLayerTreeTestCommon.h" 32 32 #include "CCTestCommon.h" 33 #include "FakeWebCompositorOutputSurface.h" 33 34 #include "FakeWebGraphicsContext3D.h" 34 35 #include "FakeWebScrollbarThemeGeometry.h" … … 82 83 virtual void didLoseContextOnImplThread() OVERRIDE { } 83 84 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { } 85 virtual void onVSyncParametersChanged(double, double) OVERRIDE { } 84 86 virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = true; } 85 87 virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = true; } … … 177 179 PassOwnPtr<CCGraphicsContext> createContext() 178 180 { 179 return CCGraphicsContext::create3D(adoptPtr(new FakeWebGraphicsContext3D));181 return FakeWebCompositorOutputSurface::create(adoptPtr(new FakeWebGraphicsContext3D)); 180 182 } 181 183 … … 1579 1581 TEST_F(CCLayerTreeHostImplTest, reshapeNotCalledUntilDraw) 1580 1582 { 1581 OwnPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(adoptPtr(new ReshapeTrackerContext));1583 OwnPtr<CCGraphicsContext> ccContext = FakeWebCompositorOutputSurface::create(adoptPtr(new ReshapeTrackerContext)); 1582 1584 ReshapeTrackerContext* reshapeTracker = static_cast<ReshapeTrackerContext*>(ccContext->context3D()); 1583 1585 m_hostImpl->initializeLayerRenderer(ccContext.release(), UnthrottledUploader); … … 1622 1624 TEST_F(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect) 1623 1625 { 1624 OwnPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(adoptPtr(new PartialSwapTrackerContext));1626 OwnPtr<CCGraphicsContext> ccContext = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapTrackerContext)); 1625 1627 PartialSwapTrackerContext* partialSwapTracker = static_cast<PartialSwapTrackerContext*>(ccContext->context3D()); 1626 1628 … … 1834 1836 TEST_F(CCLayerTreeHostImplTest, noPartialSwap) 1835 1837 { 1836 OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new MockContext));1838 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new MockContext)); 1837 1839 MockContext* mockContext = static_cast<MockContext*>(context->context3D()); 1838 1840 MockContextHarness harness(mockContext); … … 1853 1855 TEST_F(CCLayerTreeHostImplTest, partialSwap) 1854 1856 { 1855 OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new MockContext));1857 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new MockContext)); 1856 1858 MockContext* mockContext = static_cast<MockContext*>(context->context3D()); 1857 1859 MockContextHarness harness(mockContext); … … 1911 1913 CCSettings::setPartialSwapEnabled(partialSwap); 1912 1914 1913 OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext));1915 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapContext)); 1914 1916 1915 1917 CCLayerTreeSettings settings; … … 2069 2071 { 2070 2072 // 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); 2072 2074 m_hostImpl->finishAllRendering(); 2073 2075 } … … 2351 2353 2352 2354 // 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); 2354 2356 2355 2357 hwVideoFrame.setTextureId(m_hostImpl->resourceProvider()->graphicsContext3D()->createTexture()); … … 2367 2369 // Lose the context, replacing it with a StrictWebGraphicsContext3DWithIOSurface, 2368 2370 // 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); 2370 2372 2371 2373 // Create dummy resources so that looking up an old resource will get an … … 2478 2480 2479 2481 // 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))); 2481 2483 TrackingWebGraphicsContext3D* trackingWebGraphicsContext = static_cast<TrackingWebGraphicsContext3D*>(ccContext->context3D()); 2482 2484 m_hostImpl->initializeLayerRenderer(ccContext.release(), UnthrottledUploader); … … 2506 2508 TEST_F(CCLayerTreeHostImplTest, hasTransparentBackground) 2507 2509 { 2508 OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new MockDrawQuadsToFillScreenContext));2510 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new MockDrawQuadsToFillScreenContext)); 2509 2511 MockDrawQuadsToFillScreenContext* mockContext = static_cast<MockDrawQuadsToFillScreenContext*>(context->context3D()); 2510 2512 … … 2550 2552 static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl, CCLayerImpl*& rootPtr, CCLayerImpl*& intermediateLayerPtr, CCLayerImpl*& surfaceLayerPtr, CCLayerImpl*& childPtr, const IntSize& rootSize) 2551 2553 { 2552 OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext));2554 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapContext)); 2553 2555 2554 2556 layerTreeHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader); … … 2594 2596 CCLayerImpl* surfaceLayerPtr; 2595 2597 2596 OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext));2598 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapContext)); 2597 2599 2598 2600 IntSize rootSize(100, 100); … … 2706 2708 CCLayerImpl* layerS2Ptr; 2707 2709 2708 OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext));2710 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapContext)); 2709 2711 2710 2712 IntSize rootSize(1000, 1000); … … 2819 2821 CCLayerImpl* layerS2Ptr; 2820 2822 2821 OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext));2823 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapContext)); 2822 2824 2823 2825 IntSize rootSize(1000, 1000); … … 2933 2935 CCLayerImpl* layerS2Ptr; 2934 2936 2935 OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext));2937 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapContext)); 2936 2938 2937 2939 IntSize rootSize(1000, 1000); … … 3016 3018 CCLayerImpl* layerS1Ptr; 3017 3019 3018 OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext));3020 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapContext)); 3019 3021 3020 3022 IntSize rootSize(1000, 1000); … … 3101 3103 CCLayerImpl* layerS2Ptr; 3102 3104 3103 OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext));3105 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapContext)); 3104 3106 3105 3107 IntSize rootSize(1000, 1000); … … 3222 3224 IntRect grandChildRect(5, 5, 150, 150); 3223 3225 3224 OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext));3226 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(adoptPtr(new PartialSwapContext)); 3225 3227 myHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader); 3226 3228 -
trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp
r125117 r125212 1949 1949 SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestManySurfaces) 1950 1950 1951 // A loseContext(1) should lead to a didRecreate Context(true)1951 // A loseContext(1) should lead to a didRecreateOutputSurface(true) 1952 1952 class CCLayerTreeHostTestSetSingleLostContext : public CCLayerTreeHostTest { 1953 1953 public: … … 1966 1966 } 1967 1967 1968 virtual void didRecreate Context(bool succeeded)1968 virtual void didRecreateOutputSurface(bool succeeded) 1969 1969 { 1970 1970 EXPECT_TRUE(succeeded); … … 1982 1982 } 1983 1983 1984 // A loseContext(10) should lead to a didRecreate Context(false), and1984 // A loseContext(10) should lead to a didRecreateOutputSurface(false), and 1985 1985 // a finishAllRendering() should not hang. 1986 1986 class CCLayerTreeHostTestSetRepeatedLostContext : public CCLayerTreeHostTest { … … 2000 2000 } 2001 2001 2002 virtual void didRecreate Context(bool succeeded)2002 virtual void didRecreateOutputSurface(bool succeeded) 2003 2003 { 2004 2004 EXPECT_FALSE(succeeded); -
trunk/Source/WebKit/chromium/tests/CCResourceProviderTest.cpp
r123370 r125212 29 29 #include "CompositorFakeWebGraphicsContext3D.h" 30 30 #include "Extensions3DChromium.h" 31 #include "FakeWebCompositorOutputSurface.h" 31 32 #include "cc/CCGraphicsContext.h" 32 33 #include "cc/CCSingleThreadProxy.h" // For DebugScopedSetImplThread … … 189 190 public: 190 191 CCResourceProviderTest() 191 : m_context( CCGraphicsContext::create3D(ResourceProviderContext::create()))192 : m_context(FakeWebCompositorOutputSurface::create(ResourceProviderContext::create())) 192 193 , m_resourceProvider(CCResourceProvider::create(m_context.get())) 193 194 { -
trunk/Source/WebKit/chromium/tests/CCTextureUpdateControllerTest.cpp
r125095 r125212 29 29 #include "CCSchedulerTestCommon.h" 30 30 #include "CCTiledLayerTestCommon.h" 31 #include "FakeWebCompositorOutputSurface.h" 31 32 #include "FakeWebGraphicsContext3D.h" 32 33 #include "cc/CCSingleThreadProxy.h" // For DebugScopedSetImplThread … … 174 175 WebCompositor::initialize(thread.get()); 175 176 176 m_context = CCGraphicsContext::create3D( 177 adoptPtr(new WebGraphicsContext3DForUploadTest(this))); 177 m_context = FakeWebCompositorOutputSurface::create(adoptPtr(new WebGraphicsContext3DForUploadTest(this))); 178 178 DebugScopedSetImplThread implThread; 179 179 m_resourceProvider = CCResourceProvider::create(m_context.get()); -
trunk/Source/WebKit/chromium/tests/CCThreadedTest.cpp
r125095 r125212 31 31 #include "CCTiledLayerTestCommon.h" 32 32 #include "ContentLayerChromium.h" 33 #include "FakeWebCompositorOutputSurface.h" 33 34 #include "FakeWebGraphicsContext3D.h" 34 35 #include "LayerChromium.h" … … 99 100 } 100 101 101 PassOwnPtr<Web GraphicsContext3D> TestHooks::createContext()102 { 103 return CompositorFakeWebGraphicsContext3DWithTextureTracking::create(WebGraphicsContext3D::Attributes());102 PassOwnPtr<WebCompositorOutputSurface> TestHooks::createOutputSurface() 103 { 104 return FakeWebCompositorOutputSurface::create(CompositorFakeWebGraphicsContext3DWithTextureTracking::create(WebGraphicsContext3D::Attributes())); 104 105 } 105 106 … … 223 224 } 224 225 225 virtual PassOwnPtr<Web GraphicsContext3D> createContext3D() OVERRIDE226 { 227 return m_testHooks->create Context();226 virtual PassOwnPtr<WebCompositorOutputSurface> createOutputSurface() OVERRIDE 227 { 228 return m_testHooks->createOutputSurface(); 228 229 } 229 230 … … 246 247 } 247 248 248 virtual void didRecreate Context(bool succeeded) OVERRIDE249 { 250 m_testHooks->didRecreate Context(succeeded);249 virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE 250 { 251 m_testHooks->didRecreateOutputSurface(succeeded); 251 252 } 252 253 -
trunk/Source/WebKit/chromium/tests/CCThreadedTest.h
r124239 r125212 59 59 virtual void updateAnimations(double monotonicTime) { } 60 60 virtual void layout() { } 61 virtual void didRecreate Context(bool succeeded) { }61 virtual void didRecreateOutputSurface(bool succeeded) { } 62 62 virtual void didAddAnimation() { } 63 63 virtual void didCommit() { } … … 69 69 virtual void notifyAnimationFinished(double time) OVERRIDE { } 70 70 71 virtual PassOwnPtr<WebKit::Web GraphicsContext3D> createContext();71 virtual PassOwnPtr<WebKit::WebCompositorOutputSurface> createOutputSurface(); 72 72 }; 73 73 -
trunk/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp
r124927 r125212 27 27 #include "Canvas2DLayerBridge.h" 28 28 29 #include "FakeWebCompositorOutputSurface.h" 29 30 #include "FakeWebGraphicsContext3D.h" 30 31 #include "GraphicsContext3DPrivate.h" … … 76 77 { 77 78 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)); 79 80 80 81 MockCanvasContext& mainMock = *static_cast<MockCanvasContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(mainContext.get())); -
trunk/Source/WebKit/chromium/tests/FakeCCGraphicsContext.h
r123065 r125212 28 28 29 29 #include "CompositorFakeWebGraphicsContext3D.h" 30 #include "FakeWebCompositorOutputSurface.h" 30 31 #include "cc/CCGraphicsContext.h" 32 #include <public/WebCompositorOutputSurface.h> 31 33 32 34 namespace WebKit { … … 34 36 static inline PassOwnPtr<WebCore::CCGraphicsContext> createFakeCCGraphicsContext() 35 37 { 36 return WebCore::CCGraphicsContext::create3D(CompositorFakeWebGraphicsContext3D::create(WebGraphicsContext3D::Attributes()));38 return FakeWebCompositorOutputSurface::create(CompositorFakeWebGraphicsContext3D::create(WebGraphicsContext3D::Attributes())); 37 39 } 38 40 -
trunk/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h
r121204 r125212 29 29 30 30 #include "CompositorFakeWebGraphicsContext3D.h" 31 #include "FakeWebCompositorOutputSurface.h" 32 31 33 #include "cc/CCLayerTreeHost.h" 32 34 … … 40 42 virtual void layout() OVERRIDE { } 41 43 virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) OVERRIDE { } 42 virtual PassOwnPtr<WebKit::WebGraphicsContext3D> createContext3D() OVERRIDE 44 45 virtual PassOwnPtr<WebKit::WebCompositorOutputSurface> createOutputSurface() OVERRIDE 43 46 { 44 47 WebKit::WebGraphicsContext3D::Attributes attrs; 45 return WebKit:: CompositorFakeWebGraphicsContext3D::create(WebKit::WebGraphicsContext3D::Attributes());48 return WebKit::FakeWebCompositorOutputSurface::create(WebKit::CompositorFakeWebGraphicsContext3D::create(attrs)); 46 49 } 47 virtual void didRecreate Context(bool success) OVERRIDE { }50 virtual void didRecreateOutputSurface(bool success) OVERRIDE { } 48 51 virtual void willCommit() OVERRIDE { } 49 52 virtual void didCommit() OVERRIDE { } -
trunk/Source/WebKit/chromium/tests/FakeWebCompositorOutputSurface.h
r125211 r125212 24 24 */ 25 25 26 #ifndef CCGraphicsContext_h27 #define CCGraphicsContext_h26 #ifndef FakeWebCompositorOutputSurface_h 27 #define FakeWebCompositorOutputSurface_h 28 28 29 #include <public/WebCompositorOutputSurface.h> 29 30 #include <public/WebGraphicsContext3D.h> 30 #include <wtf/Noncopyable.h>31 #include <wtf/OwnPtr.h>32 #include <wtf/PassOwnPtr.h>33 31 34 namespace WebCore { 32 namespace WebKit { 33 34 class FakeWebCompositorOutputSurface : public WebCompositorOutputSurface { 35 public: 36 static inline PassOwnPtr<FakeWebCompositorOutputSurface> create(PassOwnPtr<WebGraphicsContext3D> context3D) 37 { 38 return adoptPtr(new FakeWebCompositorOutputSurface(context3D)); 39 } 35 40 36 41 37 class CCGraphicsContext { 38 WTF_MAKE_NONCOPYABLE(CCGraphicsContext); 39 public: 40 static PassOwnPtr<CCGraphicsContext> create2D() 42 virtual bool bindToClient(WebCompositorOutputSurfaceClient* client) OVERRIDE 41 43 { 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; 47 49 } 48 50 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 } 50 64 51 65 private: 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 } 55 70 56 OwnPtr<WebKit::WebGraphicsContext3D> m_context3D; 71 OwnPtr<WebGraphicsContext3D> m_context3D; 72 Capabilities m_capabilities; 73 WebCompositorOutputSurfaceClient* m_client; 57 74 }; 58 75 59 } 76 } // namespace WebKit 60 77 61 #endif // CCGraphicsContext_h78 #endif // FakeWebCompositorOutputSurface_h -
trunk/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp
r125196 r125212 27 27 28 28 #include "CCTestCommon.h" 29 #include "FakeWebCompositorOutputSurface.h" 29 30 #include "FakeWebGraphicsContext3D.h" 30 31 #include "GraphicsContext3D.h" … … 129 130 : m_suggestHaveBackbufferYes(1, true) 130 131 , m_suggestHaveBackbufferNo(1, false) 131 , m_context( CCGraphicsContext::create3D(adoptPtr(new FrameCountingMemoryAllocationSettingContext())))132 , m_context(FakeWebCompositorOutputSurface::create(adoptPtr(new FrameCountingMemoryAllocationSettingContext()))) 132 133 , m_resourceProvider(CCResourceProvider::create(m_context.get())) 133 134 , m_layerRendererChromium(&m_mockClient, m_resourceProvider.get()) … … 319 320 CCScopedSettings scopedSettings; 320 321 FakeCCRendererClient mockClient; 321 OwnPtr<CCGraphicsContext> context( CCGraphicsContext::create3D(adoptPtr(new ForbidSynchronousCallContext)));322 OwnPtr<CCGraphicsContext> context(FakeWebCompositorOutputSurface::create(adoptPtr(new ForbidSynchronousCallContext))); 322 323 OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(context.get())); 323 324 FakeLayerRendererChromium layerRendererChromium(&mockClient, resourceProvider.get()); … … 363 364 CCScopedSettings scopedSettings; 364 365 FakeCCRendererClient mockClient; 365 OwnPtr<CCGraphicsContext> context( CCGraphicsContext::create3D(adoptPtr(new LoseContextOnFirstGetContext)));366 OwnPtr<CCGraphicsContext> context(FakeWebCompositorOutputSurface::create(adoptPtr(new LoseContextOnFirstGetContext))); 366 367 OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(context.get())); 367 368 FakeLayerRendererChromium layerRendererChromium(&mockClient, resourceProvider.get()); … … 385 386 { 386 387 FakeCCRendererClient mockClient; 387 OwnPtr<CCGraphicsContext> context( CCGraphicsContext::create3D(adoptPtr(new ContextThatDoesNotSupportMemoryManagmentExtensions)));388 OwnPtr<CCGraphicsContext> context(FakeWebCompositorOutputSurface::create(adoptPtr(new ContextThatDoesNotSupportMemoryManagmentExtensions))); 388 389 OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(context.get())); 389 390 FakeLayerRendererChromium layerRendererChromium(&mockClient, resourceProvider.get()); … … 412 413 { 413 414 FakeCCRendererClient mockClient; 414 OwnPtr<CCGraphicsContext> ccContext( CCGraphicsContext::create3D(adoptPtr(new ClearCountingContext)));415 OwnPtr<CCGraphicsContext> ccContext(FakeWebCompositorOutputSurface::create(adoptPtr(new ClearCountingContext))); 415 416 ClearCountingContext* context = static_cast<ClearCountingContext*>(ccContext->context3D()); 416 417 OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(ccContext.get())); … … 435 436 { 436 437 FakeCCRendererClient mockClient; 437 OwnPtr<CCGraphicsContext> ccContext( CCGraphicsContext::create3D(adoptPtr(new ClearCountingContext)));438 OwnPtr<CCGraphicsContext> ccContext(FakeWebCompositorOutputSurface::create(adoptPtr(new ClearCountingContext))); 438 439 ClearCountingContext* context = static_cast<ClearCountingContext*>(ccContext->context3D()); 439 440 OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(ccContext.get())); -
trunk/Source/WebKit/chromium/tests/WebLayerTest.cpp
r125095 r125212 59 59 virtual WebGraphicsContext3D* createContext3D() { return CompositorFakeWebGraphicsContext3D::create(WebGraphicsContext3D::Attributes()).leakPtr(); } 60 60 virtual void didRebindGraphicsContext(bool success) { } 61 virtual WebCompositorOutputSurface* createOutputSurface() { return 0; } 62 virtual void didRebindOutputSurface(bool success) { } 61 63 virtual void willCommit() { } 62 64 virtual void didCommitAndDrawFrame() { } -
trunk/Source/WebKit/chromium/tests/WebLayerTreeViewTest.cpp
r125095 r125212 28 28 29 29 #include "CompositorFakeWebGraphicsContext3D.h" 30 #include "FakeWebCompositorOutputSurface.h" 30 31 #include <gmock/gmock.h> 31 32 #include <public/Platform.h> … … 49 50 virtual void layout() OVERRIDE { } 50 51 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 53 59 MOCK_METHOD0(willCommit, void()); 54 60 MOCK_METHOD0(didCommit, void());
Note:
See TracChangeset
for help on using the changeset viewer.