| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 gpu::SurfaceHandle surface_handle = gpu::kNullSurfaceHandle; | 173 gpu::SurfaceHandle surface_handle = gpu::kNullSurfaceHandle; |
| 174 BrowserCompositorOutputSurface* display_output_surface = nullptr; | 174 BrowserCompositorOutputSurface* display_output_surface = nullptr; |
| 175 cc::SyntheticBeginFrameSource* begin_frame_source = nullptr; | 175 cc::SyntheticBeginFrameSource* begin_frame_source = nullptr; |
| 176 ReflectorImpl* reflector = nullptr; | 176 ReflectorImpl* reflector = nullptr; |
| 177 std::unique_ptr<cc::Display> display; | 177 std::unique_ptr<cc::Display> display; |
| 178 bool output_is_secure = false; | 178 bool output_is_secure = false; |
| 179 gfx::ColorSpace color_space; | 179 gfx::ColorSpace color_space; |
| 180 }; | 180 }; |
| 181 | 181 |
| 182 GpuProcessTransportFactory::GpuProcessTransportFactory() | 182 GpuProcessTransportFactory::GpuProcessTransportFactory() |
| 183 : next_surface_id_namespace_(1u), | 183 : next_surface_client_id_(1u), |
| 184 task_graph_runner_(new cc::SingleThreadTaskGraphRunner), | 184 task_graph_runner_(new cc::SingleThreadTaskGraphRunner), |
| 185 callback_factory_(this) { | 185 callback_factory_(this) { |
| 186 cc::SetClientNameForMetrics("Browser"); | 186 cc::SetClientNameForMetrics("Browser"); |
| 187 | 187 |
| 188 surface_manager_ = base::WrapUnique(new cc::SurfaceManager); | 188 surface_manager_ = base::WrapUnique(new cc::SurfaceManager); |
| 189 | 189 |
| 190 task_graph_runner_->Start("CompositorTileWorker1", | 190 task_graph_runner_->Start("CompositorTileWorker1", |
| 191 base::SimpleThread::Options()); | 191 base::SimpleThread::Options()); |
| 192 #if defined(OS_WIN) | 192 #if defined(OS_WIN) |
| 193 software_backing_.reset(new OutputDeviceBacking); | 193 software_backing_.reset(new OutputDeviceBacking); |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 | 574 |
| 575 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler( | 575 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler( |
| 576 begin_frame_source.get(), compositor->task_runner().get(), | 576 begin_frame_source.get(), compositor->task_runner().get(), |
| 577 display_output_surface->capabilities().max_frames_pending)); | 577 display_output_surface->capabilities().max_frames_pending)); |
| 578 | 578 |
| 579 // The Display owns and uses the |display_output_surface| created above. | 579 // The Display owns and uses the |display_output_surface| created above. |
| 580 data->display = base::MakeUnique<cc::Display>( | 580 data->display = base::MakeUnique<cc::Display>( |
| 581 surface_manager_.get(), HostSharedBitmapManager::current(), | 581 surface_manager_.get(), HostSharedBitmapManager::current(), |
| 582 BrowserGpuMemoryBufferManager::current(), | 582 BrowserGpuMemoryBufferManager::current(), |
| 583 compositor->GetRendererSettings(), | 583 compositor->GetRendererSettings(), |
| 584 compositor->surface_id_allocator()->id_namespace(), | 584 compositor->surface_id_allocator()->client_id(), |
| 585 std::move(begin_frame_source), std::move(display_output_surface), | 585 std::move(begin_frame_source), std::move(display_output_surface), |
| 586 std::move(scheduler), base::MakeUnique<cc::TextureMailboxDeleter>( | 586 std::move(scheduler), base::MakeUnique<cc::TextureMailboxDeleter>( |
| 587 compositor->task_runner().get())); | 587 compositor->task_runner().get())); |
| 588 | 588 |
| 589 // The |delegated_output_surface| is given back to the compositor, it | 589 // The |delegated_output_surface| is given back to the compositor, it |
| 590 // delegates to the Display as its root surface. Importantly, it shares the | 590 // delegates to the Display as its root surface. Importantly, it shares the |
| 591 // same ContextProvider as the Display's output surface. | 591 // same ContextProvider as the Display's output surface. |
| 592 std::unique_ptr<cc::SurfaceDisplayOutputSurface> delegated_output_surface( | 592 std::unique_ptr<cc::SurfaceDisplayOutputSurface> delegated_output_surface( |
| 593 vulkan_context_provider | 593 vulkan_context_provider |
| 594 ? new cc::SurfaceDisplayOutputSurface( | 594 ? new cc::SurfaceDisplayOutputSurface( |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 return task_graph_runner_.get(); | 686 return task_graph_runner_.get(); |
| 687 } | 687 } |
| 688 | 688 |
| 689 ui::ContextFactory* GpuProcessTransportFactory::GetContextFactory() { | 689 ui::ContextFactory* GpuProcessTransportFactory::GetContextFactory() { |
| 690 return this; | 690 return this; |
| 691 } | 691 } |
| 692 | 692 |
| 693 std::unique_ptr<cc::SurfaceIdAllocator> | 693 std::unique_ptr<cc::SurfaceIdAllocator> |
| 694 GpuProcessTransportFactory::CreateSurfaceIdAllocator() { | 694 GpuProcessTransportFactory::CreateSurfaceIdAllocator() { |
| 695 std::unique_ptr<cc::SurfaceIdAllocator> allocator = base::WrapUnique( | 695 std::unique_ptr<cc::SurfaceIdAllocator> allocator = base::WrapUnique( |
| 696 new cc::SurfaceIdAllocator(next_surface_id_namespace_++)); | 696 new cc::SurfaceIdAllocator(0 /* gpu_id */, next_surface_client_id_++)); |
| 697 if (GetSurfaceManager()) | 697 if (GetSurfaceManager()) |
| 698 allocator->RegisterSurfaceIdNamespace(GetSurfaceManager()); | 698 allocator->RegisterSurfaceClientId(GetSurfaceManager()); |
| 699 return allocator; | 699 return allocator; |
| 700 } | 700 } |
| 701 | 701 |
| 702 void GpuProcessTransportFactory::ResizeDisplay(ui::Compositor* compositor, | 702 void GpuProcessTransportFactory::ResizeDisplay(ui::Compositor* compositor, |
| 703 const gfx::Size& size) { | 703 const gfx::Size& size) { |
| 704 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); | 704 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); |
| 705 if (it == per_compositor_data_.end()) | 705 if (it == per_compositor_data_.end()) |
| 706 return; | 706 return; |
| 707 PerCompositorData* data = it->second; | 707 PerCompositorData* data = it->second; |
| 708 DCHECK(data); | 708 DCHECK(data); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 shared_vulkan_context_provider_ = | 894 shared_vulkan_context_provider_ = |
| 895 cc::VulkanInProcessContextProvider::Create(); | 895 cc::VulkanInProcessContextProvider::Create(); |
| 896 } | 896 } |
| 897 | 897 |
| 898 shared_vulkan_context_provider_initialized_ = true; | 898 shared_vulkan_context_provider_initialized_ = true; |
| 899 } | 899 } |
| 900 return shared_vulkan_context_provider_; | 900 return shared_vulkan_context_provider_; |
| 901 } | 901 } |
| 902 | 902 |
| 903 } // namespace content | 903 } // namespace content |
| OLD | NEW |