| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/surfaces/display.h" | 5 #include "cc/surfaces/display.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/test/null_task_runner.h" | 9 #include "base/test/null_task_runner.h" |
| 10 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 class TestSoftwareOutputDevice : public SoftwareOutputDevice { | 54 class TestSoftwareOutputDevice : public SoftwareOutputDevice { |
| 55 public: | 55 public: |
| 56 TestSoftwareOutputDevice() {} | 56 TestSoftwareOutputDevice() {} |
| 57 | 57 |
| 58 gfx::Rect damage_rect() const { return damage_rect_; } | 58 gfx::Rect damage_rect() const { return damage_rect_; } |
| 59 gfx::Size viewport_pixel_size() const { return viewport_pixel_size_; } | 59 gfx::Size viewport_pixel_size() const { return viewport_pixel_size_; } |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 class TestDisplayScheduler : public DisplayScheduler { | 62 class TestDisplayScheduler : public DisplayScheduler { |
| 63 public: | 63 public: |
| 64 TestDisplayScheduler(BeginFrameSource* begin_frame_source, | 64 explicit TestDisplayScheduler(base::SingleThreadTaskRunner* task_runner) |
| 65 base::SingleThreadTaskRunner* task_runner) | 65 : DisplayScheduler(task_runner, 1), |
| 66 : DisplayScheduler(begin_frame_source, task_runner, 1), | |
| 67 damaged(false), | 66 damaged(false), |
| 68 display_resized_(false), | 67 display_resized_(false), |
| 69 has_new_root_surface(false), | 68 has_new_root_surface(false), |
| 70 swapped(false) {} | 69 swapped(false) {} |
| 71 | 70 |
| 72 ~TestDisplayScheduler() override {} | 71 ~TestDisplayScheduler() override {} |
| 73 | 72 |
| 74 void DisplayResized() override { display_resized_ = true; } | 73 void DisplayResized() override { display_resized_ = true; } |
| 75 | 74 |
| 76 void SetNewRootSurface(const SurfaceId& root_surface_id) override { | 75 void SetNewRootSurface(const SurfaceId& root_surface_id) override { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 output_surface = FakeOutputSurface::Create3d(std::move(provider)); | 120 output_surface = FakeOutputSurface::Create3d(std::move(provider)); |
| 122 } else { | 121 } else { |
| 123 std::unique_ptr<TestSoftwareOutputDevice> device( | 122 std::unique_ptr<TestSoftwareOutputDevice> device( |
| 124 new TestSoftwareOutputDevice); | 123 new TestSoftwareOutputDevice); |
| 125 software_output_device_ = device.get(); | 124 software_output_device_ = device.get(); |
| 126 output_surface = FakeOutputSurface::CreateSoftware(std::move(device)); | 125 output_surface = FakeOutputSurface::CreateSoftware(std::move(device)); |
| 127 } | 126 } |
| 128 output_surface_ = output_surface.get(); | 127 output_surface_ = output_surface.get(); |
| 129 | 128 |
| 130 std::unique_ptr<TestDisplayScheduler> scheduler( | 129 std::unique_ptr<TestDisplayScheduler> scheduler( |
| 131 new TestDisplayScheduler(begin_frame_source.get(), task_runner_.get())); | 130 new TestDisplayScheduler(task_runner_.get())); |
| 132 scheduler_ = scheduler.get(); | 131 scheduler_ = scheduler.get(); |
| 133 | 132 |
| 134 display_ = base::MakeUnique<Display>( | 133 display_ = base::MakeUnique<Display>( |
| 135 &shared_bitmap_manager_, nullptr /* gpu_memory_buffer_manager */, | 134 &shared_bitmap_manager_, nullptr /* gpu_memory_buffer_manager */, |
| 136 settings, kArbitraryFrameSinkId, std::move(begin_frame_source), | 135 settings, kArbitraryFrameSinkId, std::move(begin_frame_source), |
| 137 std::move(output_surface), std::move(scheduler), | 136 std::move(output_surface), std::move(scheduler), |
| 138 base::MakeUnique<TextureMailboxDeleter>(task_runner_.get())); | 137 base::MakeUnique<TextureMailboxDeleter>(task_runner_.get())); |
| 139 display_->SetVisible(true); | 138 display_->SetVisible(true); |
| 140 } | 139 } |
| 141 | 140 |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 // Verify DidLoseOutputSurface callback is hooked up correctly. | 506 // Verify DidLoseOutputSurface callback is hooked up correctly. |
| 508 EXPECT_EQ(0, client.loss_count()); | 507 EXPECT_EQ(0, client.loss_count()); |
| 509 output_surface_->context_provider()->ContextGL()->LoseContextCHROMIUM( | 508 output_surface_->context_provider()->ContextGL()->LoseContextCHROMIUM( |
| 510 GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB); | 509 GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB); |
| 511 output_surface_->context_provider()->ContextGL()->Flush(); | 510 output_surface_->context_provider()->ContextGL()->Flush(); |
| 512 EXPECT_EQ(1, client.loss_count()); | 511 EXPECT_EQ(1, client.loss_count()); |
| 513 } | 512 } |
| 514 | 513 |
| 515 } // namespace | 514 } // namespace |
| 516 } // namespace cc | 515 } // namespace cc |
| OLD | NEW |