| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CC_TEST_FAKE_WEB_COMPOSITOR_OUTPUT_SURFACE_H_ | |
| 6 #define CC_TEST_FAKE_WEB_COMPOSITOR_OUTPUT_SURFACE_H_ | |
| 7 | |
| 8 #include "base/logging.h" | |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "cc/test/fake_web_compositor_software_output_device.h" | |
| 11 #include <public/WebCompositorOutputSurface.h> | |
| 12 #include <public/WebGraphicsContext3D.h> | |
| 13 | |
| 14 namespace WebKit { | |
| 15 | |
| 16 class FakeWebCompositorOutputSurface : public WebCompositorOutputSurface { | |
| 17 public: | |
| 18 static inline scoped_ptr<FakeWebCompositorOutputSurface> create(scoped_ptr<W
ebGraphicsContext3D> context3D) | |
| 19 { | |
| 20 return make_scoped_ptr(new FakeWebCompositorOutputSurface(context3D.Pass
())); | |
| 21 } | |
| 22 | |
| 23 static inline scoped_ptr<FakeWebCompositorOutputSurface> createSoftware(scop
ed_ptr<WebCompositorSoftwareOutputDevice> softwareDevice) | |
| 24 { | |
| 25 return make_scoped_ptr(new FakeWebCompositorOutputSurface(softwareDevice
.Pass())); | |
| 26 } | |
| 27 | |
| 28 virtual bool bindToClient(WebCompositorOutputSurfaceClient* client) OVERRIDE | |
| 29 { | |
| 30 if (!m_context3D) | |
| 31 return true; | |
| 32 DCHECK(client); | |
| 33 if (!m_context3D->makeContextCurrent()) | |
| 34 return false; | |
| 35 m_client = client; | |
| 36 return true; | |
| 37 } | |
| 38 | |
| 39 virtual const Capabilities& capabilities() const OVERRIDE | |
| 40 { | |
| 41 return m_capabilities; | |
| 42 } | |
| 43 | |
| 44 virtual WebGraphicsContext3D* context3D() const OVERRIDE | |
| 45 { | |
| 46 return m_context3D.get(); | |
| 47 } | |
| 48 virtual WebCompositorSoftwareOutputDevice* softwareDevice() const OVERRIDE | |
| 49 { | |
| 50 return m_softwareDevice.get(); | |
| 51 } | |
| 52 | |
| 53 virtual void sendFrameToParentCompositor(const WebCompositorFrame&) OVERRIDE | |
| 54 { | |
| 55 } | |
| 56 | |
| 57 private: | |
| 58 explicit FakeWebCompositorOutputSurface(scoped_ptr<WebGraphicsContext3D> con
text3D) | |
| 59 { | |
| 60 m_context3D = context3D.Pass(); | |
| 61 } | |
| 62 | |
| 63 explicit FakeWebCompositorOutputSurface(scoped_ptr<WebCompositorSoftwareOutp
utDevice> softwareDevice) | |
| 64 { | |
| 65 m_softwareDevice = softwareDevice.Pass(); | |
| 66 } | |
| 67 | |
| 68 scoped_ptr<WebGraphicsContext3D> m_context3D; | |
| 69 scoped_ptr<WebCompositorSoftwareOutputDevice> m_softwareDevice; | |
| 70 Capabilities m_capabilities; | |
| 71 WebCompositorOutputSurfaceClient* m_client; | |
| 72 }; | |
| 73 | |
| 74 } // namespace WebKit | |
| 75 | |
| 76 #endif // CC_TEST_FAKE_WEB_COMPOSITOR_OUTPUT_SURFACE_H_ | |
| OLD | NEW |