| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef FakeWebCompositorOutputSurface_h | 5 // Temporary forwarding header |
| 6 #define FakeWebCompositorOutputSurface_h | 6 #include "cc/test/fake_web_compositor_output_surface.h" |
| 7 | |
| 8 #include "base/memory/scoped_ptr.h" | |
| 9 #include "FakeWebCompositorSoftwareOutputDevice.h" | |
| 10 #include <public/WebCompositorOutputSurface.h> | |
| 11 #include <public/WebGraphicsContext3D.h> | |
| 12 #include <wtf/OwnPtr.h> | |
| 13 #include <wtf/PassOwnPtr.h> | |
| 14 | |
| 15 namespace WebKit { | |
| 16 | |
| 17 class FakeWebCompositorOutputSurface : public WebCompositorOutputSurface { | |
| 18 public: | |
| 19 static inline scoped_ptr<FakeWebCompositorOutputSurface> create(PassOwnPtr<W
ebGraphicsContext3D> context3D) | |
| 20 { | |
| 21 return make_scoped_ptr(new FakeWebCompositorOutputSurface(context3D)); | |
| 22 } | |
| 23 | |
| 24 static inline scoped_ptr<FakeWebCompositorOutputSurface> createSoftware(Pass
OwnPtr<WebCompositorSoftwareOutputDevice> softwareDevice) | |
| 25 { | |
| 26 return make_scoped_ptr(new FakeWebCompositorOutputSurface(softwareDevice
)); | |
| 27 } | |
| 28 | |
| 29 virtual bool bindToClient(WebCompositorOutputSurfaceClient* client) OVERRIDE | |
| 30 { | |
| 31 if (!m_context3D) | |
| 32 return true; | |
| 33 ASSERT(client); | |
| 34 if (!m_context3D->makeContextCurrent()) | |
| 35 return false; | |
| 36 m_client = client; | |
| 37 return true; | |
| 38 } | |
| 39 | |
| 40 virtual const Capabilities& capabilities() const OVERRIDE | |
| 41 { | |
| 42 return m_capabilities; | |
| 43 } | |
| 44 | |
| 45 virtual WebGraphicsContext3D* context3D() const OVERRIDE | |
| 46 { | |
| 47 return m_context3D.get(); | |
| 48 } | |
| 49 virtual WebCompositorSoftwareOutputDevice* softwareDevice() const OVERRIDE | |
| 50 { | |
| 51 return m_softwareDevice.get(); | |
| 52 } | |
| 53 | |
| 54 virtual void sendFrameToParentCompositor(const WebCompositorFrame&) OVERRIDE | |
| 55 { | |
| 56 } | |
| 57 | |
| 58 private: | |
| 59 explicit FakeWebCompositorOutputSurface(PassOwnPtr<WebGraphicsContext3D> con
text3D) | |
| 60 { | |
| 61 m_context3D = context3D; | |
| 62 } | |
| 63 | |
| 64 explicit FakeWebCompositorOutputSurface(PassOwnPtr<WebCompositorSoftwareOutp
utDevice> softwareDevice) | |
| 65 { | |
| 66 m_softwareDevice = softwareDevice; | |
| 67 } | |
| 68 | |
| 69 OwnPtr<WebGraphicsContext3D> m_context3D; | |
| 70 OwnPtr<WebCompositorSoftwareOutputDevice> m_softwareDevice; | |
| 71 Capabilities m_capabilities; | |
| 72 WebCompositorOutputSurfaceClient* m_client; | |
| 73 }; | |
| 74 | |
| 75 } // namespace WebKit | |
| 76 | |
| 77 #endif // FakeWebCompositorOutputSurface_h | |
| OLD | NEW |