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