| 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" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "cc/compositor_frame.h" |
| 10 #include "cc/output_surface.h" | 11 #include "cc/output_surface.h" |
| 11 #include "cc/test/fake_software_output_device.h" | 12 #include "cc/test/fake_software_output_device.h" |
| 12 #include "cc/test/fake_web_graphics_context_3d.h" | 13 #include "cc/test/fake_web_graphics_context_3d.h" |
| 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" | 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" |
| 14 | 15 |
| 15 namespace cc { | 16 namespace cc { |
| 16 | 17 |
| 17 class FakeOutputSurface : public OutputSurface { | 18 class FakeOutputSurface : public OutputSurface { |
| 18 public: | 19 public: |
| 19 virtual ~FakeOutputSurface(); | 20 virtual ~FakeOutputSurface(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 40 new FakeOutputSurface(software_device.Pass(), true)); | 41 new FakeOutputSurface(software_device.Pass(), true)); |
| 41 } | 42 } |
| 42 | 43 |
| 43 virtual bool BindToClient(OutputSurfaceClient* client) OVERRIDE; | 44 virtual bool BindToClient(OutputSurfaceClient* client) OVERRIDE; |
| 44 | 45 |
| 45 virtual const struct Capabilities& Capabilities() const OVERRIDE; | 46 virtual const struct Capabilities& Capabilities() const OVERRIDE; |
| 46 | 47 |
| 47 virtual WebKit::WebGraphicsContext3D* Context3D() const OVERRIDE; | 48 virtual WebKit::WebGraphicsContext3D* Context3D() const OVERRIDE; |
| 48 virtual SoftwareOutputDevice* SoftwareDevice() const OVERRIDE; | 49 virtual SoftwareOutputDevice* SoftwareDevice() const OVERRIDE; |
| 49 | 50 |
| 50 virtual void SendFrameToParentCompositor(const CompositorFrame&) OVERRIDE; | 51 virtual void SendFrameToParentCompositor(CompositorFrame&) OVERRIDE; |
| 52 |
| 53 CompositorFrame& last_sent_frame() { return last_sent_frame_; } |
| 54 size_t num_sent_frames() { return num_sent_frames_; } |
| 51 | 55 |
| 52 private: | 56 private: |
| 53 explicit FakeOutputSurface( | 57 explicit FakeOutputSurface( |
| 54 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, bool has_parent); | 58 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, bool has_parent); |
| 55 explicit FakeOutputSurface( | 59 explicit FakeOutputSurface( |
| 56 scoped_ptr<SoftwareOutputDevice> software_device, bool has_parent); | 60 scoped_ptr<SoftwareOutputDevice> software_device, bool has_parent); |
| 57 | 61 |
| 58 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_; | 62 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_; |
| 59 scoped_ptr<SoftwareOutputDevice> software_device_; | 63 scoped_ptr<SoftwareOutputDevice> software_device_; |
| 60 struct Capabilities capabilities_; | 64 struct Capabilities capabilities_; |
| 61 OutputSurfaceClient* client_; | 65 OutputSurfaceClient* client_; |
| 66 CompositorFrame last_sent_frame_; |
| 67 size_t num_sent_frames_; |
| 62 }; | 68 }; |
| 63 | 69 |
| 64 static inline scoped_ptr<cc::OutputSurface> createFakeOutputSurface() | 70 static inline scoped_ptr<cc::OutputSurface> createFakeOutputSurface() |
| 65 { | 71 { |
| 66 return FakeOutputSurface::Create3d( | 72 return FakeOutputSurface::Create3d( |
| 67 FakeWebGraphicsContext3D::Create( | 73 FakeWebGraphicsContext3D::Create( |
| 68 WebKit::WebGraphicsContext3D::Attributes()) | 74 WebKit::WebGraphicsContext3D::Attributes()) |
| 69 .PassAs<WebKit::WebGraphicsContext3D>()) | 75 .PassAs<WebKit::WebGraphicsContext3D>()) |
| 70 .PassAs<cc::OutputSurface>(); | 76 .PassAs<cc::OutputSurface>(); |
| 71 } | 77 } |
| 72 | 78 |
| 73 } // namespace cc | 79 } // namespace cc |
| 74 | 80 |
| 75 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ | 81 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ |
| OLD | NEW |