| 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 <stddef.h> | 5 #include <stddef.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/base/region.h" | 10 #include "cc/base/region.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 const gfx::Transform kSwapTransform = | 61 const gfx::Transform kSwapTransform = |
| 62 gfx::Transform(0, 1, 1, 0, 0, 0); // x,y -> y,x. | 62 gfx::Transform(0, 1, 1, 0, 0, 0); // x,y -> y,x. |
| 63 | 63 |
| 64 void MailboxReleased(const gpu::SyncToken& sync_token, | 64 void MailboxReleased(const gpu::SyncToken& sync_token, |
| 65 bool lost_resource, | 65 bool lost_resource, |
| 66 BlockingTaskRunner* main_thread_task_runner) {} | 66 BlockingTaskRunner* main_thread_task_runner) {} |
| 67 | 67 |
| 68 class FullscreenOverlayValidator : public OverlayCandidateValidator { | 68 class FullscreenOverlayValidator : public OverlayCandidateValidator { |
| 69 public: | 69 public: |
| 70 void GetStrategies(OverlayProcessor::StrategyList* strategies) override { | 70 void GetStrategies(OverlayProcessor::StrategyList* strategies) override { |
| 71 strategies->push_back(base::WrapUnique(new OverlayStrategyFullscreen())); | 71 strategies->push_back(base::MakeUnique<OverlayStrategyFullscreen>()); |
| 72 } | 72 } |
| 73 bool AllowCALayerOverlays() override { return false; } | 73 bool AllowCALayerOverlays() override { return false; } |
| 74 void CheckOverlaySupport(OverlayCandidateList* surfaces) override { | 74 void CheckOverlaySupport(OverlayCandidateList* surfaces) override { |
| 75 // We're not checking for support. | 75 // We're not checking for support. |
| 76 ASSERT_TRUE(false); | 76 ASSERT_TRUE(false); |
| 77 } | 77 } |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 class SingleOverlayValidator : public OverlayCandidateValidator { | 80 class SingleOverlayValidator : public OverlayCandidateValidator { |
| 81 public: | 81 public: |
| 82 void GetStrategies(OverlayProcessor::StrategyList* strategies) override { | 82 void GetStrategies(OverlayProcessor::StrategyList* strategies) override { |
| 83 strategies->push_back( | 83 strategies->push_back(base::MakeUnique<OverlayStrategySingleOnTop>(this)); |
| 84 base::WrapUnique(new OverlayStrategySingleOnTop(this))); | 84 strategies->push_back(base::MakeUnique<OverlayStrategyUnderlay>(this)); |
| 85 strategies->push_back(base::WrapUnique(new OverlayStrategyUnderlay(this))); | |
| 86 } | 85 } |
| 87 bool AllowCALayerOverlays() override { return false; } | 86 bool AllowCALayerOverlays() override { return false; } |
| 88 void CheckOverlaySupport(OverlayCandidateList* surfaces) override { | 87 void CheckOverlaySupport(OverlayCandidateList* surfaces) override { |
| 89 // We may have 1 or 2 surfaces depending on whether this ran through the | 88 // We may have 1 or 2 surfaces depending on whether this ran through the |
| 90 // full renderer and picked up the output surface, or not. | 89 // full renderer and picked up the output surface, or not. |
| 91 ASSERT_LE(1U, surfaces->size()); | 90 ASSERT_LE(1U, surfaces->size()); |
| 92 ASSERT_GE(2U, surfaces->size()); | 91 ASSERT_GE(2U, surfaces->size()); |
| 93 | 92 |
| 94 OverlayCandidate& candidate = surfaces->back(); | 93 OverlayCandidate& candidate = surfaces->back(); |
| 95 EXPECT_TRUE(!candidate.use_output_surface_for_resource); | 94 EXPECT_TRUE(!candidate.use_output_surface_for_resource); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 115 class CALayerValidator : public OverlayCandidateValidator { | 114 class CALayerValidator : public OverlayCandidateValidator { |
| 116 public: | 115 public: |
| 117 void GetStrategies(OverlayProcessor::StrategyList* strategies) override {} | 116 void GetStrategies(OverlayProcessor::StrategyList* strategies) override {} |
| 118 bool AllowCALayerOverlays() override { return true; } | 117 bool AllowCALayerOverlays() override { return true; } |
| 119 void CheckOverlaySupport(OverlayCandidateList* surfaces) override {} | 118 void CheckOverlaySupport(OverlayCandidateList* surfaces) override {} |
| 120 }; | 119 }; |
| 121 | 120 |
| 122 class SingleOnTopOverlayValidator : public SingleOverlayValidator { | 121 class SingleOnTopOverlayValidator : public SingleOverlayValidator { |
| 123 public: | 122 public: |
| 124 void GetStrategies(OverlayProcessor::StrategyList* strategies) override { | 123 void GetStrategies(OverlayProcessor::StrategyList* strategies) override { |
| 125 strategies->push_back( | 124 strategies->push_back(base::MakeUnique<OverlayStrategySingleOnTop>(this)); |
| 126 base::WrapUnique(new OverlayStrategySingleOnTop(this))); | |
| 127 } | 125 } |
| 128 }; | 126 }; |
| 129 | 127 |
| 130 class UnderlayOverlayValidator : public SingleOverlayValidator { | 128 class UnderlayOverlayValidator : public SingleOverlayValidator { |
| 131 public: | 129 public: |
| 132 void GetStrategies(OverlayProcessor::StrategyList* strategies) override { | 130 void GetStrategies(OverlayProcessor::StrategyList* strategies) override { |
| 133 strategies->push_back(base::WrapUnique(new OverlayStrategyUnderlay(this))); | 131 strategies->push_back(base::MakeUnique<OverlayStrategyUnderlay>(this)); |
| 134 } | 132 } |
| 135 }; | 133 }; |
| 136 | 134 |
| 137 class DefaultOverlayProcessor : public OverlayProcessor { | 135 class DefaultOverlayProcessor : public OverlayProcessor { |
| 138 public: | 136 public: |
| 139 explicit DefaultOverlayProcessor(OutputSurface* surface); | 137 explicit DefaultOverlayProcessor(OutputSurface* surface); |
| 140 size_t GetStrategyCount(); | 138 size_t GetStrategyCount(); |
| 141 }; | 139 }; |
| 142 | 140 |
| 143 DefaultOverlayProcessor::DefaultOverlayProcessor(OutputSurface* surface) | 141 DefaultOverlayProcessor::DefaultOverlayProcessor(OutputSurface* surface) |
| (...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1287 FakeResourceProvider::Create(output_surface_.get(), nullptr); | 1285 FakeResourceProvider::Create(output_surface_.get(), nullptr); |
| 1288 | 1286 |
| 1289 provider_->support()->SetScheduleOverlayPlaneCallback(base::Bind( | 1287 provider_->support()->SetScheduleOverlayPlaneCallback(base::Bind( |
| 1290 &MockOverlayScheduler::Schedule, base::Unretained(&scheduler_))); | 1288 &MockOverlayScheduler::Schedule, base::Unretained(&scheduler_))); |
| 1291 } | 1289 } |
| 1292 | 1290 |
| 1293 void Init(bool use_validator) { | 1291 void Init(bool use_validator) { |
| 1294 if (use_validator) | 1292 if (use_validator) |
| 1295 output_surface_->SetOverlayCandidateValidator(new SingleOverlayValidator); | 1293 output_surface_->SetOverlayCandidateValidator(new SingleOverlayValidator); |
| 1296 | 1294 |
| 1297 renderer_ = base::WrapUnique(new OverlayInfoRendererGL( | 1295 renderer_ = base::MakeUnique<OverlayInfoRendererGL>( |
| 1298 &settings_, output_surface_.get(), resource_provider_.get())); | 1296 &settings_, output_surface_.get(), resource_provider_.get()); |
| 1299 renderer_->Initialize(); | 1297 renderer_->Initialize(); |
| 1300 renderer_->SetVisible(true); | 1298 renderer_->SetVisible(true); |
| 1301 } | 1299 } |
| 1302 | 1300 |
| 1303 void DrawFrame(RenderPassList* pass_list, const gfx::Rect& viewport_rect) { | 1301 void DrawFrame(RenderPassList* pass_list, const gfx::Rect& viewport_rect) { |
| 1304 renderer_->DrawFrame(pass_list, 1.f, gfx::ColorSpace(), viewport_rect, | 1302 renderer_->DrawFrame(pass_list, 1.f, gfx::ColorSpace(), viewport_rect, |
| 1305 viewport_rect); | 1303 viewport_rect); |
| 1306 } | 1304 } |
| 1307 void SwapBuffers() { | 1305 void SwapBuffers() { |
| 1308 renderer_->SwapBuffers(CompositorFrameMetadata()); | 1306 renderer_->SwapBuffers(CompositorFrameMetadata()); |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1845 filters_.Append(FilterOperation::CreateZoomFilter(0.9f, 1)); | 1843 filters_.Append(FilterOperation::CreateZoomFilter(0.9f, 1)); |
| 1846 quad_->SetNew(pass_->shared_quad_state_list.back(), kOverlayRect, | 1844 quad_->SetNew(pass_->shared_quad_state_list.back(), kOverlayRect, |
| 1847 kOverlayRect, render_pass_id_, 0, gfx::Vector2dF(), gfx::Size(), | 1845 kOverlayRect, render_pass_id_, 0, gfx::Vector2dF(), gfx::Size(), |
| 1848 filters_, gfx::Vector2dF(1, 1), background_filters_); | 1846 filters_, gfx::Vector2dF(1, 1), background_filters_); |
| 1849 ProcessForOverlays(); | 1847 ProcessForOverlays(); |
| 1850 EXPECT_EQ(0U, ca_layer_list_.size()); | 1848 EXPECT_EQ(0U, ca_layer_list_.size()); |
| 1851 } | 1849 } |
| 1852 | 1850 |
| 1853 } // namespace | 1851 } // namespace |
| 1854 } // namespace cc | 1852 } // namespace cc |
| OLD | NEW |