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

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

Issue 839143002: Roll Chrome into Mojo. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Rebase Created 5 years, 11 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/trees/layer_tree_impl.h ('k') | cc/trees/layer_tree_settings.h » ('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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 553
554 bool resourceless_software_draw = (layer_tree_host_impl_->GetDrawMode() == 554 bool resourceless_software_draw = (layer_tree_host_impl_->GetDrawMode() ==
555 DRAW_MODE_RESOURCELESS_SOFTWARE); 555 DRAW_MODE_RESOURCELESS_SOFTWARE);
556 556
557 // LayerIterator is used here instead of CallFunctionForSubtree to only 557 // LayerIterator is used here instead of CallFunctionForSubtree to only
558 // UpdateTilePriorities on layers that will be visible (and thus have valid 558 // UpdateTilePriorities on layers that will be visible (and thus have valid
559 // draw properties) and not because any ordering is required. 559 // draw properties) and not because any ordering is required.
560 typedef LayerIterator<LayerImpl> LayerIteratorType; 560 typedef LayerIterator<LayerImpl> LayerIteratorType;
561 LayerIteratorType end = LayerIteratorType::End(&render_surface_layer_list_); 561 LayerIteratorType end = LayerIteratorType::End(&render_surface_layer_list_);
562 size_t layers_updated_count = 0; 562 size_t layers_updated_count = 0;
563 bool tile_priorities_updated = false;
563 for (LayerIteratorType it = 564 for (LayerIteratorType it =
564 LayerIteratorType::Begin(&render_surface_layer_list_); 565 LayerIteratorType::Begin(&render_surface_layer_list_);
565 it != end; 566 it != end;
566 ++it) { 567 ++it) {
567 if (occlusion_tracker) 568 if (occlusion_tracker)
568 occlusion_tracker->EnterLayer(it); 569 occlusion_tracker->EnterLayer(it);
569 570
570 LayerImpl* layer = *it; 571 LayerImpl* layer = *it;
571 const Occlusion& occlusion_in_content_space = 572 const Occlusion& occlusion_in_content_space =
572 occlusion_tracker ? occlusion_tracker->GetCurrentOcclusionForLayer( 573 occlusion_tracker ? occlusion_tracker->GetCurrentOcclusionForLayer(
573 layer->draw_transform()) 574 layer->draw_transform())
574 : Occlusion(); 575 : Occlusion();
575 576
576 if (it.represents_itself()) { 577 if (it.represents_itself()) {
577 layer->UpdateTiles(occlusion_in_content_space, 578 tile_priorities_updated |= layer->UpdateTiles(
578 resourceless_software_draw); 579 occlusion_in_content_space, resourceless_software_draw);
579 ++layers_updated_count; 580 ++layers_updated_count;
580 } 581 }
581 582
582 if (!it.represents_contributing_render_surface()) { 583 if (!it.represents_contributing_render_surface()) {
583 if (occlusion_tracker) 584 if (occlusion_tracker)
584 occlusion_tracker->LeaveLayer(it); 585 occlusion_tracker->LeaveLayer(it);
585 continue; 586 continue;
586 } 587 }
587 588
588 if (layer->mask_layer()) { 589 if (layer->mask_layer()) {
589 layer->mask_layer()->UpdateTiles(occlusion_in_content_space, 590 tile_priorities_updated |= layer->mask_layer()->UpdateTiles(
590 resourceless_software_draw); 591 occlusion_in_content_space, resourceless_software_draw);
591 ++layers_updated_count; 592 ++layers_updated_count;
592 } 593 }
593 if (layer->replica_layer() && layer->replica_layer()->mask_layer()) { 594 if (layer->replica_layer() && layer->replica_layer()->mask_layer()) {
594 layer->replica_layer()->mask_layer()->UpdateTiles( 595 tile_priorities_updated |=
595 occlusion_in_content_space, resourceless_software_draw); 596 layer->replica_layer()->mask_layer()->UpdateTiles(
597 occlusion_in_content_space, resourceless_software_draw);
596 ++layers_updated_count; 598 ++layers_updated_count;
597 } 599 }
598 600
599 if (occlusion_tracker) 601 if (occlusion_tracker)
600 occlusion_tracker->LeaveLayer(it); 602 occlusion_tracker->LeaveLayer(it);
601 } 603 }
602 604
605 if (tile_priorities_updated)
606 DidModifyTilePriorities();
607
603 TRACE_EVENT_END1("cc", "LayerTreeImpl::UpdateTilePriorities", 608 TRACE_EVENT_END1("cc", "LayerTreeImpl::UpdateTilePriorities",
604 "layers_updated_count", layers_updated_count); 609 "layers_updated_count", layers_updated_count);
605 } 610 }
606 611
607 DCHECK(!needs_update_draw_properties_) << 612 DCHECK(!needs_update_draw_properties_) <<
608 "CalcDrawProperties should not set_needs_update_draw_properties()"; 613 "CalcDrawProperties should not set_needs_update_draw_properties()";
609 return true; 614 return true;
610 } 615 }
611 616
612 const LayerImplList& LayerTreeImpl::RenderSurfaceLayerList() const { 617 const LayerImplList& LayerTreeImpl::RenderSurfaceLayerList() const {
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 ResourceProvider::ResourceId LayerTreeImpl::ResourceIdForUIResource( 1079 ResourceProvider::ResourceId LayerTreeImpl::ResourceIdForUIResource(
1075 UIResourceId uid) const { 1080 UIResourceId uid) const {
1076 return layer_tree_host_impl_->ResourceIdForUIResource(uid); 1081 return layer_tree_host_impl_->ResourceIdForUIResource(uid);
1077 } 1082 }
1078 1083
1079 bool LayerTreeImpl::IsUIResourceOpaque(UIResourceId uid) const { 1084 bool LayerTreeImpl::IsUIResourceOpaque(UIResourceId uid) const {
1080 return layer_tree_host_impl_->IsUIResourceOpaque(uid); 1085 return layer_tree_host_impl_->IsUIResourceOpaque(uid);
1081 } 1086 }
1082 1087
1083 void LayerTreeImpl::ProcessUIResourceRequestQueue() { 1088 void LayerTreeImpl::ProcessUIResourceRequestQueue() {
1084 while (ui_resource_request_queue_.size() > 0) { 1089 for (const auto& req : ui_resource_request_queue_) {
1085 UIResourceRequest req = ui_resource_request_queue_.front();
1086 ui_resource_request_queue_.pop_front();
1087
1088 switch (req.GetType()) { 1090 switch (req.GetType()) {
1089 case UIResourceRequest::UIResourceCreate: 1091 case UIResourceRequest::UIResourceCreate:
1090 layer_tree_host_impl_->CreateUIResource(req.GetId(), req.GetBitmap()); 1092 layer_tree_host_impl_->CreateUIResource(req.GetId(), req.GetBitmap());
1091 break; 1093 break;
1092 case UIResourceRequest::UIResourceDelete: 1094 case UIResourceRequest::UIResourceDelete:
1093 layer_tree_host_impl_->DeleteUIResource(req.GetId()); 1095 layer_tree_host_impl_->DeleteUIResource(req.GetId());
1094 break; 1096 break;
1095 case UIResourceRequest::UIResourceInvalidRequest: 1097 case UIResourceRequest::UIResourceInvalidRequest:
1096 NOTREACHED(); 1098 NOTREACHED();
1097 break; 1099 break;
1098 } 1100 }
1099 } 1101 }
1102 ui_resource_request_queue_.clear();
1100 1103
1101 // If all UI resource evictions were not recreated by processing this queue, 1104 // If all UI resource evictions were not recreated by processing this queue,
1102 // then another commit is required. 1105 // then another commit is required.
1103 if (layer_tree_host_impl_->EvictedUIResourcesExist()) 1106 if (layer_tree_host_impl_->EvictedUIResourcesExist())
1104 layer_tree_host_impl_->SetNeedsCommit(); 1107 layer_tree_host_impl_->SetNeedsCommit();
1105 } 1108 }
1106 1109
1107 void LayerTreeImpl::AddLayerWithCopyOutputRequest(LayerImpl* layer) { 1110 void LayerTreeImpl::AddLayerWithCopyOutputRequest(LayerImpl* layer) {
1108 // Only the active tree needs to know about layers with copy requests, as 1111 // Only the active tree needs to know about layers with copy requests, as
1109 // they are aborted if not serviced during draw. 1112 // they are aborted if not serviced during draw.
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1520 scoped_ptr<PendingPageScaleAnimation> pending_animation) { 1523 scoped_ptr<PendingPageScaleAnimation> pending_animation) {
1521 pending_page_scale_animation_ = pending_animation.Pass(); 1524 pending_page_scale_animation_ = pending_animation.Pass();
1522 } 1525 }
1523 1526
1524 scoped_ptr<PendingPageScaleAnimation> 1527 scoped_ptr<PendingPageScaleAnimation>
1525 LayerTreeImpl::TakePendingPageScaleAnimation() { 1528 LayerTreeImpl::TakePendingPageScaleAnimation() {
1526 return pending_page_scale_animation_.Pass(); 1529 return pending_page_scale_animation_.Pass();
1527 } 1530 }
1528 1531
1529 } // namespace cc 1532 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl.h ('k') | cc/trees/layer_tree_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698