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

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

Issue 2349743004: cc: Remove things from OutputSurface and CompositorFrameSink. (Closed)
Patch Set: delete-stuff-cfs: comment-and-rebase Created 4 years, 3 months 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 DISALLOW_COPY_AND_ASSIGN(SoftwareDevice); 69 DISALLOW_COPY_AND_ASSIGN(SoftwareDevice);
70 }; 70 };
71 71
72 } // namespace 72 } // namespace
73 73
74 class SynchronousCompositorFrameSink::SoftwareOutputSurface 74 class SynchronousCompositorFrameSink::SoftwareOutputSurface
75 : public cc::OutputSurface { 75 : public cc::OutputSurface {
76 public: 76 public:
77 SoftwareOutputSurface(std::unique_ptr<SoftwareDevice> software_device) 77 SoftwareOutputSurface(std::unique_ptr<SoftwareDevice> software_device)
78 : cc::OutputSurface(nullptr, nullptr, std::move(software_device)) {} 78 : cc::OutputSurface(std::move(software_device)) {}
79 79
80 // cc::OutputSurface implementation. 80 // cc::OutputSurface implementation.
81 uint32_t GetFramebufferCopyTextureFormat() override { return 0; } 81 uint32_t GetFramebufferCopyTextureFormat() override { return 0; }
82 void SwapBuffers(cc::CompositorFrame frame) override {} 82 void SwapBuffers(cc::CompositorFrame frame) override {}
83 void Reshape(const gfx::Size& size, 83 void Reshape(const gfx::Size& size,
84 float scale_factor, 84 float scale_factor,
85 const gfx::ColorSpace& color_space, 85 const gfx::ColorSpace& color_space,
86 bool has_alpha) override { 86 bool has_alpha) override {
87 // Intentional no-op. Surface size controlled by embedder. 87 // Intentional no-op. Surface size controlled by embedder.
88 } 88 }
89 89
90 void SetSurfaceSize(const gfx::Size surface_size) { 90 void SetSurfaceSize(const gfx::Size surface_size) {
91 surface_size_ = surface_size; 91 surface_size_ = surface_size;
92 } 92 }
93 }; 93 };
94 94
95 SynchronousCompositorFrameSink::SynchronousCompositorFrameSink( 95 SynchronousCompositorFrameSink::SynchronousCompositorFrameSink(
96 scoped_refptr<cc::ContextProvider> context_provider, 96 scoped_refptr<cc::ContextProvider> context_provider,
97 scoped_refptr<cc::ContextProvider> worker_context_provider, 97 scoped_refptr<cc::ContextProvider> worker_context_provider,
98 int routing_id, 98 int routing_id,
99 uint32_t compositor_frame_sink_id, 99 uint32_t compositor_frame_sink_id,
100 std::unique_ptr<cc::BeginFrameSource> begin_frame_source, 100 std::unique_ptr<cc::BeginFrameSource> begin_frame_source,
101 SynchronousCompositorRegistry* registry, 101 SynchronousCompositorRegistry* registry,
102 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue) 102 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue)
103 : cc::CompositorFrameSink(std::move(context_provider), 103 : cc::CompositorFrameSink(std::move(context_provider),
104 std::move(worker_context_provider), 104 std::move(worker_context_provider)),
105 nullptr),
106 routing_id_(routing_id), 105 routing_id_(routing_id),
107 compositor_frame_sink_id_(compositor_frame_sink_id), 106 compositor_frame_sink_id_(compositor_frame_sink_id),
108 registry_(registry), 107 registry_(registry),
109 sender_(RenderThreadImpl::current()->sync_compositor_message_filter()), 108 sender_(RenderThreadImpl::current()->sync_compositor_message_filter()),
110 memory_policy_(0u), 109 memory_policy_(0u),
111 frame_swap_message_queue_(frame_swap_message_queue), 110 frame_swap_message_queue_(frame_swap_message_queue),
112 surface_manager_(new cc::SurfaceManager), 111 surface_manager_(new cc::SurfaceManager),
113 surface_id_allocator_(new cc::SurfaceIdAllocator(kCompositorClientId)), 112 surface_id_allocator_(new cc::SurfaceIdAllocator(kCompositorClientId)),
114 surface_factory_(new cc::SurfaceFactory(surface_manager_.get(), this)), 113 surface_factory_(new cc::SurfaceFactory(surface_manager_.get(), this)),
115 begin_frame_source_(std::move(begin_frame_source)) { 114 begin_frame_source_(std::move(begin_frame_source)) {
116 DCHECK(registry_); 115 DCHECK(registry_);
117 DCHECK(sender_); 116 DCHECK(sender_);
118 DCHECK(begin_frame_source_); 117 DCHECK(begin_frame_source_);
119 thread_checker_.DetachFromThread(); 118 thread_checker_.DetachFromThread();
120 capabilities_.adjust_deadline_for_parent = false;
121 capabilities_.delegated_rendering = true;
122 memory_policy_.priority_cutoff_when_visible = 119 memory_policy_.priority_cutoff_when_visible =
123 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE; 120 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE;
121 capabilities_.adjust_deadline_for_parent = false;
124 } 122 }
125 123
126 SynchronousCompositorFrameSink::~SynchronousCompositorFrameSink() = default; 124 SynchronousCompositorFrameSink::~SynchronousCompositorFrameSink() = default;
127 125
128 void SynchronousCompositorFrameSink::SetSyncClient( 126 void SynchronousCompositorFrameSink::SetSyncClient(
129 SynchronousCompositorFrameSinkClient* compositor) { 127 SynchronousCompositorFrameSinkClient* compositor) {
130 DCHECK(CalledOnValidThread()); 128 DCHECK(CalledOnValidThread());
131 sync_client_ = compositor; 129 sync_client_ = compositor;
132 if (sync_client_) 130 if (sync_client_)
133 Send(new SyncCompositorHostMsg_CompositorFrameSinkCreated(routing_id_)); 131 Send(new SyncCompositorHostMsg_CompositorFrameSinkCreated(routing_id_));
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 surface_id_allocator_->client_id()); 199 surface_id_allocator_->client_id());
202 software_compositor_frame_sink_ = nullptr; 200 software_compositor_frame_sink_ = nullptr;
203 display_ = nullptr; 201 display_ = nullptr;
204 surface_factory_ = nullptr; 202 surface_factory_ = nullptr;
205 surface_id_allocator_ = nullptr; 203 surface_id_allocator_ = nullptr;
206 surface_manager_ = nullptr; 204 surface_manager_ = nullptr;
207 cc::CompositorFrameSink::DetachFromClient(); 205 cc::CompositorFrameSink::DetachFromClient();
208 CancelFallbackTick(); 206 CancelFallbackTick();
209 } 207 }
210 208
211 void SynchronousCompositorFrameSink::Reshape(const gfx::Size& size,
212 float scale_factor,
213 const gfx::ColorSpace& color_space,
214 bool has_alpha) {
215 // Intentional no-op: surface size is controlled by the embedder.
216 }
217
218 static void NoOpDrawCallback() {} 209 static void NoOpDrawCallback() {}
219 210
220 void SynchronousCompositorFrameSink::SwapBuffers(cc::CompositorFrame frame) { 211 void SynchronousCompositorFrameSink::SwapBuffers(cc::CompositorFrame frame) {
221 DCHECK(CalledOnValidThread()); 212 DCHECK(CalledOnValidThread());
222 DCHECK(sync_client_); 213 DCHECK(sync_client_);
223 214
224 if (fallback_tick_running_) { 215 if (fallback_tick_running_) {
225 DCHECK(frame.delegated_frame_data->resource_list.empty()); 216 DCHECK(frame.delegated_frame_data->resource_list.empty());
226 cc::ReturnedResourceArray return_resources; 217 cc::ReturnedResourceArray return_resources;
227 ReturnResources(return_resources); 218 ReturnResources(return_resources);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 fallback_tick_.Reset( 279 fallback_tick_.Reset(
289 base::Bind(&SynchronousCompositorFrameSink::FallbackTickFired, 280 base::Bind(&SynchronousCompositorFrameSink::FallbackTickFired,
290 base::Unretained(this))); 281 base::Unretained(this)));
291 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 282 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
292 FROM_HERE, fallback_tick_.callback(), 283 FROM_HERE, fallback_tick_.callback(),
293 base::TimeDelta::FromMilliseconds(kFallbackTickTimeoutInMilliseconds)); 284 base::TimeDelta::FromMilliseconds(kFallbackTickTimeoutInMilliseconds));
294 fallback_tick_pending_ = true; 285 fallback_tick_pending_ = true;
295 } 286 }
296 } 287 }
297 288
298 void SynchronousCompositorFrameSink::BindFramebuffer() {
299 // This is a delegating output surface, no framebuffer/direct drawing support.
300 NOTREACHED();
301 }
302
303 uint32_t SynchronousCompositorFrameSink::GetFramebufferCopyTextureFormat() {
304 // This is a delegating output surface, no framebuffer/direct drawing support.
305 NOTREACHED();
306 return 0;
307 }
308
309 void SynchronousCompositorFrameSink::DemandDrawHw( 289 void SynchronousCompositorFrameSink::DemandDrawHw(
310 const gfx::Size& viewport_size, 290 const gfx::Size& viewport_size,
311 const gfx::Rect& viewport_rect_for_tile_priority, 291 const gfx::Rect& viewport_rect_for_tile_priority,
312 const gfx::Transform& transform_for_tile_priority) { 292 const gfx::Transform& transform_for_tile_priority) {
313 DCHECK(CalledOnValidThread()); 293 DCHECK(CalledOnValidThread());
314 DCHECK(HasClient()); 294 DCHECK(HasClient());
315 DCHECK(context_provider_.get()); 295 DCHECK(context_provider_.get());
316 CancelFallbackTick(); 296 CancelFallbackTick();
317 297
318 client_->SetExternalTilePriorityConstraints(viewport_rect_for_tile_priority, 298 client_->SetExternalTilePriorityConstraints(viewport_rect_for_tile_priority,
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 client_->ReclaimResources(resources); 403 client_->ReclaimResources(resources);
424 } 404 }
425 405
426 void SynchronousCompositorFrameSink::SetBeginFrameSource( 406 void SynchronousCompositorFrameSink::SetBeginFrameSource(
427 cc::BeginFrameSource* begin_frame_source) { 407 cc::BeginFrameSource* begin_frame_source) {
428 // Software output is synchronous and doesn't use a BeginFrameSource. 408 // Software output is synchronous and doesn't use a BeginFrameSource.
429 NOTREACHED(); 409 NOTREACHED();
430 } 410 }
431 411
432 } // namespace content 412 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/android/synchronous_compositor_frame_sink.h ('k') | content/renderer/gpu/render_widget_compositor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698