| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 unsigned GetOverlayTextureId() const override { return 0; } | 100 unsigned GetOverlayTextureId() const override { return 0; } |
| 101 bool SurfaceIsSuspendForRecycle() const override { return false; } | 101 bool SurfaceIsSuspendForRecycle() const override { return false; } |
| 102 bool HasExternalStencilTest() const override { return false; } | 102 bool HasExternalStencilTest() const override { return false; } |
| 103 void ApplyExternalStencil() override {} | 103 void ApplyExternalStencil() override {} |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 SynchronousCompositorFrameSink::SynchronousCompositorFrameSink( | 106 SynchronousCompositorFrameSink::SynchronousCompositorFrameSink( |
| 107 scoped_refptr<cc::ContextProvider> context_provider, | 107 scoped_refptr<cc::ContextProvider> context_provider, |
| 108 scoped_refptr<cc::ContextProvider> worker_context_provider, | 108 scoped_refptr<cc::ContextProvider> worker_context_provider, |
| 109 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 109 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 110 cc::SharedBitmapManager* shared_bitmap_manager, |
| 110 int routing_id, | 111 int routing_id, |
| 111 uint32_t compositor_frame_sink_id, | 112 uint32_t compositor_frame_sink_id, |
| 112 std::unique_ptr<cc::BeginFrameSource> begin_frame_source, | 113 std::unique_ptr<cc::BeginFrameSource> begin_frame_source, |
| 113 SynchronousCompositorRegistry* registry, | 114 SynchronousCompositorRegistry* registry, |
| 114 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue) | 115 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue) |
| 115 : cc::CompositorFrameSink(std::move(context_provider), | 116 : cc::CompositorFrameSink(std::move(context_provider), |
| 116 std::move(worker_context_provider), | 117 std::move(worker_context_provider), |
| 117 gpu_memory_buffer_manager, | 118 gpu_memory_buffer_manager, |
| 118 nullptr), | 119 nullptr), |
| 119 routing_id_(routing_id), | 120 routing_id_(routing_id), |
| 120 compositor_frame_sink_id_(compositor_frame_sink_id), | 121 compositor_frame_sink_id_(compositor_frame_sink_id), |
| 121 registry_(registry), | 122 registry_(registry), |
| 123 shared_bitmap_manager_(shared_bitmap_manager), |
| 122 sender_(RenderThreadImpl::current()->sync_compositor_message_filter()), | 124 sender_(RenderThreadImpl::current()->sync_compositor_message_filter()), |
| 123 memory_policy_(0u), | 125 memory_policy_(0u), |
| 124 frame_swap_message_queue_(frame_swap_message_queue), | 126 frame_swap_message_queue_(frame_swap_message_queue), |
| 125 surface_manager_(new cc::SurfaceManager), | 127 surface_manager_(new cc::SurfaceManager), |
| 126 surface_id_allocator_(new cc::SurfaceIdAllocator()), | 128 surface_id_allocator_(new cc::SurfaceIdAllocator()), |
| 127 begin_frame_source_(std::move(begin_frame_source)) { | 129 begin_frame_source_(std::move(begin_frame_source)) { |
| 128 DCHECK(registry_); | 130 DCHECK(registry_); |
| 129 DCHECK(sender_); | 131 DCHECK(sender_); |
| 130 DCHECK(begin_frame_source_); | 132 DCHECK(begin_frame_source_); |
| 131 thread_checker_.DetachFromThread(); | 133 thread_checker_.DetachFromThread(); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 child_support_.reset(new cc::CompositorFrameSinkSupport( | 180 child_support_.reset(new cc::CompositorFrameSinkSupport( |
| 179 this, surface_manager_.get(), kChildFrameSinkId, child_support_is_root, | 181 this, surface_manager_.get(), kChildFrameSinkId, child_support_is_root, |
| 180 handles_frame_sink_id_invalidation, needs_sync_points)); | 182 handles_frame_sink_id_invalidation, needs_sync_points)); |
| 181 | 183 |
| 182 cc::RendererSettings software_renderer_settings; | 184 cc::RendererSettings software_renderer_settings; |
| 183 | 185 |
| 184 auto output_surface = base::MakeUnique<SoftwareOutputSurface>( | 186 auto output_surface = base::MakeUnique<SoftwareOutputSurface>( |
| 185 base::MakeUnique<SoftwareDevice>(¤t_sw_canvas_)); | 187 base::MakeUnique<SoftwareDevice>(¤t_sw_canvas_)); |
| 186 software_output_surface_ = output_surface.get(); | 188 software_output_surface_ = output_surface.get(); |
| 187 | 189 |
| 188 // The shared_bitmap_manager and gpu_memory_buffer_manager here are null as | 190 // The gpu_memory_buffer_manager here is null as the Display is only used for |
| 189 // this Display is only used for resourcesless software draws, where no | 191 // resourcesless software draws, where no resources are included in the frame |
| 190 // resources are included in the frame swapped from the compositor. So there | 192 // swapped from the compositor. So there is no need for it. |
| 191 // is no need for these. | 193 // The shared_bitmap_manager_ is provided for the Display to allocate |
| 194 // resources. |
| 195 // TODO(crbug.com/692814): The Display never sends its resources out of |
| 196 // process so there is no reason for it to use a SharedBitmapManager. |
| 192 display_.reset(new cc::Display( | 197 display_.reset(new cc::Display( |
| 193 nullptr /* shared_bitmap_manager */, | 198 shared_bitmap_manager_, nullptr /* gpu_memory_buffer_manager */, |
| 194 nullptr /* gpu_memory_buffer_manager */, software_renderer_settings, | 199 software_renderer_settings, kRootFrameSinkId, |
| 195 kRootFrameSinkId, nullptr /* begin_frame_source */, | 200 nullptr /* begin_frame_source */, std::move(output_surface), |
| 196 std::move(output_surface), nullptr /* scheduler */, | 201 nullptr /* scheduler */, nullptr /* texture_mailbox_deleter */)); |
| 197 nullptr /* texture_mailbox_deleter */)); | |
| 198 display_->Initialize(&display_client_, surface_manager_.get()); | 202 display_->Initialize(&display_client_, surface_manager_.get()); |
| 199 display_->SetVisible(true); | 203 display_->SetVisible(true); |
| 200 return true; | 204 return true; |
| 201 } | 205 } |
| 202 | 206 |
| 203 void SynchronousCompositorFrameSink::DetachFromClient() { | 207 void SynchronousCompositorFrameSink::DetachFromClient() { |
| 204 DCHECK(CalledOnValidThread()); | 208 DCHECK(CalledOnValidThread()); |
| 205 client_->SetBeginFrameSource(nullptr); | 209 client_->SetBeginFrameSource(nullptr); |
| 206 // Destroy the begin frame source on the same thread it was bound on. | 210 // Destroy the begin frame source on the same thread it was bound on. |
| 207 begin_frame_source_ = nullptr; | 211 begin_frame_source_ = nullptr; |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 | 466 |
| 463 void SynchronousCompositorFrameSink::ReclaimResources( | 467 void SynchronousCompositorFrameSink::ReclaimResources( |
| 464 const cc::ReturnedResourceArray& resources) { | 468 const cc::ReturnedResourceArray& resources) { |
| 465 DCHECK(resources.empty()); | 469 DCHECK(resources.empty()); |
| 466 client_->ReclaimResources(resources); | 470 client_->ReclaimResources(resources); |
| 467 } | 471 } |
| 468 | 472 |
| 469 void SynchronousCompositorFrameSink::WillDrawSurface() {} | 473 void SynchronousCompositorFrameSink::WillDrawSurface() {} |
| 470 | 474 |
| 471 } // namespace content | 475 } // namespace content |
| OLD | NEW |