Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: content/renderer/android/synchronous_compositor_frame_sink.cc

Issue 2452483002: Move GpuMemoryBufferManager and SharedBitmapManager to CompositorFrameSink (Closed)
Patch Set: review comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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,
107 int routing_id, 108 int routing_id,
108 uint32_t compositor_frame_sink_id, 109 uint32_t compositor_frame_sink_id,
109 std::unique_ptr<cc::BeginFrameSource> begin_frame_source, 110 std::unique_ptr<cc::BeginFrameSource> begin_frame_source,
110 SynchronousCompositorRegistry* registry, 111 SynchronousCompositorRegistry* registry,
111 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue) 112 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue)
112 : cc::CompositorFrameSink(std::move(context_provider), 113 : cc::CompositorFrameSink(std::move(context_provider),
113 std::move(worker_context_provider)), 114 std::move(worker_context_provider),
115 gpu_memory_buffer_manager,
116 nullptr),
114 routing_id_(routing_id), 117 routing_id_(routing_id),
115 compositor_frame_sink_id_(compositor_frame_sink_id), 118 compositor_frame_sink_id_(compositor_frame_sink_id),
116 registry_(registry), 119 registry_(registry),
117 sender_(RenderThreadImpl::current()->sync_compositor_message_filter()), 120 sender_(RenderThreadImpl::current()->sync_compositor_message_filter()),
118 memory_policy_(0u), 121 memory_policy_(0u),
119 frame_swap_message_queue_(frame_swap_message_queue), 122 frame_swap_message_queue_(frame_swap_message_queue),
120 surface_manager_(new cc::SurfaceManager), 123 surface_manager_(new cc::SurfaceManager),
121 surface_id_allocator_(new cc::SurfaceIdAllocator()), 124 surface_id_allocator_(new cc::SurfaceIdAllocator()),
122 surface_factory_( 125 surface_factory_(
123 new cc::SurfaceFactory(kFrameSinkId, surface_manager_.get(), this)), 126 new cc::SurfaceFactory(kFrameSinkId, surface_manager_.get(), this)),
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 170
168 surface_manager_->RegisterFrameSinkId(kFrameSinkId); 171 surface_manager_->RegisterFrameSinkId(kFrameSinkId);
169 surface_manager_->RegisterSurfaceFactoryClient(kFrameSinkId, this); 172 surface_manager_->RegisterSurfaceFactoryClient(kFrameSinkId, this);
170 173
171 cc::RendererSettings software_renderer_settings; 174 cc::RendererSettings software_renderer_settings;
172 175
173 auto output_surface = base::MakeUnique<SoftwareOutputSurface>( 176 auto output_surface = base::MakeUnique<SoftwareOutputSurface>(
174 base::MakeUnique<SoftwareDevice>(&current_sw_canvas_)); 177 base::MakeUnique<SoftwareDevice>(&current_sw_canvas_));
175 software_output_surface_ = output_surface.get(); 178 software_output_surface_ = output_surface.get();
176 179
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( 180 display_.reset(new cc::Display(
182 nullptr /* shared_bitmap_manager */, 181 nullptr /* shared_bitmap_manager */, gpu_memory_buffer_manager(),
danakj 2016/10/28 01:33:20 In this one they were both null before because its
piman 2016/10/28 22:08:33 Done.
183 nullptr /* gpu_memory_buffer_manager */, software_renderer_settings, 182 software_renderer_settings, nullptr /* begin_frame_source */,
184 nullptr /* begin_frame_source */, std::move(output_surface), 183 std::move(output_surface), nullptr /* scheduler */,
185 nullptr /* scheduler */, nullptr /* texture_mailbox_deleter */)); 184 nullptr /* texture_mailbox_deleter */));
186 display_->Initialize(&display_client_, surface_manager_.get(), kFrameSinkId); 185 display_->Initialize(&display_client_, surface_manager_.get(), kFrameSinkId);
187 display_->SetVisible(true); 186 display_->SetVisible(true);
188 return true; 187 return true;
189 } 188 }
190 189
191 void SynchronousCompositorFrameSink::DetachFromClient() { 190 void SynchronousCompositorFrameSink::DetachFromClient() {
192 DCHECK(CalledOnValidThread()); 191 DCHECK(CalledOnValidThread());
193 client_->SetBeginFrameSource(nullptr); 192 client_->SetBeginFrameSource(nullptr);
194 // Destroy the begin frame source on the same thread it was bound on. 193 // Destroy the begin frame source on the same thread it was bound on.
195 begin_frame_source_ = nullptr; 194 begin_frame_source_ = nullptr;
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 client_->ReclaimResources(resources); 463 client_->ReclaimResources(resources);
465 } 464 }
466 465
467 void SynchronousCompositorFrameSink::SetBeginFrameSource( 466 void SynchronousCompositorFrameSink::SetBeginFrameSource(
468 cc::BeginFrameSource* begin_frame_source) { 467 cc::BeginFrameSource* begin_frame_source) {
469 // Software output is synchronous and doesn't use a BeginFrameSource. 468 // Software output is synchronous and doesn't use a BeginFrameSource.
470 NOTREACHED(); 469 NOTREACHED();
471 } 470 }
472 471
473 } // namespace content 472 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698