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 CC_TEST_FAKE_OUTPUT_SURFACE_H_ | 5 #ifndef CC_TEST_FAKE_OUTPUT_SURFACE_H_ |
6 #define CC_TEST_FAKE_OUTPUT_SURFACE_H_ | 6 #define CC_TEST_FAKE_OUTPUT_SURFACE_H_ |
7 | 7 |
| 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" |
8 #include "cc/output_surface.h" | 10 #include "cc/output_surface.h" |
9 #include "cc/test/compositor_fake_web_graphics_context_3d.h" | 11 #include "cc/test/compositor_fake_web_graphics_context_3d.h" |
10 #include "cc/test/fake_web_compositor_output_surface.h" | 12 #include "cc/test/fake_software_output_device.h" |
11 #include <public/WebCompositorOutputSurface.h> | 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" |
12 | 14 |
13 namespace cc { | 15 namespace cc { |
14 | 16 |
| 17 class FakeOutputSurface : public OutputSurface { |
| 18 public: |
| 19 virtual ~FakeOutputSurface(); |
| 20 |
| 21 static inline scoped_ptr<FakeOutputSurface> Create3d( |
| 22 scoped_ptr<WebKit::WebGraphicsContext3D> context3d) { |
| 23 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass())); |
| 24 } |
| 25 |
| 26 static inline scoped_ptr<FakeOutputSurface> CreateSoftware( |
| 27 scoped_ptr<SoftwareOutputDevice> software_device) { |
| 28 return make_scoped_ptr(new FakeOutputSurface(software_device.Pass())); |
| 29 } |
| 30 |
| 31 virtual bool BindToClient(OutputSurfaceClient* client) OVERRIDE; |
| 32 |
| 33 virtual const struct Capabilities& Capabilities() const OVERRIDE; |
| 34 |
| 35 virtual WebKit::WebGraphicsContext3D* Context3D() const OVERRIDE; |
| 36 virtual SoftwareOutputDevice* SoftwareDevice() const OVERRIDE; |
| 37 |
| 38 virtual void SendFrameToParentCompositor(const CompositorFrame&) OVERRIDE; |
| 39 |
| 40 private: |
| 41 explicit FakeOutputSurface( |
| 42 scoped_ptr<WebKit::WebGraphicsContext3D> context3d); |
| 43 explicit FakeOutputSurface( |
| 44 scoped_ptr<SoftwareOutputDevice> software_device); |
| 45 |
| 46 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_; |
| 47 scoped_ptr<SoftwareOutputDevice> software_device_; |
| 48 struct Capabilities capabilities_; |
| 49 OutputSurfaceClient* client_; |
| 50 }; |
| 51 |
15 static inline scoped_ptr<cc::OutputSurface> createFakeOutputSurface() | 52 static inline scoped_ptr<cc::OutputSurface> createFakeOutputSurface() |
16 { | 53 { |
17 return WebKit::FakeWebCompositorOutputSurface::create(WebKit::CompositorFake
WebGraphicsContext3D::create(WebKit::WebGraphicsContext3D::Attributes()).PassAs<
WebKit::WebGraphicsContext3D>()).PassAs<cc::OutputSurface>(); | 54 return FakeOutputSurface::Create3d( |
| 55 WebKit::CompositorFakeWebGraphicsContext3D::create( |
| 56 WebKit::WebGraphicsContext3D::Attributes()) |
| 57 .PassAs<WebKit::WebGraphicsContext3D>()) |
| 58 .PassAs<cc::OutputSurface>(); |
18 } | 59 } |
19 | 60 |
20 } // namespace WebKit | 61 } // namespace cc |
21 | 62 |
22 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ | 63 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ |
OLD | NEW |