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

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

Issue 18191020: UI Resource Manager (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Added DCHECK of resource queue size to PushPropertiesTo Created 7 years, 4 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') | no next file » | 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 "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "cc/animation/keyframed_animation_curve.h" 8 #include "cc/animation/keyframed_animation_curve.h"
9 #include "cc/animation/scrollbar_animation_controller.h" 9 #include "cc/animation/scrollbar_animation_controller.h"
10 #include "cc/debug/traced_value.h" 10 #include "cc/debug/traced_value.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 root_scroll_layer_->SetScrollOffsetDelegate(NULL); 97 root_scroll_layer_->SetScrollOffsetDelegate(NULL);
98 root_scroll_layer_ = NULL; 98 root_scroll_layer_ = NULL;
99 currently_scrolling_layer_ = NULL; 99 currently_scrolling_layer_ = NULL;
100 100
101 render_surface_layer_list_.clear(); 101 render_surface_layer_list_.clear();
102 set_needs_update_draw_properties(); 102 set_needs_update_draw_properties();
103 return root_layer_.Pass(); 103 return root_layer_.Pass();
104 } 104 }
105 105
106 void LayerTreeImpl::PushPropertiesTo(LayerTreeImpl* target_tree) { 106 void LayerTreeImpl::PushPropertiesTo(LayerTreeImpl* target_tree) {
107 // The request queue should have been processed and does not require a push.
108 DCHECK_EQ(ui_resource_request_queue_.size(), 0u);
109
107 target_tree->SetLatencyInfo(latency_info_); 110 target_tree->SetLatencyInfo(latency_info_);
108 latency_info_.Clear(); 111 latency_info_.Clear();
109 target_tree->SetPageScaleFactorAndLimits( 112 target_tree->SetPageScaleFactorAndLimits(
110 page_scale_factor(), min_page_scale_factor(), max_page_scale_factor()); 113 page_scale_factor(), min_page_scale_factor(), max_page_scale_factor());
111 target_tree->SetPageScaleDelta( 114 target_tree->SetPageScaleDelta(
112 target_tree->page_scale_delta() / target_tree->sent_page_scale_delta()); 115 target_tree->page_scale_delta() / target_tree->sent_page_scale_delta());
113 target_tree->set_sent_page_scale_delta(1); 116 target_tree->set_sent_page_scale_delta(1);
114 117
115 // This should match the property synchronization in 118 // This should match the property synchronization in
116 // LayerTreeHost::finishCommitOnImplThread(). 119 // LayerTreeHost::finishCommitOnImplThread().
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 IsActiveTree() && 278 IsActiveTree() &&
276 RootScrollLayer()) { 279 RootScrollLayer()) {
277 UpdateSolidColorScrollbars(); 280 UpdateSolidColorScrollbars();
278 } 281 }
279 282
280 needs_update_draw_properties_ = false; 283 needs_update_draw_properties_ = false;
281 render_surface_layer_list_.clear(); 284 render_surface_layer_list_.clear();
282 285
283 // For max_texture_size. 286 // For max_texture_size.
284 if (!layer_tree_host_impl_->renderer()) 287 if (!layer_tree_host_impl_->renderer())
285 return; 288 return;
286 289
287 if (!root_layer()) 290 if (!root_layer())
288 return; 291 return;
289 292
290 { 293 {
291 TRACE_EVENT2("cc", 294 TRACE_EVENT2("cc",
292 "LayerTreeImpl::UpdateDrawProperties", 295 "LayerTreeImpl::UpdateDrawProperties",
293 "IsActive", 296 "IsActive",
294 IsActiveTree(), 297 IsActiveTree(),
295 "SourceFrameNumber", 298 "SourceFrameNumber",
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 continue; 525 continue;
523 render_surface_layer_list->Append(TracedValue::CreateIDRef(*it).release()); 526 render_surface_layer_list->Append(TracedValue::CreateIDRef(*it).release());
524 } 527 }
525 528
526 state->Set("render_surface_layer_list", 529 state->Set("render_surface_layer_list",
527 render_surface_layer_list.release()); 530 render_surface_layer_list.release());
528 return state.PassAs<base::Value>(); 531 return state.PassAs<base::Value>();
529 } 532 }
530 533
531 void LayerTreeImpl::SetRootLayerScrollOffsetDelegate( 534 void LayerTreeImpl::SetRootLayerScrollOffsetDelegate(
532 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate) { 535 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate) {
533 root_layer_scroll_offset_delegate_ = root_layer_scroll_offset_delegate; 536 root_layer_scroll_offset_delegate_ = root_layer_scroll_offset_delegate;
534 if (root_scroll_layer_) { 537 if (root_scroll_layer_) {
535 root_scroll_layer_->SetScrollOffsetDelegate( 538 root_scroll_layer_->SetScrollOffsetDelegate(
536 root_layer_scroll_offset_delegate_); 539 root_layer_scroll_offset_delegate_);
537 } 540 }
538 } 541 }
539 542
540 void LayerTreeImpl::UpdateRootScrollLayerSizeDelta() { 543 void LayerTreeImpl::UpdateRootScrollLayerSizeDelta() {
541 LayerImpl* root_scroll = RootScrollLayer(); 544 LayerImpl* root_scroll = RootScrollLayer();
542 LayerImpl* root_container = RootContainerLayer(); 545 LayerImpl* root_container = RootContainerLayer();
(...skipping 22 matching lines...) Expand all
565 } 568 }
566 569
567 void LayerTreeImpl::ClearLatencyInfo() { 570 void LayerTreeImpl::ClearLatencyInfo() {
568 latency_info_.Clear(); 571 latency_info_.Clear();
569 } 572 }
570 573
571 void LayerTreeImpl::WillModifyTilePriorities() { 574 void LayerTreeImpl::WillModifyTilePriorities() {
572 layer_tree_host_impl_->SetNeedsManageTiles(); 575 layer_tree_host_impl_->SetNeedsManageTiles();
573 } 576 }
574 577
578 void LayerTreeImpl::set_ui_resource_request_queue(
579 const UIResourceRequestQueue& queue) {
580 ui_resource_request_queue_ = queue;
581 }
582
583 ResourceProvider::ResourceId LayerTreeImpl::ResourceIdForUIResource(
584 UIResourceId uid) const {
585 return layer_tree_host_impl_->ResourceIdForUIResource(uid);
586 }
587
588 void LayerTreeImpl::ProcessUIResourceRequestQueue() {
589 while (ui_resource_request_queue_.size() > 0) {
590 UIResourceRequest req = ui_resource_request_queue_.front();
591 ui_resource_request_queue_.pop_front();
592
593 switch (req.type) {
594 case UIResourceRequest::UIResourceCreate:
595 layer_tree_host_impl_->CreateUIResource(req.id, req.bitmap);
596 break;
597 case UIResourceRequest::UIResourceDelete:
598 layer_tree_host_impl_->DeleteUIResource(req.id);
599 break;
600 default:
601 NOTREACHED();
602 break;
603 }
604 }
605 }
606
575 void LayerTreeImpl::AddLayerWithCopyOutputRequest(LayerImpl* layer) { 607 void LayerTreeImpl::AddLayerWithCopyOutputRequest(LayerImpl* layer) {
576 // Only the active tree needs to know about layers with copy requests, as 608 // Only the active tree needs to know about layers with copy requests, as
577 // they are aborted if not serviced during draw. 609 // they are aborted if not serviced during draw.
578 DCHECK(IsActiveTree()); 610 DCHECK(IsActiveTree());
579 611
580 DCHECK(std::find(layers_with_copy_output_request_.begin(), 612 DCHECK(std::find(layers_with_copy_output_request_.begin(),
581 layers_with_copy_output_request_.end(), 613 layers_with_copy_output_request_.end(),
582 layer) == layers_with_copy_output_request_.end()); 614 layer) == layers_with_copy_output_request_.end());
583 layers_with_copy_output_request_.push_back(layer); 615 layers_with_copy_output_request_.push_back(layer);
584 } 616 }
(...skipping 14 matching lines...) Expand all
599 const std::vector<LayerImpl*> LayerTreeImpl::LayersWithCopyOutputRequest() 631 const std::vector<LayerImpl*> LayerTreeImpl::LayersWithCopyOutputRequest()
600 const { 632 const {
601 // Only the active tree needs to know about layers with copy requests, as 633 // Only the active tree needs to know about layers with copy requests, as
602 // they are aborted if not serviced during draw. 634 // they are aborted if not serviced during draw.
603 DCHECK(IsActiveTree()); 635 DCHECK(IsActiveTree());
604 636
605 return layers_with_copy_output_request_; 637 return layers_with_copy_output_request_;
606 } 638 }
607 639
608 } // namespace cc 640 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698