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

Side by Side Diff: cc/surfaces/surface_aggregator.cc

Issue 551013002: Use Custome ListContainer to Allocate SharedQuadState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@DQAllo
Patch Set: rebase Created 6 years, 2 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
« no previous file with comments | « cc/quads/render_pass.cc ('k') | cc/surfaces/surface_aggregator_test_helpers.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "cc/surfaces/surface_aggregator.h" 5 #include "cc/surfaces/surface_aggregator.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/containers/hash_tables.h" 8 #include "base/containers/hash_tables.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 surface->TakeCopyOutputRequests(&copy_requests); 181 surface->TakeCopyOutputRequests(&copy_requests);
182 182
183 bool merge_pass = copy_requests.empty(); 183 bool merge_pass = copy_requests.empty();
184 184
185 const RenderPassList& referenced_passes = render_pass_list; 185 const RenderPassList& referenced_passes = render_pass_list;
186 size_t passes_to_copy = 186 size_t passes_to_copy =
187 merge_pass ? referenced_passes.size() - 1 : referenced_passes.size(); 187 merge_pass ? referenced_passes.size() - 1 : referenced_passes.size();
188 for (size_t j = 0; j < passes_to_copy; ++j) { 188 for (size_t j = 0; j < passes_to_copy; ++j) {
189 const RenderPass& source = *referenced_passes[j]; 189 const RenderPass& source = *referenced_passes[j];
190 190
191 scoped_ptr<RenderPass> copy_pass(RenderPass::Create()); 191 size_t sqs_size = source.shared_quad_state_list.size();
192 size_t dq_size = source.quad_list.size();
193 scoped_ptr<RenderPass> copy_pass(RenderPass::Create(sqs_size, dq_size));
192 194
193 RenderPassId remapped_pass_id = RemapPassId(source.id, surface_id); 195 RenderPassId remapped_pass_id = RemapPassId(source.id, surface_id);
194 196
195 copy_pass->SetAll(remapped_pass_id, 197 copy_pass->SetAll(remapped_pass_id,
196 source.output_rect, 198 source.output_rect,
197 source.damage_rect, 199 source.damage_rect,
198 source.transform_to_root_target, 200 source.transform_to_root_target,
199 source.has_transparent_background); 201 source.has_transparent_background);
200 202
201 // Contributing passes aggregated in to the pass list need to take the 203 // Contributing passes aggregated in to the pass list need to take the
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 } 279 }
278 280
279 void SurfaceAggregator::CopyQuadsToPass( 281 void SurfaceAggregator::CopyQuadsToPass(
280 const QuadList& source_quad_list, 282 const QuadList& source_quad_list,
281 const SharedQuadStateList& source_shared_quad_state_list, 283 const SharedQuadStateList& source_shared_quad_state_list,
282 const gfx::Transform& content_to_target_transform, 284 const gfx::Transform& content_to_target_transform,
283 RenderPass* dest_pass, 285 RenderPass* dest_pass,
284 SurfaceId surface_id) { 286 SurfaceId surface_id) {
285 const SharedQuadState* last_copied_source_shared_quad_state = NULL; 287 const SharedQuadState* last_copied_source_shared_quad_state = NULL;
286 288
287 size_t sqs_i = 0; 289 SharedQuadStateList::ConstIterator sqs_iter =
288 for (QuadList::ConstIterator iter = source_quad_list.begin(); 290 source_shared_quad_state_list.begin();
289 iter != source_quad_list.end(); 291 for (const auto& quad : source_quad_list) {
290 ++iter) { 292 while (quad.shared_quad_state != &*sqs_iter) {
291 const DrawQuad* quad = &*iter; 293 ++sqs_iter;
292 while (quad->shared_quad_state != source_shared_quad_state_list[sqs_i]) { 294 DCHECK(sqs_iter != source_shared_quad_state_list.end());
293 ++sqs_i;
294 DCHECK_LT(sqs_i, source_shared_quad_state_list.size());
295 } 295 }
296 DCHECK_EQ(quad->shared_quad_state, source_shared_quad_state_list[sqs_i]); 296 DCHECK_EQ(quad.shared_quad_state, &*sqs_iter);
297 297
298 if (quad->material == DrawQuad::SURFACE_CONTENT) { 298 if (quad.material == DrawQuad::SURFACE_CONTENT) {
299 const SurfaceDrawQuad* surface_quad = SurfaceDrawQuad::MaterialCast(quad); 299 const SurfaceDrawQuad* surface_quad =
300 SurfaceDrawQuad::MaterialCast(&quad);
300 HandleSurfaceQuad(surface_quad, dest_pass); 301 HandleSurfaceQuad(surface_quad, dest_pass);
301 } else { 302 } else {
302 if (quad->shared_quad_state != last_copied_source_shared_quad_state) { 303 if (quad.shared_quad_state != last_copied_source_shared_quad_state) {
303 CopySharedQuadState( 304 CopySharedQuadState(
304 quad->shared_quad_state, content_to_target_transform, dest_pass); 305 quad.shared_quad_state, content_to_target_transform, dest_pass);
305 last_copied_source_shared_quad_state = quad->shared_quad_state; 306 last_copied_source_shared_quad_state = quad.shared_quad_state;
306 } 307 }
307 if (quad->material == DrawQuad::RENDER_PASS) { 308 if (quad.material == DrawQuad::RENDER_PASS) {
308 const RenderPassDrawQuad* pass_quad = 309 const RenderPassDrawQuad* pass_quad =
309 RenderPassDrawQuad::MaterialCast(quad); 310 RenderPassDrawQuad::MaterialCast(&quad);
310 RenderPassId original_pass_id = pass_quad->render_pass_id; 311 RenderPassId original_pass_id = pass_quad->render_pass_id;
311 RenderPassId remapped_pass_id = 312 RenderPassId remapped_pass_id =
312 RemapPassId(original_pass_id, surface_id); 313 RemapPassId(original_pass_id, surface_id);
313 314
314 dest_pass->CopyFromAndAppendRenderPassDrawQuad( 315 dest_pass->CopyFromAndAppendRenderPassDrawQuad(
315 pass_quad, 316 pass_quad,
316 dest_pass->shared_quad_state_list.back(), 317 dest_pass->shared_quad_state_list.back(),
317 remapped_pass_id); 318 remapped_pass_id);
318 } else { 319 } else {
319 dest_pass->CopyFromAndAppendDrawQuad( 320 dest_pass->CopyFromAndAppendDrawQuad(
320 quad, dest_pass->shared_quad_state_list.back()); 321 &quad, dest_pass->shared_quad_state_list.back());
321 } 322 }
322 } 323 }
323 } 324 }
324 } 325 }
325 326
326 void SurfaceAggregator::CopyPasses(const RenderPassList& source_pass_list, 327 void SurfaceAggregator::CopyPasses(const RenderPassList& source_pass_list,
327 const Surface* surface) { 328 const Surface* surface) {
328 for (size_t i = 0; i < source_pass_list.size(); ++i) { 329 for (size_t i = 0; i < source_pass_list.size(); ++i) {
329 const RenderPass& source = *source_pass_list[i]; 330 const RenderPass& source = *source_pass_list[i];
330 331
331 scoped_ptr<RenderPass> copy_pass(RenderPass::Create()); 332 size_t sqs_size = source.shared_quad_state_list.size();
333 size_t dq_size = source.quad_list.size();
334 scoped_ptr<RenderPass> copy_pass(RenderPass::Create(sqs_size, dq_size));
332 335
333 RenderPassId remapped_pass_id = 336 RenderPassId remapped_pass_id =
334 RemapPassId(source.id, surface->surface_id()); 337 RemapPassId(source.id, surface->surface_id());
335 338
336 copy_pass->SetAll(remapped_pass_id, 339 copy_pass->SetAll(remapped_pass_id,
337 source.output_rect, 340 source.output_rect,
338 DamageRectForSurface(surface, source), 341 DamageRectForSurface(surface, source),
339 source.transform_to_root_target, 342 source.transform_to_root_target,
340 source.has_transparent_background); 343 source.has_transparent_background);
341 344
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 surface->TakeLatencyInfo(&frame->metadata.latency_info); 396 surface->TakeLatencyInfo(&frame->metadata.latency_info);
394 } 397 }
395 398
396 // TODO(jamesr): Aggregate all resource references into the returned frame's 399 // TODO(jamesr): Aggregate all resource references into the returned frame's
397 // resource list. 400 // resource list.
398 401
399 return frame.Pass(); 402 return frame.Pass();
400 } 403 }
401 404
402 } // namespace cc 405 } // namespace cc
OLDNEW
« no previous file with comments | « cc/quads/render_pass.cc ('k') | cc/surfaces/surface_aggregator_test_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698