Chromium Code Reviews| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 struct GpuProcessTransportFactory::PerCompositorData { | 168 struct GpuProcessTransportFactory::PerCompositorData { |
| 169 gpu::SurfaceHandle surface_handle = gpu::kNullSurfaceHandle; | 169 gpu::SurfaceHandle surface_handle = gpu::kNullSurfaceHandle; |
| 170 BrowserCompositorOutputSurface* display_output_surface = nullptr; | 170 BrowserCompositorOutputSurface* display_output_surface = nullptr; |
| 171 std::unique_ptr<cc::SyntheticBeginFrameSource> begin_frame_source; | 171 std::unique_ptr<cc::SyntheticBeginFrameSource> begin_frame_source; |
| 172 ReflectorImpl* reflector = nullptr; | 172 ReflectorImpl* reflector = nullptr; |
| 173 std::unique_ptr<cc::Display> display; | 173 std::unique_ptr<cc::Display> display; |
| 174 bool output_is_secure = false; | 174 bool output_is_secure = false; |
| 175 }; | 175 }; |
| 176 | 176 |
| 177 GpuProcessTransportFactory::GpuProcessTransportFactory() | 177 GpuProcessTransportFactory::GpuProcessTransportFactory() |
| 178 : task_graph_runner_(new cc::SingleThreadTaskGraphRunner), | 178 : frame_sink_id_allocator_( |
| 179 0 /* client_id, not to conflict with the client_id | |
|
boliu
2017/02/15 23:58:56
nit: 0u everwhere
Fady Samuel
2017/02/17 14:00:24
nit: Maybe add a constexpr at the top of the file
xlai (Olivia)
2017/02/17 15:55:11
Done.
xlai (Olivia)
2017/02/17 15:55:11
Done.
| |
| 180 generated from RenderWidgetHostImpl */), | |
| 181 task_graph_runner_(new cc::SingleThreadTaskGraphRunner), | |
| 179 callback_factory_(this) { | 182 callback_factory_(this) { |
| 180 cc::SetClientNameForMetrics("Browser"); | 183 cc::SetClientNameForMetrics("Browser"); |
| 181 | 184 |
| 182 surface_manager_ = base::WrapUnique(new cc::SurfaceManager); | 185 surface_manager_ = base::WrapUnique(new cc::SurfaceManager); |
| 183 | 186 |
| 184 task_graph_runner_->Start("CompositorTileWorker1", | 187 task_graph_runner_->Start("CompositorTileWorker1", |
| 185 base::SimpleThread::Options()); | 188 base::SimpleThread::Options()); |
| 186 #if defined(OS_WIN) | 189 #if defined(OS_WIN) |
| 187 software_backing_.reset(new OutputDeviceBacking); | 190 software_backing_.reset(new OutputDeviceBacking); |
| 188 #endif | 191 #endif |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 682 ui::ContextFactory* GpuProcessTransportFactory::GetContextFactory() { | 685 ui::ContextFactory* GpuProcessTransportFactory::GetContextFactory() { |
| 683 return this; | 686 return this; |
| 684 } | 687 } |
| 685 | 688 |
| 686 ui::ContextFactoryPrivate* | 689 ui::ContextFactoryPrivate* |
| 687 GpuProcessTransportFactory::GetContextFactoryPrivate() { | 690 GpuProcessTransportFactory::GetContextFactoryPrivate() { |
| 688 return this; | 691 return this; |
| 689 } | 692 } |
| 690 | 693 |
| 691 cc::FrameSinkId GpuProcessTransportFactory::AllocateFrameSinkId() { | 694 cc::FrameSinkId GpuProcessTransportFactory::AllocateFrameSinkId() { |
| 692 // The FrameSinkId generated here must be unique with | 695 return frame_sink_id_allocator_.NextFrameSinkId(); |
| 693 // RenderWidgetHostViewAura's | |
| 694 // and RenderWidgetHostViewMac's FrameSinkId allocation. | |
| 695 // TODO(crbug.com/685777): Centralize allocation in one place for easier | |
| 696 // maintenance. | |
| 697 return cc::FrameSinkId(0, next_sink_id_++); | |
| 698 } | 696 } |
| 699 | 697 |
| 700 void GpuProcessTransportFactory::SetDisplayVisible(ui::Compositor* compositor, | 698 void GpuProcessTransportFactory::SetDisplayVisible(ui::Compositor* compositor, |
| 701 bool visible) { | 699 bool visible) { |
| 702 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); | 700 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); |
| 703 if (it == per_compositor_data_.end()) | 701 if (it == per_compositor_data_.end()) |
| 704 return; | 702 return; |
| 705 PerCompositorData* data = it->second.get(); | 703 PerCompositorData* data = it->second.get(); |
| 706 DCHECK(data); | 704 DCHECK(data); |
| 707 // The compositor will always SetVisible on the Display once it is set up, so | 705 // The compositor will always SetVisible on the Display once it is set up, so |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 914 shared_vulkan_context_provider_ = | 912 shared_vulkan_context_provider_ = |
| 915 cc::VulkanInProcessContextProvider::Create(); | 913 cc::VulkanInProcessContextProvider::Create(); |
| 916 } | 914 } |
| 917 | 915 |
| 918 shared_vulkan_context_provider_initialized_ = true; | 916 shared_vulkan_context_provider_initialized_ = true; |
| 919 } | 917 } |
| 920 return shared_vulkan_context_provider_; | 918 return shared_vulkan_context_provider_; |
| 921 } | 919 } |
| 922 | 920 |
| 923 } // namespace content | 921 } // namespace content |
| OLD | NEW |