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

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

Issue 2449853004: Getting rid of DelegatedFrameData (Closed)
Patch Set: nit 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 } 214 }
215 215
216 static void NoOpDrawCallback() {} 216 static void NoOpDrawCallback() {}
217 217
218 void SynchronousCompositorFrameSink::SubmitCompositorFrame( 218 void SynchronousCompositorFrameSink::SubmitCompositorFrame(
219 cc::CompositorFrame frame) { 219 cc::CompositorFrame frame) {
220 DCHECK(CalledOnValidThread()); 220 DCHECK(CalledOnValidThread());
221 DCHECK(sync_client_); 221 DCHECK(sync_client_);
222 222
223 if (fallback_tick_running_) { 223 if (fallback_tick_running_) {
224 DCHECK(frame.delegated_frame_data->resource_list.empty()); 224 DCHECK(frame.resource_list.empty());
225 cc::ReturnedResourceArray return_resources; 225 cc::ReturnedResourceArray return_resources;
226 ReturnResources(return_resources); 226 ReturnResources(return_resources);
227 did_submit_frame_ = true; 227 did_submit_frame_ = true;
228 return; 228 return;
229 } 229 }
230 230
231 cc::CompositorFrame submit_frame; 231 cc::CompositorFrame submit_frame;
232 232
233 if (in_software_draw_) { 233 if (in_software_draw_) {
234 // The frame we send to the client is actually just the metadata. Preserve 234 // The frame we send to the client is actually just the metadata. Preserve
235 // the |frame| for the software path below. 235 // the |frame| for the software path below.
236 submit_frame.metadata = frame.metadata.Clone(); 236 submit_frame.metadata = frame.metadata.Clone();
237 237
238 if (!root_local_frame_id_.is_valid()) { 238 if (!root_local_frame_id_.is_valid()) {
239 root_local_frame_id_ = surface_id_allocator_->GenerateId(); 239 root_local_frame_id_ = surface_id_allocator_->GenerateId();
240 surface_factory_->Create(root_local_frame_id_); 240 surface_factory_->Create(root_local_frame_id_);
241 child_local_frame_id_ = surface_id_allocator_->GenerateId(); 241 child_local_frame_id_ = surface_id_allocator_->GenerateId();
242 surface_factory_->Create(child_local_frame_id_); 242 surface_factory_->Create(child_local_frame_id_);
243 } 243 }
244 244
245 display_->SetLocalFrameId(root_local_frame_id_, 245 display_->SetLocalFrameId(root_local_frame_id_,
246 frame.metadata.device_scale_factor); 246 frame.metadata.device_scale_factor);
247 247
248 // The layer compositor should be giving a frame that covers the 248 // The layer compositor should be giving a frame that covers the
249 // |sw_viewport_for_current_draw_| but at 0,0. 249 // |sw_viewport_for_current_draw_| but at 0,0.
250 gfx::Size child_size = sw_viewport_for_current_draw_.size(); 250 gfx::Size child_size = sw_viewport_for_current_draw_.size();
251 DCHECK(gfx::Rect(child_size) == 251 DCHECK(gfx::Rect(child_size) == frame.render_pass_list.back()->output_rect);
252 frame.delegated_frame_data->render_pass_list.back()->output_rect);
253 252
254 // Make a size that covers from 0,0 and includes the area coming from the 253 // Make a size that covers from 0,0 and includes the area coming from the
255 // layer compositor. 254 // layer compositor.
256 gfx::Size display_size(sw_viewport_for_current_draw_.right(), 255 gfx::Size display_size(sw_viewport_for_current_draw_.right(),
257 sw_viewport_for_current_draw_.bottom()); 256 sw_viewport_for_current_draw_.bottom());
258 display_->Resize(display_size); 257 display_->Resize(display_size);
259 258
260 // The offset for the child frame relative to the origin of the canvas being 259 // The offset for the child frame relative to the origin of the canvas being
261 // drawn into. 260 // drawn into.
262 gfx::Transform child_transform; 261 gfx::Transform child_transform;
263 child_transform.Translate( 262 child_transform.Translate(
264 gfx::Vector2dF(sw_viewport_for_current_draw_.OffsetFromOrigin())); 263 gfx::Vector2dF(sw_viewport_for_current_draw_.OffsetFromOrigin()));
265 264
266 // Make a root frame that embeds the frame coming from the layer compositor 265 // Make a root frame that embeds the frame coming from the layer compositor
267 // and positions it based on the provided viewport. 266 // and positions it based on the provided viewport.
268 // TODO(danakj): We could apply the transform here instead of passing it to 267 // TODO(danakj): We could apply the transform here instead of passing it to
269 // the CompositorFrameSink client too? (We'd have to do the same for 268 // the CompositorFrameSink client too? (We'd have to do the same for
270 // hardware frames in SurfacesInstance?) 269 // hardware frames in SurfacesInstance?)
271 cc::CompositorFrame embed_frame; 270 cc::CompositorFrame embed_frame;
272 embed_frame.delegated_frame_data = 271 embed_frame.render_pass_list.push_back(cc::RenderPass::Create());
273 base::MakeUnique<cc::DelegatedFrameData>();
274 embed_frame.delegated_frame_data->render_pass_list.push_back(
275 cc::RenderPass::Create());
276 272
277 // The embedding RenderPass covers the entire Display's area. 273 // The embedding RenderPass covers the entire Display's area.
278 const auto& embed_render_pass = 274 const auto& embed_render_pass = embed_frame.render_pass_list.back();
279 embed_frame.delegated_frame_data->render_pass_list.back();
280 embed_render_pass->SetAll(cc::RenderPassId(1, 1), gfx::Rect(display_size), 275 embed_render_pass->SetAll(cc::RenderPassId(1, 1), gfx::Rect(display_size),
281 gfx::Rect(display_size), gfx::Transform(), false); 276 gfx::Rect(display_size), gfx::Transform(), false);
282 277
283 // The RenderPass has a single SurfaceDrawQuad (and SharedQuadState for it). 278 // The RenderPass has a single SurfaceDrawQuad (and SharedQuadState for it).
284 auto* shared_quad_state = 279 auto* shared_quad_state =
285 embed_render_pass->CreateAndAppendSharedQuadState(); 280 embed_render_pass->CreateAndAppendSharedQuadState();
286 auto* surface_quad = 281 auto* surface_quad =
287 embed_render_pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>(); 282 embed_render_pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>();
288 shared_quad_state->SetAll( 283 shared_quad_state->SetAll(
289 child_transform, child_size, gfx::Rect(child_size), 284 child_transform, child_size, gfx::Rect(child_size),
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 client_->ReclaimResources(resources); 462 client_->ReclaimResources(resources);
468 } 463 }
469 464
470 void SynchronousCompositorFrameSink::SetBeginFrameSource( 465 void SynchronousCompositorFrameSink::SetBeginFrameSource(
471 cc::BeginFrameSource* begin_frame_source) { 466 cc::BeginFrameSource* begin_frame_source) {
472 // Software output is synchronous and doesn't use a BeginFrameSource. 467 // Software output is synchronous and doesn't use a BeginFrameSource.
473 NOTREACHED(); 468 NOTREACHED();
474 } 469 }
475 470
476 } // namespace content 471 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.mm ('k') | services/ui/demo/bitmap_uploader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698