| 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 "base/memory/ptr_util.h" | 5 #include "base/memory/ptr_util.h" |
| 6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
| 7 #include "base/single_thread_task_runner.h" | 7 #include "base/single_thread_task_runner.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "cc/output/output_surface_frame.h" | 9 #include "cc/output/output_surface_frame.h" |
| 10 #include "cc/scheduler/begin_frame_source.h" | 10 #include "cc/scheduler/begin_frame_source.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 std::unique_ptr<ui::OverlayCandidatesOzone>( | 69 std::unique_ptr<ui::OverlayCandidatesOzone>( |
| 70 new TestOverlayCandidatesOzone()), | 70 new TestOverlayCandidatesOzone()), |
| 71 false)); | 71 false)); |
| 72 #else | 72 #else |
| 73 return nullptr; | 73 return nullptr; |
| 74 #endif // defined(USE_OZONE) | 74 #endif // defined(USE_OZONE) |
| 75 } | 75 } |
| 76 | 76 |
| 77 class TestOutputSurface : public BrowserCompositorOutputSurface { | 77 class TestOutputSurface : public BrowserCompositorOutputSurface { |
| 78 public: | 78 public: |
| 79 TestOutputSurface(scoped_refptr<cc::ContextProvider> context_provider, | 79 TestOutputSurface(scoped_refptr<cc::ContextProvider> context_provider) |
| 80 scoped_refptr<ui::CompositorVSyncManager> vsync_manager, | |
| 81 cc::SyntheticBeginFrameSource* begin_frame_source) | |
| 82 : BrowserCompositorOutputSurface(std::move(context_provider), | 80 : BrowserCompositorOutputSurface(std::move(context_provider), |
| 83 std::move(vsync_manager), | 81 UpdateVSyncParametersCallback(), |
| 84 begin_frame_source, | 82 CreateTestValidatorOzone()) {} |
| 85 CreateTestValidatorOzone()) { | |
| 86 } | |
| 87 | 83 |
| 88 void SetFlip(bool flip) { capabilities_.flipped_output_surface = flip; } | 84 void SetFlip(bool flip) { capabilities_.flipped_output_surface = flip; } |
| 89 | 85 |
| 90 void BindToClient(cc::OutputSurfaceClient* client) override {} | 86 void BindToClient(cc::OutputSurfaceClient* client) override {} |
| 91 void EnsureBackbuffer() override {} | 87 void EnsureBackbuffer() override {} |
| 92 void DiscardBackbuffer() override {} | 88 void DiscardBackbuffer() override {} |
| 93 void BindFramebuffer() override {} | 89 void BindFramebuffer() override {} |
| 94 void Reshape(const gfx::Size& size, | 90 void Reshape(const gfx::Size& size, |
| 95 float device_scale_factor, | 91 float device_scale_factor, |
| 96 const gfx::ColorSpace& color_space, | 92 const gfx::ColorSpace& color_space, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 compositor_task_runner_ = new FakeTaskRunner(); | 133 compositor_task_runner_ = new FakeTaskRunner(); |
| 138 begin_frame_source_.reset(new cc::DelayBasedBeginFrameSource( | 134 begin_frame_source_.reset(new cc::DelayBasedBeginFrameSource( |
| 139 base::MakeUnique<cc::DelayBasedTimeSource>( | 135 base::MakeUnique<cc::DelayBasedTimeSource>( |
| 140 compositor_task_runner_.get()))); | 136 compositor_task_runner_.get()))); |
| 141 compositor_.reset( | 137 compositor_.reset( |
| 142 new ui::Compositor(context_factory, compositor_task_runner_.get())); | 138 new ui::Compositor(context_factory, compositor_task_runner_.get())); |
| 143 compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget); | 139 compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget); |
| 144 | 140 |
| 145 auto context_provider = cc::TestContextProvider::Create(); | 141 auto context_provider = cc::TestContextProvider::Create(); |
| 146 context_provider->BindToCurrentThread(); | 142 context_provider->BindToCurrentThread(); |
| 147 output_surface_ = base::MakeUnique<TestOutputSurface>( | 143 output_surface_ = |
| 148 std::move(context_provider), compositor_->vsync_manager(), | 144 base::MakeUnique<TestOutputSurface>(std::move(context_provider)); |
| 149 begin_frame_source_.get()); | |
| 150 | 145 |
| 151 root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); | 146 root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); |
| 152 compositor_->SetRootLayer(root_layer_.get()); | 147 compositor_->SetRootLayer(root_layer_.get()); |
| 153 mirroring_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); | 148 mirroring_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); |
| 154 compositor_->root_layer()->Add(mirroring_layer_.get()); | 149 compositor_->root_layer()->Add(mirroring_layer_.get()); |
| 155 output_surface_->Reshape(kSurfaceSize, 1.f, gfx::ColorSpace(), false); | 150 output_surface_->Reshape(kSurfaceSize, 1.f, gfx::ColorSpace(), false); |
| 156 mirroring_layer_->SetBounds(gfx::Rect(kSurfaceSize)); | 151 mirroring_layer_->SetBounds(gfx::Rect(kSurfaceSize)); |
| 157 } | 152 } |
| 158 | 153 |
| 159 void SetUpReflector() { | 154 void SetUpReflector() { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 plane_2.plane_z_order = 1; | 225 plane_2.plane_z_order = 1; |
| 231 list.push_back(plane_1); | 226 list.push_back(plane_1); |
| 232 list.push_back(plane_2); | 227 list.push_back(plane_2); |
| 233 output_surface_->GetOverlayCandidateValidator()->CheckOverlaySupport(&list); | 228 output_surface_->GetOverlayCandidateValidator()->CheckOverlaySupport(&list); |
| 234 EXPECT_FALSE(list[0].overlay_handled); | 229 EXPECT_FALSE(list[0].overlay_handled); |
| 235 } | 230 } |
| 236 #endif // defined(USE_OZONE) | 231 #endif // defined(USE_OZONE) |
| 237 | 232 |
| 238 } // namespace | 233 } // namespace |
| 239 } // namespace content | 234 } // namespace content |
| OLD | NEW |