OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/renderer/android/synchronous_compositor_frame_sink.h" | 5 #include "content/renderer/android/synchronous_compositor_frame_sink.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 bool IsDisplayedAsOverlayPlane() const override { return false; } | 97 bool IsDisplayedAsOverlayPlane() const override { return false; } |
98 unsigned GetOverlayTextureId() const override { return 0; } | 98 unsigned GetOverlayTextureId() const override { return 0; } |
99 bool SurfaceIsSuspendForRecycle() const override { return false; } | 99 bool SurfaceIsSuspendForRecycle() const override { return false; } |
100 bool HasExternalStencilTest() const override { return false; } | 100 bool HasExternalStencilTest() const override { return false; } |
101 void ApplyExternalStencil() override {} | 101 void ApplyExternalStencil() override {} |
102 }; | 102 }; |
103 | 103 |
104 SynchronousCompositorFrameSink::SynchronousCompositorFrameSink( | 104 SynchronousCompositorFrameSink::SynchronousCompositorFrameSink( |
105 scoped_refptr<cc::ContextProvider> context_provider, | 105 scoped_refptr<cc::ContextProvider> context_provider, |
106 scoped_refptr<cc::ContextProvider> worker_context_provider, | 106 scoped_refptr<cc::ContextProvider> worker_context_provider, |
| 107 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 108 cc::SharedBitmapManager* shared_bitmap_manager, |
107 int routing_id, | 109 int routing_id, |
108 uint32_t compositor_frame_sink_id, | 110 uint32_t compositor_frame_sink_id, |
109 std::unique_ptr<cc::BeginFrameSource> begin_frame_source, | 111 std::unique_ptr<cc::BeginFrameSource> begin_frame_source, |
110 SynchronousCompositorRegistry* registry, | 112 SynchronousCompositorRegistry* registry, |
111 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue) | 113 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue) |
112 : cc::CompositorFrameSink(std::move(context_provider), | 114 : cc::CompositorFrameSink(std::move(context_provider), |
113 std::move(worker_context_provider)), | 115 std::move(worker_context_provider), |
| 116 gpu_memory_buffer_manager, |
| 117 shared_bitmap_manager), |
114 routing_id_(routing_id), | 118 routing_id_(routing_id), |
115 compositor_frame_sink_id_(compositor_frame_sink_id), | 119 compositor_frame_sink_id_(compositor_frame_sink_id), |
116 registry_(registry), | 120 registry_(registry), |
117 sender_(RenderThreadImpl::current()->sync_compositor_message_filter()), | 121 sender_(RenderThreadImpl::current()->sync_compositor_message_filter()), |
118 memory_policy_(0u), | 122 memory_policy_(0u), |
119 frame_swap_message_queue_(frame_swap_message_queue), | 123 frame_swap_message_queue_(frame_swap_message_queue), |
120 surface_manager_(new cc::SurfaceManager), | 124 surface_manager_(new cc::SurfaceManager), |
121 surface_id_allocator_(new cc::SurfaceIdAllocator()), | 125 surface_id_allocator_(new cc::SurfaceIdAllocator()), |
122 surface_factory_( | 126 surface_factory_( |
123 new cc::SurfaceFactory(kFrameSinkId, surface_manager_.get(), this)), | 127 new cc::SurfaceFactory(kFrameSinkId, surface_manager_.get(), this)), |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 171 |
168 surface_manager_->RegisterFrameSinkId(kFrameSinkId); | 172 surface_manager_->RegisterFrameSinkId(kFrameSinkId); |
169 surface_manager_->RegisterSurfaceFactoryClient(kFrameSinkId, this); | 173 surface_manager_->RegisterSurfaceFactoryClient(kFrameSinkId, this); |
170 | 174 |
171 cc::RendererSettings software_renderer_settings; | 175 cc::RendererSettings software_renderer_settings; |
172 | 176 |
173 auto output_surface = base::MakeUnique<SoftwareOutputSurface>( | 177 auto output_surface = base::MakeUnique<SoftwareOutputSurface>( |
174 base::MakeUnique<SoftwareDevice>(¤t_sw_canvas_)); | 178 base::MakeUnique<SoftwareDevice>(¤t_sw_canvas_)); |
175 software_output_surface_ = output_surface.get(); | 179 software_output_surface_ = output_surface.get(); |
176 | 180 |
177 // The shared_bitmap_manager and gpu_memory_buffer_manager here are null as | |
178 // this Display is only used for resourcesless software draws, where no | |
179 // resources are included in the frame swapped from the compositor. So there | |
180 // is no need for these. | |
181 display_.reset(new cc::Display( | 181 display_.reset(new cc::Display( |
182 nullptr /* shared_bitmap_manager */, | 182 shared_bitmap_manager(), gpu_memory_buffer_manager(), |
183 nullptr /* gpu_memory_buffer_manager */, software_renderer_settings, | 183 software_renderer_settings, nullptr /* begin_frame_source */, |
184 nullptr /* begin_frame_source */, std::move(output_surface), | 184 std::move(output_surface), nullptr /* scheduler */, |
185 nullptr /* scheduler */, nullptr /* texture_mailbox_deleter */)); | 185 nullptr /* texture_mailbox_deleter */)); |
186 display_->Initialize(&display_client_, surface_manager_.get(), kFrameSinkId); | 186 display_->Initialize(&display_client_, surface_manager_.get(), kFrameSinkId); |
187 display_->SetVisible(true); | 187 display_->SetVisible(true); |
188 return true; | 188 return true; |
189 } | 189 } |
190 | 190 |
191 void SynchronousCompositorFrameSink::DetachFromClient() { | 191 void SynchronousCompositorFrameSink::DetachFromClient() { |
192 DCHECK(CalledOnValidThread()); | 192 DCHECK(CalledOnValidThread()); |
193 client_->SetBeginFrameSource(nullptr); | 193 client_->SetBeginFrameSource(nullptr); |
194 // Destroy the begin frame source on the same thread it was bound on. | 194 // Destroy the begin frame source on the same thread it was bound on. |
195 begin_frame_source_ = nullptr; | 195 begin_frame_source_ = nullptr; |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 client_->ReclaimResources(resources); | 464 client_->ReclaimResources(resources); |
465 } | 465 } |
466 | 466 |
467 void SynchronousCompositorFrameSink::SetBeginFrameSource( | 467 void SynchronousCompositorFrameSink::SetBeginFrameSource( |
468 cc::BeginFrameSource* begin_frame_source) { | 468 cc::BeginFrameSource* begin_frame_source) { |
469 // Software output is synchronous and doesn't use a BeginFrameSource. | 469 // Software output is synchronous and doesn't use a BeginFrameSource. |
470 NOTREACHED(); | 470 NOTREACHED(); |
471 } | 471 } |
472 | 472 |
473 } // namespace content | 473 } // namespace content |
OLD | NEW |