| 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 #ifndef FakeWebCompositorOutputSurface_h |
| 6 #define FakeWebCompositorOutputSurface_h | 6 #define FakeWebCompositorOutputSurface_h |
| 7 | 7 |
| 8 #include "base/logging.h" | |
| 9 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 10 #include "cc/test/fake_web_compositor_software_output_device.h" | 9 #include "cc/test/fake_web_compositor_software_output_device.h" |
| 11 #include <public/WebCompositorOutputSurface.h> | 10 #include <public/WebCompositorOutputSurface.h> |
| 12 #include <public/WebGraphicsContext3D.h> | 11 #include <public/WebGraphicsContext3D.h> |
| 13 #include <wtf/OwnPtr.h> | 12 #include <wtf/OwnPtr.h> |
| 14 #include <wtf/PassOwnPtr.h> | 13 #include <wtf/PassOwnPtr.h> |
| 15 | 14 |
| 16 namespace WebKit { | 15 namespace WebKit { |
| 17 | 16 |
| 18 class FakeWebCompositorOutputSurface : public WebCompositorOutputSurface { | 17 class FakeWebCompositorOutputSurface : public WebCompositorOutputSurface { |
| 19 public: | 18 public: |
| 20 static inline scoped_ptr<FakeWebCompositorOutputSurface> create(PassOwnPtr<W
ebGraphicsContext3D> context3D) | 19 static inline scoped_ptr<FakeWebCompositorOutputSurface> create(PassOwnPtr<W
ebGraphicsContext3D> context3D) |
| 21 { | 20 { |
| 22 return make_scoped_ptr(new FakeWebCompositorOutputSurface(context3D)); | 21 return make_scoped_ptr(new FakeWebCompositorOutputSurface(context3D)); |
| 23 } | 22 } |
| 24 | 23 |
| 25 static inline scoped_ptr<FakeWebCompositorOutputSurface> createSoftware(Pass
OwnPtr<WebCompositorSoftwareOutputDevice> softwareDevice) | 24 static inline scoped_ptr<FakeWebCompositorOutputSurface> createSoftware(Pass
OwnPtr<WebCompositorSoftwareOutputDevice> softwareDevice) |
| 26 { | 25 { |
| 27 return make_scoped_ptr(new FakeWebCompositorOutputSurface(softwareDevice
)); | 26 return make_scoped_ptr(new FakeWebCompositorOutputSurface(softwareDevice
)); |
| 28 } | 27 } |
| 29 | 28 |
| 30 virtual bool bindToClient(WebCompositorOutputSurfaceClient* client) OVERRIDE | 29 virtual bool bindToClient(WebCompositorOutputSurfaceClient* client) OVERRIDE |
| 31 { | 30 { |
| 32 if (!m_context3D) | 31 if (!m_context3D) |
| 33 return true; | 32 return true; |
| 34 DCHECK(client); | 33 ASSERT(client); |
| 35 if (!m_context3D->makeContextCurrent()) | 34 if (!m_context3D->makeContextCurrent()) |
| 36 return false; | 35 return false; |
| 37 m_client = client; | 36 m_client = client; |
| 38 return true; | 37 return true; |
| 39 } | 38 } |
| 40 | 39 |
| 41 virtual const Capabilities& capabilities() const OVERRIDE | 40 virtual const Capabilities& capabilities() const OVERRIDE |
| 42 { | 41 { |
| 43 return m_capabilities; | 42 return m_capabilities; |
| 44 } | 43 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 69 | 68 |
| 70 OwnPtr<WebGraphicsContext3D> m_context3D; | 69 OwnPtr<WebGraphicsContext3D> m_context3D; |
| 71 OwnPtr<WebCompositorSoftwareOutputDevice> m_softwareDevice; | 70 OwnPtr<WebCompositorSoftwareOutputDevice> m_softwareDevice; |
| 72 Capabilities m_capabilities; | 71 Capabilities m_capabilities; |
| 73 WebCompositorOutputSurfaceClient* m_client; | 72 WebCompositorOutputSurfaceClient* m_client; |
| 74 }; | 73 }; |
| 75 | 74 |
| 76 } // namespace WebKit | 75 } // namespace WebKit |
| 77 | 76 |
| 78 #endif // FakeWebCompositorOutputSurface_h | 77 #endif // FakeWebCompositorOutputSurface_h |
| OLD | NEW |