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