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 "content/browser/compositor/gpu_process_transport_factory.h" | 5 #include "content/browser/compositor/gpu_process_transport_factory.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 } | 158 } |
159 #endif | 159 #endif |
160 | 160 |
161 } // namespace | 161 } // namespace |
162 | 162 |
163 namespace content { | 163 namespace content { |
164 | 164 |
165 struct GpuProcessTransportFactory::PerCompositorData { | 165 struct GpuProcessTransportFactory::PerCompositorData { |
166 gpu::SurfaceHandle surface_handle = gpu::kNullSurfaceHandle; | 166 gpu::SurfaceHandle surface_handle = gpu::kNullSurfaceHandle; |
167 BrowserCompositorOutputSurface* display_output_surface = nullptr; | 167 BrowserCompositorOutputSurface* display_output_surface = nullptr; |
168 std::unique_ptr<cc::SyntheticBeginFrameSource> begin_frame_source; | 168 cc::SyntheticBeginFrameSource* begin_frame_source = nullptr; |
169 ReflectorImpl* reflector = nullptr; | 169 ReflectorImpl* reflector = nullptr; |
170 std::unique_ptr<cc::Display> display; | 170 std::unique_ptr<cc::Display> display; |
171 bool output_is_secure = false; | 171 bool output_is_secure = false; |
172 gfx::ColorSpace color_space; | 172 gfx::ColorSpace color_space; |
173 }; | 173 }; |
174 | 174 |
175 GpuProcessTransportFactory::GpuProcessTransportFactory() | 175 GpuProcessTransportFactory::GpuProcessTransportFactory() |
176 : next_surface_client_id_(1u), | 176 : next_surface_client_id_(1u), |
177 task_graph_runner_(new cc::SingleThreadTaskGraphRunner), | 177 task_graph_runner_(new cc::SingleThreadTaskGraphRunner), |
178 callback_factory_(this) { | 178 callback_factory_(this) { |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 std::move(validator))); | 521 std::move(validator))); |
522 #else | 522 #else |
523 NOTREACHED(); | 523 NOTREACHED(); |
524 #endif | 524 #endif |
525 } | 525 } |
526 } | 526 } |
527 } | 527 } |
528 } | 528 } |
529 | 529 |
530 data->display_output_surface = display_output_surface.get(); | 530 data->display_output_surface = display_output_surface.get(); |
| 531 data->begin_frame_source = begin_frame_source.get(); |
531 if (data->reflector) | 532 if (data->reflector) |
532 data->reflector->OnSourceSurfaceReady(data->display_output_surface); | 533 data->reflector->OnSourceSurfaceReady(data->display_output_surface); |
533 | 534 |
534 #if defined(OS_WIN) | 535 #if defined(OS_WIN) |
535 gfx::RenderingWindowManager::GetInstance()->DoSetParentOnChild( | 536 gfx::RenderingWindowManager::GetInstance()->DoSetParentOnChild( |
536 compositor->widget()); | 537 compositor->widget()); |
537 #endif | 538 #endif |
538 | 539 |
539 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler( | 540 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler( |
540 begin_frame_source.get(), compositor->task_runner().get(), | 541 begin_frame_source.get(), compositor->task_runner().get(), |
541 display_output_surface->capabilities().max_frames_pending)); | 542 display_output_surface->capabilities().max_frames_pending)); |
542 | 543 |
543 // The Display owns and uses the |display_output_surface| created above. | 544 // The Display owns and uses the |display_output_surface| created above. |
544 data->display = base::MakeUnique<cc::Display>( | 545 data->display = base::MakeUnique<cc::Display>( |
545 HostSharedBitmapManager::current(), GetGpuMemoryBufferManager(), | 546 HostSharedBitmapManager::current(), |
546 compositor->GetRendererSettings(), begin_frame_source.get(), | 547 GetGpuMemoryBufferManager(), |
| 548 compositor->GetRendererSettings(), std::move(begin_frame_source), |
547 std::move(display_output_surface), std::move(scheduler), | 549 std::move(display_output_surface), std::move(scheduler), |
548 base::MakeUnique<cc::TextureMailboxDeleter>( | 550 base::MakeUnique<cc::TextureMailboxDeleter>( |
549 compositor->task_runner().get())); | 551 compositor->task_runner().get())); |
550 | 552 |
551 // Initialize this after the display as the previous display had a reference | |
552 // to the previous BFS. | |
553 data->begin_frame_source = std::move(begin_frame_source); | |
554 | |
555 // The |delegated_output_surface| is given back to the compositor, it | 553 // The |delegated_output_surface| is given back to the compositor, it |
556 // delegates to the Display as its root surface. Importantly, it shares the | 554 // delegates to the Display as its root surface. Importantly, it shares the |
557 // same ContextProvider as the Display's output surface. | 555 // same ContextProvider as the Display's output surface. |
558 std::unique_ptr<cc::SurfaceDisplayOutputSurface> delegated_output_surface( | 556 std::unique_ptr<cc::SurfaceDisplayOutputSurface> delegated_output_surface( |
559 vulkan_context_provider | 557 vulkan_context_provider |
560 ? new cc::SurfaceDisplayOutputSurface( | 558 ? new cc::SurfaceDisplayOutputSurface( |
561 surface_manager_.get(), compositor->surface_id_allocator(), | 559 surface_manager_.get(), compositor->surface_id_allocator(), |
562 data->display.get(), | 560 data->display.get(), |
563 static_cast<scoped_refptr<cc::VulkanContextProvider>>( | 561 static_cast<scoped_refptr<cc::VulkanContextProvider>>( |
564 vulkan_context_provider)) | 562 vulkan_context_provider)) |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 shared_vulkan_context_provider_ = | 874 shared_vulkan_context_provider_ = |
877 cc::VulkanInProcessContextProvider::Create(); | 875 cc::VulkanInProcessContextProvider::Create(); |
878 } | 876 } |
879 | 877 |
880 shared_vulkan_context_provider_initialized_ = true; | 878 shared_vulkan_context_provider_initialized_ = true; |
881 } | 879 } |
882 return shared_vulkan_context_provider_; | 880 return shared_vulkan_context_provider_; |
883 } | 881 } |
884 | 882 |
885 } // namespace content | 883 } // namespace content |
OLD | NEW |