| 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 #include "cc/output/gl_renderer.h" | 5 #include "cc/output/gl_renderer.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 int discarded() const { return discarded_; } | 1034 int discarded() const { return discarded_; } |
| 1035 void reset_discarded() { discarded_ = 0; } | 1035 void reset_discarded() { discarded_ = 0; } |
| 1036 | 1036 |
| 1037 private: | 1037 private: |
| 1038 int discarded_ = 0; | 1038 int discarded_ = 0; |
| 1039 }; | 1039 }; |
| 1040 | 1040 |
| 1041 class NonReshapableOutputSurface : public FakeOutputSurface { | 1041 class NonReshapableOutputSurface : public FakeOutputSurface { |
| 1042 public: | 1042 public: |
| 1043 explicit NonReshapableOutputSurface(std::unique_ptr<TestGLES2Interface> gl) | 1043 explicit NonReshapableOutputSurface(std::unique_ptr<TestGLES2Interface> gl) |
| 1044 : FakeOutputSurface(TestContextProvider::Create(std::move(gl)), | 1044 : FakeOutputSurface(TestContextProvider::Create(std::move(gl))) { |
| 1045 nullptr, | |
| 1046 false) { | |
| 1047 surface_size_ = gfx::Size(500, 500); | 1045 surface_size_ = gfx::Size(500, 500); |
| 1048 } | 1046 } |
| 1049 void Reshape(const gfx::Size& size, | 1047 void Reshape(const gfx::Size& size, |
| 1050 float scale_factor, | 1048 float scale_factor, |
| 1051 const gfx::ColorSpace& color_space, | 1049 const gfx::ColorSpace& color_space, |
| 1052 bool has_alpha) override {} | 1050 bool has_alpha) override {} |
| 1053 void set_fixed_size(const gfx::Size& size) { surface_size_ = size; } | 1051 void set_fixed_size(const gfx::Size& size) { surface_size_ = size; } |
| 1054 }; | 1052 }; |
| 1055 | 1053 |
| 1056 TEST_F(GLRendererTest, NoDiscardOnPartialUpdates) { | 1054 TEST_F(GLRendererTest, NoDiscardOnPartialUpdates) { |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1587 MOCK_METHOD2(bindFramebuffer, void(GLenum target, GLuint framebuffer)); | 1585 MOCK_METHOD2(bindFramebuffer, void(GLenum target, GLuint framebuffer)); |
| 1588 MOCK_METHOD3(reshapeWithScaleFactor, | 1586 MOCK_METHOD3(reshapeWithScaleFactor, |
| 1589 void(int width, int height, float scale_factor)); | 1587 void(int width, int height, float scale_factor)); |
| 1590 MOCK_METHOD4(drawElements, | 1588 MOCK_METHOD4(drawElements, |
| 1591 void(GLenum mode, GLsizei count, GLenum type, GLintptr offset)); | 1589 void(GLenum mode, GLsizei count, GLenum type, GLintptr offset)); |
| 1592 }; | 1590 }; |
| 1593 | 1591 |
| 1594 class MockOutputSurface : public OutputSurface { | 1592 class MockOutputSurface : public OutputSurface { |
| 1595 public: | 1593 public: |
| 1596 MockOutputSurface() | 1594 MockOutputSurface() |
| 1597 : OutputSurface( | 1595 : OutputSurface(TestContextProvider::Create( |
| 1598 TestContextProvider::Create( | 1596 base::MakeUnique<StrictMock<OutputSurfaceMockContext>>())) { |
| 1599 base::MakeUnique<StrictMock<OutputSurfaceMockContext>>()), | |
| 1600 nullptr, | |
| 1601 nullptr) { | |
| 1602 surface_size_ = gfx::Size(100, 100); | 1597 surface_size_ = gfx::Size(100, 100); |
| 1603 } | 1598 } |
| 1604 virtual ~MockOutputSurface() {} | 1599 virtual ~MockOutputSurface() {} |
| 1605 | 1600 |
| 1606 MOCK_METHOD0(EnsureBackbuffer, void()); | 1601 MOCK_METHOD0(EnsureBackbuffer, void()); |
| 1607 MOCK_METHOD0(DiscardBackbuffer, void()); | 1602 MOCK_METHOD0(DiscardBackbuffer, void()); |
| 1608 MOCK_METHOD4(Reshape, | 1603 MOCK_METHOD4(Reshape, |
| 1609 void(const gfx::Size& size, | 1604 void(const gfx::Size& size, |
| 1610 float scale_factor, | 1605 float scale_factor, |
| 1611 const gfx::ColorSpace& color_space, | 1606 const gfx::ColorSpace& color_space, |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2118 renderer_->SetVisible(true); | 2113 renderer_->SetVisible(true); |
| 2119 Mock::VerifyAndClearExpectations(context_support_ptr_); | 2114 Mock::VerifyAndClearExpectations(context_support_ptr_); |
| 2120 | 2115 |
| 2121 EXPECT_CALL(*context_support_ptr_, SetAggressivelyFreeResources(true)); | 2116 EXPECT_CALL(*context_support_ptr_, SetAggressivelyFreeResources(true)); |
| 2122 renderer_->SetVisible(false); | 2117 renderer_->SetVisible(false); |
| 2123 Mock::VerifyAndClearExpectations(context_support_ptr_); | 2118 Mock::VerifyAndClearExpectations(context_support_ptr_); |
| 2124 } | 2119 } |
| 2125 | 2120 |
| 2126 } // namespace | 2121 } // namespace |
| 2127 } // namespace cc | 2122 } // namespace cc |
| OLD | NEW |