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

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

Issue 23796002: cc: Implement deadine scheduling disabled by default (Closed) Base URL: http://git.chromium.org/chromium/src.git@schedReadback4
Patch Set: Fix context lost race conditions Created 7 years, 3 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
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_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 } 1042 }
1043 1043
1044 bool LayerTreeHostImpl::PrepareToDraw(FrameData* frame, 1044 bool LayerTreeHostImpl::PrepareToDraw(FrameData* frame,
1045 gfx::Rect device_viewport_damage_rect) { 1045 gfx::Rect device_viewport_damage_rect) {
1046 TRACE_EVENT1("cc", 1046 TRACE_EVENT1("cc",
1047 "LayerTreeHostImpl::PrepareToDraw", 1047 "LayerTreeHostImpl::PrepareToDraw",
1048 "SourceFrameNumber", 1048 "SourceFrameNumber",
1049 active_tree_->source_frame_number()); 1049 active_tree_->source_frame_number());
1050 1050
1051 if (need_to_update_visible_tiles_before_draw_) { 1051 if (need_to_update_visible_tiles_before_draw_) {
1052 DCHECK(tile_manager_); 1052 if (tile_manager_ && tile_manager_->UpdateVisibleTiles()) {
1053 if (tile_manager_->UpdateVisibleTiles()) 1053 // We do not notify the client that there is a new visible tile
1054 DidInitializeVisibleTile(); 1054 // unless the UpdateVisibleTiles was triggered by the client explicitly.
1055 // Otherwise, we will get spurious redraws.
1056 const bool notify_client = false;
1057 DidInitializeVisibleTile(notify_client);
1058 }
1055 } 1059 }
1060 need_to_update_visible_tiles_before_draw_ = true;
1056 1061
1057 active_tree_->UpdateDrawProperties(); 1062 active_tree_->UpdateDrawProperties();
1058 1063
1059 frame->render_surface_layer_list = &active_tree_->RenderSurfaceLayerList(); 1064 frame->render_surface_layer_list = &active_tree_->RenderSurfaceLayerList();
1060 frame->render_passes.clear(); 1065 frame->render_passes.clear();
1061 frame->render_passes_by_id.clear(); 1066 frame->render_passes_by_id.clear();
1062 frame->will_draw_layers.clear(); 1067 frame->will_draw_layers.clear();
1063 frame->contains_incomplete_tile = false; 1068 frame->contains_incomplete_tile = false;
1064 frame->has_no_damage = false; 1069 frame->has_no_damage = false;
1065 1070
(...skipping 17 matching lines...) Expand all
1083 } 1088 }
1084 1089
1085 void LayerTreeHostImpl::EvictTexturesForTesting() { 1090 void LayerTreeHostImpl::EvictTexturesForTesting() {
1086 EnforceManagedMemoryPolicy(ManagedMemoryPolicy(0)); 1091 EnforceManagedMemoryPolicy(ManagedMemoryPolicy(0));
1087 } 1092 }
1088 1093
1089 void LayerTreeHostImpl::BlockNotifyReadyToActivateForTesting(bool block) { 1094 void LayerTreeHostImpl::BlockNotifyReadyToActivateForTesting(bool block) {
1090 NOTREACHED(); 1095 NOTREACHED();
1091 } 1096 }
1092 1097
1098 void LayerTreeHostImpl::DidInitializeVisibleTileForTesting() {
1099 const bool notify_client = true;
1100 DidInitializeVisibleTile(notify_client);
1101 }
1102
1093 void LayerTreeHostImpl::EnforceManagedMemoryPolicy( 1103 void LayerTreeHostImpl::EnforceManagedMemoryPolicy(
1094 const ManagedMemoryPolicy& policy) { 1104 const ManagedMemoryPolicy& policy) {
1095 1105
1096 bool evicted_resources = client_->ReduceContentsTextureMemoryOnImplThread( 1106 bool evicted_resources = client_->ReduceContentsTextureMemoryOnImplThread(
1097 visible_ ? policy.bytes_limit_when_visible 1107 visible_ ? policy.bytes_limit_when_visible
1098 : policy.bytes_limit_when_not_visible, 1108 : policy.bytes_limit_when_not_visible,
1099 ManagedMemoryPolicy::PriorityCutoffToValue( 1109 ManagedMemoryPolicy::PriorityCutoffToValue(
1100 visible_ ? policy.priority_cutoff_when_visible 1110 visible_ ? policy.priority_cutoff_when_visible
1101 : policy.priority_cutoff_when_not_visible)); 1111 : policy.priority_cutoff_when_not_visible));
1102 if (evicted_resources) { 1112 if (evicted_resources) {
(...skipping 26 matching lines...) Expand all
1129 new_state.memory_limit_policy = 1139 new_state.memory_limit_policy =
1130 ManagedMemoryPolicy::PriorityCutoffToTileMemoryLimitPolicy( 1140 ManagedMemoryPolicy::PriorityCutoffToTileMemoryLimitPolicy(
1131 visible_ ? 1141 visible_ ?
1132 policy.priority_cutoff_when_visible : 1142 policy.priority_cutoff_when_visible :
1133 policy.priority_cutoff_when_not_visible); 1143 policy.priority_cutoff_when_not_visible);
1134 new_state.num_resources_limit = policy.num_resources_limit; 1144 new_state.num_resources_limit = policy.num_resources_limit;
1135 tile_manager_->SetGlobalState(new_state); 1145 tile_manager_->SetGlobalState(new_state);
1136 manage_tiles_needed_ = true; 1146 manage_tiles_needed_ = true;
1137 } 1147 }
1138 1148
1139 void LayerTreeHostImpl::DidInitializeVisibleTile() { 1149 void LayerTreeHostImpl::DidInitializeVisibleTile(bool notify_client) {
1140 // TODO(reveman): Determine tiles that changed and only damage 1150 // TODO(reveman): Determine tiles that changed and only damage
1141 // what's necessary. 1151 // what's necessary.
1142 SetFullRootLayerDamage(); 1152 SetFullRootLayerDamage();
1143 if (client_) 1153 if (client_ && notify_client)
1144 client_->DidInitializeVisibleTileOnImplThread(); 1154 client_->DidInitializeVisibleTileOnImplThread();
1145 } 1155 }
1146 1156
1147 void LayerTreeHostImpl::NotifyReadyToActivate() { 1157 void LayerTreeHostImpl::NotifyReadyToActivate() {
1148 client_->NotifyReadyToActivate(); 1158 client_->NotifyReadyToActivate();
1149 } 1159 }
1150 1160
1151 void LayerTreeHostImpl::SetMemoryPolicy(const ManagedMemoryPolicy& policy) { 1161 void LayerTreeHostImpl::SetMemoryPolicy(const ManagedMemoryPolicy& policy) {
1152 SetManagedMemoryPolicy(policy, zero_budget_); 1162 SetManagedMemoryPolicy(policy, zero_budget_);
1153 } 1163 }
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1480 recycle_tree_.swap(pending_tree_); 1490 recycle_tree_.swap(pending_tree_);
1481 else 1491 else
1482 pending_tree_ = LayerTreeImpl::create(this); 1492 pending_tree_ = LayerTreeImpl::create(this);
1483 client_->OnCanDrawStateChanged(CanDraw()); 1493 client_->OnCanDrawStateChanged(CanDraw());
1484 TRACE_EVENT_ASYNC_BEGIN0("cc", "PendingTree", pending_tree_.get()); 1494 TRACE_EVENT_ASYNC_BEGIN0("cc", "PendingTree", pending_tree_.get());
1485 TRACE_EVENT_ASYNC_STEP0("cc", 1495 TRACE_EVENT_ASYNC_STEP0("cc",
1486 "PendingTree", pending_tree_.get(), "waiting"); 1496 "PendingTree", pending_tree_.get(), "waiting");
1487 } 1497 }
1488 1498
1489 void LayerTreeHostImpl::UpdateVisibleTiles() { 1499 void LayerTreeHostImpl::UpdateVisibleTiles() {
1490 DCHECK(!client_->IsInsideDraw()) << 1500 DCHECK(!client_->IsInsideDraw())
enne (OOO) 2013/09/11 22:30:47 I think this would be cleaner if you just checked
brianderson 2013/09/12 00:12:34 I like your first suggestion and will go with that
1491 "Updating visible tiles within a draw may trigger " 1501 << "Updating visible tiles within a draw may trigger spurious redraws.";
1492 "spurious redraws."; 1502 if (tile_manager_ && tile_manager_->UpdateVisibleTiles()) {
1493 if (tile_manager_ && tile_manager_->UpdateVisibleTiles()) 1503 const bool notify_client = true;
1494 DidInitializeVisibleTile(); 1504 DidInitializeVisibleTile(notify_client);
1505 }
1495 1506
1496 need_to_update_visible_tiles_before_draw_ = false; 1507 need_to_update_visible_tiles_before_draw_ = false;
1497 } 1508 }
1498 1509
1499 void LayerTreeHostImpl::ActivatePendingTree() { 1510 void LayerTreeHostImpl::ActivatePendingTree() {
1500 CHECK(pending_tree_); 1511 CHECK(pending_tree_);
1501 TRACE_EVENT_ASYNC_END0("cc", "PendingTree", pending_tree_.get()); 1512 TRACE_EVENT_ASYNC_END0("cc", "PendingTree", pending_tree_.get());
1502 1513
1503 need_to_update_visible_tiles_before_draw_ = true; 1514 need_to_update_visible_tiles_before_draw_ = true;
1504 1515
(...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after
2662 2673
2663 ResourceProvider::ResourceId LayerTreeHostImpl::ResourceIdForUIResource( 2674 ResourceProvider::ResourceId LayerTreeHostImpl::ResourceIdForUIResource(
2664 UIResourceId uid) const { 2675 UIResourceId uid) const {
2665 UIResourceMap::const_iterator iter = ui_resource_map_.find(uid); 2676 UIResourceMap::const_iterator iter = ui_resource_map_.find(uid);
2666 if (iter != ui_resource_map_.end()) 2677 if (iter != ui_resource_map_.end())
2667 return iter->second; 2678 return iter->second;
2668 return 0; 2679 return 0;
2669 } 2680 }
2670 2681
2671 } // namespace cc 2682 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698