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

Side by Side Diff: cc/trees/layer_tree_impl.cc

Issue 706203003: Update from https://crrev.com/303153 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | cc/trees/tree_synchronizer_unittest.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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/trees/layer_tree_impl.h" 5 #include "cc/trees/layer_tree_impl.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <set> 8 #include <set>
9 9
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 resource_provider()->max_texture_size(), 499 resource_provider()->max_texture_size(),
500 settings().can_use_lcd_text, 500 settings().can_use_lcd_text,
501 can_render_to_separate_surface, 501 can_render_to_separate_surface,
502 settings().layer_transforms_should_scale_layer_contents, 502 settings().layer_transforms_should_scale_layer_contents,
503 &render_surface_layer_list_, 503 &render_surface_layer_list_,
504 render_surface_layer_list_id_); 504 render_surface_layer_list_id_);
505 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 505 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
506 } 506 }
507 507
508 { 508 {
509 TRACE_EVENT2("cc", 509 TRACE_EVENT_BEGIN2("cc", "LayerTreeImpl::UpdateTilePriorities", "IsActive",
510 "LayerTreeImpl::UpdateTilePriorities", 510 IsActiveTree(), "SourceFrameNumber",
511 "IsActive", 511 source_frame_number_);
512 IsActiveTree(),
513 "SourceFrameNumber",
514 source_frame_number_);
515 scoped_ptr<OcclusionTracker<LayerImpl>> occlusion_tracker; 512 scoped_ptr<OcclusionTracker<LayerImpl>> occlusion_tracker;
516 if (settings().use_occlusion_for_tile_prioritization) { 513 if (settings().use_occlusion_for_tile_prioritization) {
517 occlusion_tracker.reset(new OcclusionTracker<LayerImpl>( 514 occlusion_tracker.reset(new OcclusionTracker<LayerImpl>(
518 root_layer()->render_surface()->content_rect())); 515 root_layer()->render_surface()->content_rect()));
519 occlusion_tracker->set_minimum_tracking_size( 516 occlusion_tracker->set_minimum_tracking_size(
520 settings().minimum_occlusion_tracking_size); 517 settings().minimum_occlusion_tracking_size);
521 } 518 }
522 519
523 bool resourceless_software_draw = (layer_tree_host_impl_->GetDrawMode() == 520 bool resourceless_software_draw = (layer_tree_host_impl_->GetDrawMode() ==
524 DRAW_MODE_RESOURCELESS_SOFTWARE); 521 DRAW_MODE_RESOURCELESS_SOFTWARE);
525 522
526 // LayerIterator is used here instead of CallFunctionForSubtree to only 523 // LayerIterator is used here instead of CallFunctionForSubtree to only
527 // UpdateTilePriorities on layers that will be visible (and thus have valid 524 // UpdateTilePriorities on layers that will be visible (and thus have valid
528 // draw properties) and not because any ordering is required. 525 // draw properties) and not because any ordering is required.
529 typedef LayerIterator<LayerImpl> LayerIteratorType; 526 typedef LayerIterator<LayerImpl> LayerIteratorType;
530 LayerIteratorType end = LayerIteratorType::End(&render_surface_layer_list_); 527 LayerIteratorType end = LayerIteratorType::End(&render_surface_layer_list_);
528 size_t layers_updated_count = 0;
531 for (LayerIteratorType it = 529 for (LayerIteratorType it =
532 LayerIteratorType::Begin(&render_surface_layer_list_); 530 LayerIteratorType::Begin(&render_surface_layer_list_);
533 it != end; 531 it != end;
534 ++it) { 532 ++it) {
535 if (occlusion_tracker) 533 if (occlusion_tracker)
536 occlusion_tracker->EnterLayer(it); 534 occlusion_tracker->EnterLayer(it);
537 535
538 LayerImpl* layer = *it; 536 LayerImpl* layer = *it;
539 const Occlusion& occlusion_in_content_space = 537 const Occlusion& occlusion_in_content_space =
540 occlusion_tracker ? occlusion_tracker->GetCurrentOcclusionForLayer( 538 occlusion_tracker ? occlusion_tracker->GetCurrentOcclusionForLayer(
541 layer->draw_transform()) 539 layer->draw_transform())
542 : Occlusion(); 540 : Occlusion();
543 541
544 if (it.represents_itself()) { 542 if (it.represents_itself()) {
545 layer->UpdateTiles(occlusion_in_content_space, 543 layer->UpdateTiles(occlusion_in_content_space,
546 resourceless_software_draw); 544 resourceless_software_draw);
545 ++layers_updated_count;
547 } 546 }
548 547
549 if (!it.represents_contributing_render_surface()) { 548 if (!it.represents_contributing_render_surface()) {
550 if (occlusion_tracker) 549 if (occlusion_tracker)
551 occlusion_tracker->LeaveLayer(it); 550 occlusion_tracker->LeaveLayer(it);
552 continue; 551 continue;
553 } 552 }
554 553
555 if (layer->mask_layer()) { 554 if (layer->mask_layer()) {
556 layer->mask_layer()->UpdateTiles(occlusion_in_content_space, 555 layer->mask_layer()->UpdateTiles(occlusion_in_content_space,
557 resourceless_software_draw); 556 resourceless_software_draw);
557 ++layers_updated_count;
558 } 558 }
559 if (layer->replica_layer() && layer->replica_layer()->mask_layer()) { 559 if (layer->replica_layer() && layer->replica_layer()->mask_layer()) {
560 layer->replica_layer()->mask_layer()->UpdateTiles( 560 layer->replica_layer()->mask_layer()->UpdateTiles(
561 occlusion_in_content_space, resourceless_software_draw); 561 occlusion_in_content_space, resourceless_software_draw);
562 ++layers_updated_count;
562 } 563 }
563 564
564 if (occlusion_tracker) 565 if (occlusion_tracker)
565 occlusion_tracker->LeaveLayer(it); 566 occlusion_tracker->LeaveLayer(it);
566 } 567 }
568
569 TRACE_EVENT_END1("cc", "LayerTreeImpl::UpdateTilePriorities",
570 "layers_updated_count", layers_updated_count);
567 } 571 }
568 572
569 DCHECK(!needs_update_draw_properties_) << 573 DCHECK(!needs_update_draw_properties_) <<
570 "CalcDrawProperties should not set_needs_update_draw_properties()"; 574 "CalcDrawProperties should not set_needs_update_draw_properties()";
571 return true; 575 return true;
572 } 576 }
573 577
574 const LayerImplList& LayerTreeImpl::RenderSurfaceLayerList() const { 578 const LayerImplList& LayerTreeImpl::RenderSurfaceLayerList() const {
575 // If this assert triggers, then the list is dirty. 579 // If this assert triggers, then the list is dirty.
576 DCHECK(!needs_update_draw_properties_); 580 DCHECK(!needs_update_draw_properties_);
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
1515 page_scale, 1519 page_scale,
1516 duration.InSecondsF()); 1520 duration.InSecondsF());
1517 } 1521 }
1518 } 1522 }
1519 1523
1520 scoped_ptr<PageScaleAnimation> LayerTreeImpl::TakePageScaleAnimation() { 1524 scoped_ptr<PageScaleAnimation> LayerTreeImpl::TakePageScaleAnimation() {
1521 return page_scale_animation_.Pass(); 1525 return page_scale_animation_.Pass();
1522 } 1526 }
1523 1527
1524 } // namespace cc 1528 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | cc/trees/tree_synchronizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698