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

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

Issue 671653005: SetNeedsRedraw directly when updating a visible tile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.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
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 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 } 1110 }
1111 } 1111 }
1112 } 1112 }
1113 1113
1114 DrawResult LayerTreeHostImpl::PrepareToDraw(FrameData* frame) { 1114 DrawResult LayerTreeHostImpl::PrepareToDraw(FrameData* frame) {
1115 TRACE_EVENT1("cc", 1115 TRACE_EVENT1("cc",
1116 "LayerTreeHostImpl::PrepareToDraw", 1116 "LayerTreeHostImpl::PrepareToDraw",
1117 "SourceFrameNumber", 1117 "SourceFrameNumber",
1118 active_tree_->source_frame_number()); 1118 active_tree_->source_frame_number());
1119 1119
1120 if (need_to_update_visible_tiles_before_draw_ && 1120 if (need_to_update_visible_tiles_before_draw_ && tile_manager_)
1121 tile_manager_ && tile_manager_->UpdateVisibleTiles()) { 1121 tile_manager_->UpdateVisibleTiles();
1122 DidInitializeVisibleTile();
1123 }
1124 need_to_update_visible_tiles_before_draw_ = true; 1122 need_to_update_visible_tiles_before_draw_ = true;
1125 1123
1126 UMA_HISTOGRAM_CUSTOM_COUNTS( 1124 UMA_HISTOGRAM_CUSTOM_COUNTS(
1127 "Compositing.NumActiveLayers", active_tree_->NumLayers(), 1, 400, 20); 1125 "Compositing.NumActiveLayers", active_tree_->NumLayers(), 1, 400, 20);
1128 1126
1129 bool ok = active_tree_->UpdateDrawProperties(); 1127 bool ok = active_tree_->UpdateDrawProperties();
1130 DCHECK(ok) << "UpdateDrawProperties failed during draw"; 1128 DCHECK(ok) << "UpdateDrawProperties failed during draw";
1131 1129
1132 frame->render_surface_layer_list = &active_tree_->RenderSurfaceLayerList(); 1130 frame->render_surface_layer_list = &active_tree_->RenderSurfaceLayerList();
1133 frame->render_passes.clear(); 1131 frame->render_passes.clear();
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 } 1260 }
1263 1261
1264 void LayerTreeHostImpl::DidModifyTilePriorities() { 1262 void LayerTreeHostImpl::DidModifyTilePriorities() {
1265 DCHECK(settings_.impl_side_painting); 1263 DCHECK(settings_.impl_side_painting);
1266 // Mark priorities as dirty and schedule a ManageTiles(). 1264 // Mark priorities as dirty and schedule a ManageTiles().
1267 tile_priorities_dirty_ = true; 1265 tile_priorities_dirty_ = true;
1268 client_->SetNeedsManageTilesOnImplThread(); 1266 client_->SetNeedsManageTilesOnImplThread();
1269 } 1267 }
1270 1268
1271 void LayerTreeHostImpl::DidInitializeVisibleTile() { 1269 void LayerTreeHostImpl::DidInitializeVisibleTile() {
1272 if (client_ && !client_->IsInsideDraw()) 1270 DCHECK(!client_->IsInsideDraw());
1273 client_->DidInitializeVisibleTileOnImplThread(); 1271 client_->DidInitializeVisibleTileOnImplThread();
1274 } 1272 }
1275 1273
1276 void LayerTreeHostImpl::GetPictureLayerImplPairs( 1274 void LayerTreeHostImpl::GetPictureLayerImplPairs(
1277 std::vector<PictureLayerImpl::Pair>* layer_pairs) const { 1275 std::vector<PictureLayerImpl::Pair>* layer_pairs) const {
1278 DCHECK(layer_pairs->empty()); 1276 DCHECK(layer_pairs->empty());
1279 for (std::vector<PictureLayerImpl*>::const_iterator it = 1277 for (std::vector<PictureLayerImpl*>::const_iterator it =
1280 picture_layers_.begin(); 1278 picture_layers_.begin();
1281 it != picture_layers_.end(); 1279 it != picture_layers_.end();
1282 ++it) { 1280 ++it) {
1283 PictureLayerImpl* layer = *it; 1281 PictureLayerImpl* layer = *it;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 1321
1324 const std::vector<PictureLayerImpl*>& LayerTreeHostImpl::GetPictureLayers() 1322 const std::vector<PictureLayerImpl*>& LayerTreeHostImpl::GetPictureLayers()
1325 const { 1323 const {
1326 return picture_layers_; 1324 return picture_layers_;
1327 } 1325 }
1328 1326
1329 void LayerTreeHostImpl::NotifyReadyToActivate() { 1327 void LayerTreeHostImpl::NotifyReadyToActivate() {
1330 client_->NotifyReadyToActivate(); 1328 client_->NotifyReadyToActivate();
1331 } 1329 }
1332 1330
1333 void LayerTreeHostImpl::NotifyTileStateChanged(const Tile* tile) { 1331 void LayerTreeHostImpl::NotifyTileStateChanged(const Tile* tile,
1332 bool visible_tile) {
1334 TRACE_EVENT0("cc", "LayerTreeHostImpl::NotifyTileStateChanged"); 1333 TRACE_EVENT0("cc", "LayerTreeHostImpl::NotifyTileStateChanged");
1335 1334
1336 if (active_tree_) { 1335 if (active_tree_) {
1337 LayerImpl* layer_impl = 1336 LayerImpl* layer_impl =
1338 active_tree_->FindActiveTreeLayerById(tile->layer_id()); 1337 active_tree_->FindActiveTreeLayerById(tile->layer_id());
1339 if (layer_impl) 1338 if (layer_impl)
1340 layer_impl->NotifyTileStateChanged(tile); 1339 layer_impl->NotifyTileStateChanged(tile);
1341 } 1340 }
1342 1341
1343 if (pending_tree_) { 1342 if (pending_tree_) {
1344 LayerImpl* layer_impl = 1343 LayerImpl* layer_impl =
1345 pending_tree_->FindPendingTreeLayerById(tile->layer_id()); 1344 pending_tree_->FindPendingTreeLayerById(tile->layer_id());
1346 if (layer_impl) 1345 if (layer_impl)
1347 layer_impl->NotifyTileStateChanged(tile); 1346 layer_impl->NotifyTileStateChanged(tile);
1348 } 1347 }
1348
1349 if (visible_tile && !client_->IsInsideDraw())
enne (OOO) 2014/10/28 18:09:22 I don't think we want to redraw if a tile gets rem
danakj 2014/10/28 18:24:48 Ya.. though that's like flaky at best if you scrol
enne (OOO) 2014/10/28 18:47:33 No, it's true that it's flaky at best. But, it se
danakj 2014/10/31 20:02:01 Actually, I don't think I agree. If we're evicting
1350 SetNeedsRedraw();
1349 } 1351 }
1350 1352
1351 void LayerTreeHostImpl::SetMemoryPolicy(const ManagedMemoryPolicy& policy) { 1353 void LayerTreeHostImpl::SetMemoryPolicy(const ManagedMemoryPolicy& policy) {
1352 SetManagedMemoryPolicy(policy, zero_budget_); 1354 SetManagedMemoryPolicy(policy, zero_budget_);
1353 } 1355 }
1354 1356
1355 void LayerTreeHostImpl::SetTreeActivationCallback( 1357 void LayerTreeHostImpl::SetTreeActivationCallback(
1356 const base::Closure& callback) { 1358 const base::Closure& callback) {
1357 DCHECK(proxy_->IsImplThread()); 1359 DCHECK(proxy_->IsImplThread());
1358 DCHECK(settings_.impl_side_painting || callback.is_null()); 1360 DCHECK(settings_.impl_side_painting || callback.is_null());
(...skipping 1625 matching lines...) Expand 10 before | Expand all | Expand 10 after
2984 2986
2985 void LayerTreeHostImpl::PinchGestureEnd() { 2987 void LayerTreeHostImpl::PinchGestureEnd() {
2986 pinch_gesture_active_ = false; 2988 pinch_gesture_active_ = false;
2987 if (pinch_gesture_end_should_clear_scrolling_layer_) { 2989 if (pinch_gesture_end_should_clear_scrolling_layer_) {
2988 pinch_gesture_end_should_clear_scrolling_layer_ = false; 2990 pinch_gesture_end_should_clear_scrolling_layer_ = false;
2989 ClearCurrentlyScrollingLayer(); 2991 ClearCurrentlyScrollingLayer();
2990 } 2992 }
2991 if (top_controls_manager_) 2993 if (top_controls_manager_)
2992 top_controls_manager_->PinchEnd(); 2994 top_controls_manager_->PinchEnd();
2993 client_->SetNeedsCommitOnImplThread(); 2995 client_->SetNeedsCommitOnImplThread();
2996 // When a pinch ends, we may be displaying content cached at incorrect scales,
2997 // so updating draw properties and drawing will ensure we are using the right
2998 // scales that we want when we're not inside a pinch.
2999 LOG(ERROR) << "END PINCH";
3000 active_tree_->set_needs_update_draw_properties();
3001 SetNeedsRedraw();
enne (OOO) 2014/10/28 18:09:21 Do you need the set needs redraw as well? Is this
enne (OOO) 2014/10/28 18:09:21 Do you need the set needs redraw as well? Is this
danakj 2014/10/28 18:24:48 We need this in order to trigger an UpdateDrawProp
enne (OOO) 2014/10/28 18:47:33 As I said elsewhere, the redraw part of that seems
danakj 2014/10/31 20:02:01 I think we agreed this is not racey. The Draw will
2994 } 3002 }
2995 3003
2996 static void CollectScrollDeltas(ScrollAndScaleSet* scroll_info, 3004 static void CollectScrollDeltas(ScrollAndScaleSet* scroll_info,
2997 LayerImpl* layer_impl) { 3005 LayerImpl* layer_impl) {
2998 DCHECK(layer_impl); 3006 DCHECK(layer_impl);
2999 3007
3000 gfx::Vector2d scroll_delta = 3008 gfx::Vector2d scroll_delta =
3001 gfx::ToFlooredVector2d(layer_impl->ScrollDelta()); 3009 gfx::ToFlooredVector2d(layer_impl->ScrollDelta());
3002 if (!scroll_delta.IsZero()) { 3010 if (!scroll_delta.IsZero()) {
3003 LayerTreeHostCommon::ScrollUpdateInfo scroll; 3011 LayerTreeHostCommon::ScrollUpdateInfo scroll;
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
3478 } 3486 }
3479 3487
3480 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { 3488 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) {
3481 std::vector<PictureLayerImpl*>::iterator it = 3489 std::vector<PictureLayerImpl*>::iterator it =
3482 std::find(picture_layers_.begin(), picture_layers_.end(), layer); 3490 std::find(picture_layers_.begin(), picture_layers_.end(), layer);
3483 DCHECK(it != picture_layers_.end()); 3491 DCHECK(it != picture_layers_.end());
3484 picture_layers_.erase(it); 3492 picture_layers_.erase(it);
3485 } 3493 }
3486 3494
3487 } // namespace cc 3495 } // namespace cc
OLDNEW
« cc/resources/tile_manager.cc ('K') | « cc/trees/layer_tree_host_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698