OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "cc/output/output_surface.h" | 5 #include "cc/output/output_surface.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
11 #include "cc/output/output_surface.h" | |
12 #include "cc/output/software_output_device.h" | 11 #include "cc/output/software_output_device.h" |
13 #include "cc/test/fake_output_surface_client.h" | 12 #include "cc/test/fake_output_surface_client.h" |
14 #include "cc/test/test_context_provider.h" | 13 #include "cc/test/test_context_provider.h" |
15 #include "cc/test/test_web_graphics_context_3d.h" | 14 #include "cc/test/test_web_graphics_context_3d.h" |
16 #include "gpu/GLES2/gl2extchromium.h" | 15 #include "gpu/GLES2/gl2extchromium.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
18 | 17 |
19 namespace cc { | 18 namespace cc { |
20 namespace { | 19 namespace { |
21 | 20 |
22 class TestOutputSurface : public OutputSurface { | 21 class TestOutputSurface : public OutputSurface { |
23 public: | 22 public: |
24 explicit TestOutputSurface( | 23 explicit TestOutputSurface( |
25 scoped_refptr<TestContextProvider> context_provider) | 24 scoped_refptr<TestContextProvider> context_provider) |
26 : OutputSurface(std::move(context_provider)) {} | 25 : OutputSurface(std::move(context_provider)) {} |
27 | 26 |
28 explicit TestOutputSurface( | 27 explicit TestOutputSurface( |
29 std::unique_ptr<SoftwareOutputDevice> software_device) | 28 std::unique_ptr<SoftwareOutputDevice> software_device) |
30 : OutputSurface(std::move(software_device)) {} | 29 : OutputSurface(std::move(software_device)) {} |
31 | 30 |
32 void EnsureBackbuffer() override {} | 31 void EnsureBackbuffer() override {} |
33 void DiscardBackbuffer() override {} | 32 void DiscardBackbuffer() override {} |
34 void BindFramebuffer() override {} | 33 void BindFramebuffer() override {} |
35 void SwapBuffers(CompositorFrame frame) override { | 34 void SwapBuffers(OutputSurfaceFrame frame) override { |
36 client_->DidSwapBuffersComplete(); | 35 client_->DidSwapBuffersComplete(); |
37 } | 36 } |
38 uint32_t GetFramebufferCopyTextureFormat() override { | 37 uint32_t GetFramebufferCopyTextureFormat() override { |
39 // TestContextProvider has no real framebuffer, just use RGB. | 38 // TestContextProvider has no real framebuffer, just use RGB. |
40 return GL_RGB; | 39 return GL_RGB; |
41 } | 40 } |
42 OverlayCandidateValidator* GetOverlayCandidateValidator() const override { | 41 OverlayCandidateValidator* GetOverlayCandidateValidator() const override { |
43 return nullptr; | 42 return nullptr; |
44 } | 43 } |
45 bool IsDisplayedAsOverlayPlane() const override { return false; } | 44 bool IsDisplayedAsOverlayPlane() const override { return false; } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 context_provider->UnboundTestContext3d()->set_context_lost(true); | 109 context_provider->UnboundTestContext3d()->set_context_lost(true); |
111 | 110 |
112 TestOutputSurface output_surface(context_provider); | 111 TestOutputSurface output_surface(context_provider); |
113 | 112 |
114 FakeOutputSurfaceClient client; | 113 FakeOutputSurfaceClient client; |
115 EXPECT_FALSE(output_surface.BindToClient(&client)); | 114 EXPECT_FALSE(output_surface.BindToClient(&client)); |
116 } | 115 } |
117 | 116 |
118 } // namespace | 117 } // namespace |
119 } // namespace cc | 118 } // namespace cc |
OLD | NEW |