OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/display_compositor/buffer_queue.h" | 5 #include "components/display_compositor/buffer_queue.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 }; | 59 }; |
60 | 60 |
61 class StubGpuMemoryBufferManager : public cc::TestGpuMemoryBufferManager { | 61 class StubGpuMemoryBufferManager : public cc::TestGpuMemoryBufferManager { |
62 public: | 62 public: |
63 StubGpuMemoryBufferManager() : allocate_succeeds_(true) {} | 63 StubGpuMemoryBufferManager() : allocate_succeeds_(true) {} |
64 | 64 |
65 size_t set_color_space_count() const { return set_color_space_count_; } | 65 size_t set_color_space_count() const { return set_color_space_count_; } |
66 | 66 |
67 void set_allocate_succeeds(bool value) { allocate_succeeds_ = value; } | 67 void set_allocate_succeeds(bool value) { allocate_succeeds_ = value; } |
68 | 68 |
69 std::unique_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( | 69 std::unique_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBuffer( |
70 const gfx::Size& size, | 70 const gfx::Size& size, |
71 gfx::BufferFormat format, | 71 gfx::BufferFormat format, |
72 gfx::BufferUsage usage, | 72 gfx::BufferUsage usage, |
73 gpu::SurfaceHandle surface_handle) override { | 73 gpu::SurfaceHandle surface_handle) override { |
74 if (!surface_handle) { | 74 if (!surface_handle) { |
75 return TestGpuMemoryBufferManager::AllocateGpuMemoryBuffer( | 75 return TestGpuMemoryBufferManager::CreateGpuMemoryBuffer( |
76 size, format, usage, surface_handle); | 76 size, format, usage, surface_handle); |
77 } | 77 } |
78 if (allocate_succeeds_) | 78 if (allocate_succeeds_) |
79 return base::WrapUnique<gfx::GpuMemoryBuffer>( | 79 return base::WrapUnique<gfx::GpuMemoryBuffer>( |
80 new StubGpuMemoryBufferImpl(&set_color_space_count_)); | 80 new StubGpuMemoryBufferImpl(&set_color_space_count_)); |
81 return nullptr; | 81 return nullptr; |
82 } | 82 } |
83 | 83 |
84 private: | 84 private: |
85 bool allocate_succeeds_; | 85 bool allocate_succeeds_; |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 testing::Mock::VerifyAndClearExpectations(mock_output_surface_); | 671 testing::Mock::VerifyAndClearExpectations(mock_output_surface_); |
672 EXPECT_CALL(*mock_output_surface_, | 672 EXPECT_CALL(*mock_output_surface_, |
673 CopyBufferDamage(target_texture, source_texture, small_damage, _)) | 673 CopyBufferDamage(target_texture, source_texture, small_damage, _)) |
674 .Times(1); | 674 .Times(1); |
675 output_surface_->SwapBuffers(small_damage); | 675 output_surface_->SwapBuffers(small_damage); |
676 testing::Mock::VerifyAndClearExpectations(mock_output_surface_); | 676 testing::Mock::VerifyAndClearExpectations(mock_output_surface_); |
677 } | 677 } |
678 | 678 |
679 } // namespace | 679 } // namespace |
680 } // namespace display_compositor | 680 } // namespace display_compositor |
OLD | NEW |