| 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 "ui/compositor/test/in_process_context_factory.h" | 5 #include "ui/compositor/test/in_process_context_factory.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 scoped_refptr<InProcessContextProvider> context_provider = | 145 scoped_refptr<InProcessContextProvider> context_provider = |
| 146 InProcessContextProvider::Create( | 146 InProcessContextProvider::Create( |
| 147 attribs, shared_worker_context_provider_.get(), | 147 attribs, shared_worker_context_provider_.get(), |
| 148 &gpu_memory_buffer_manager_, &image_factory_, compositor->widget(), | 148 &gpu_memory_buffer_manager_, &image_factory_, compositor->widget(), |
| 149 "UICompositor"); | 149 "UICompositor"); |
| 150 | 150 |
| 151 std::unique_ptr<cc::OutputSurface> display_output_surface; | 151 std::unique_ptr<cc::OutputSurface> display_output_surface; |
| 152 std::unique_ptr<cc::SyntheticBeginFrameSource> begin_frame_source( | 152 std::unique_ptr<cc::SyntheticBeginFrameSource> begin_frame_source( |
| 153 new cc::SyntheticBeginFrameSource(compositor->task_runner().get(), | 153 new cc::SyntheticBeginFrameSource(compositor->task_runner().get(), |
| 154 cc::BeginFrameArgs::DefaultInterval())); | 154 cc::BeginFrameArgs::DefaultInterval())); |
| 155 auto* begin_frame_source_raw = begin_frame_source.get(); |
| 155 | 156 |
| 156 if (use_test_surface_) { | 157 if (use_test_surface_) { |
| 157 bool flipped_output_surface = false; | 158 bool flipped_output_surface = false; |
| 158 display_output_surface = base::WrapUnique(new cc::PixelTestOutputSurface( | 159 display_output_surface = base::WrapUnique(new cc::PixelTestOutputSurface( |
| 159 context_provider, shared_worker_context_provider_, | 160 context_provider, shared_worker_context_provider_, |
| 160 flipped_output_surface, std::move(begin_frame_source))); | 161 flipped_output_surface, std::move(begin_frame_source))); |
| 161 } else { | 162 } else { |
| 162 display_output_surface = base::WrapUnique(new DirectOutputSurface( | 163 display_output_surface = base::WrapUnique(new DirectOutputSurface( |
| 163 context_provider, shared_worker_context_provider_, | 164 context_provider, shared_worker_context_provider_, |
| 164 std::move(begin_frame_source))); | 165 std::move(begin_frame_source))); |
| 165 } | 166 } |
| 166 | 167 |
| 167 if (surface_manager_) { | 168 if (surface_manager_) { |
| 168 std::unique_ptr<cc::Display> display(new cc::Display( | 169 std::unique_ptr<cc::Display> display(new cc::Display( |
| 169 surface_manager_, GetSharedBitmapManager(), GetGpuMemoryBufferManager(), | 170 surface_manager_, GetSharedBitmapManager(), GetGpuMemoryBufferManager(), |
| 170 compositor->GetRendererSettings(), | 171 compositor->GetRendererSettings(), |
| 171 compositor->surface_id_allocator()->id_namespace(), | 172 compositor->surface_id_allocator()->id_namespace(), |
| 172 compositor->task_runner().get(), std::move(display_output_surface))); | 173 compositor->task_runner().get(), begin_frame_source_raw, |
| 174 std::move(display_output_surface))); |
| 173 std::unique_ptr<cc::SurfaceDisplayOutputSurface> surface_output_surface( | 175 std::unique_ptr<cc::SurfaceDisplayOutputSurface> surface_output_surface( |
| 174 new cc::SurfaceDisplayOutputSurface( | 176 new cc::SurfaceDisplayOutputSurface( |
| 175 surface_manager_, compositor->surface_id_allocator(), display.get(), | 177 surface_manager_, compositor->surface_id_allocator(), display.get(), |
| 176 context_provider, shared_worker_context_provider_)); | 178 context_provider, shared_worker_context_provider_)); |
| 177 | 179 |
| 178 compositor->SetOutputSurface(std::move(surface_output_surface)); | 180 compositor->SetOutputSurface(std::move(surface_output_surface)); |
| 179 | 181 |
| 180 per_compositor_data_[compositor.get()] = std::move(display); | 182 per_compositor_data_[compositor.get()] = std::move(display); |
| 181 } else { | 183 } else { |
| 182 compositor->SetOutputSurface(std::move(display_output_surface)); | 184 compositor->SetOutputSurface(std::move(display_output_surface)); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 } | 253 } |
| 252 | 254 |
| 253 void InProcessContextFactory::ResizeDisplay(ui::Compositor* compositor, | 255 void InProcessContextFactory::ResizeDisplay(ui::Compositor* compositor, |
| 254 const gfx::Size& size) { | 256 const gfx::Size& size) { |
| 255 if (!per_compositor_data_.count(compositor)) | 257 if (!per_compositor_data_.count(compositor)) |
| 256 return; | 258 return; |
| 257 per_compositor_data_[compositor]->Resize(size); | 259 per_compositor_data_[compositor]->Resize(size); |
| 258 } | 260 } |
| 259 | 261 |
| 260 } // namespace ui | 262 } // namespace ui |
| OLD | NEW |