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

Side by Side Diff: cc/resources/picture_layer_tiling.cc

Issue 17891002: cc: Reset tile priority before deleting tiling. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase Created 7 years, 5 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/resources/picture_layer_tiling.h ('k') | cc/test/fake_picture_layer_tiling_client.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/resources/picture_layer_tiling.h" 5 #include "cc/resources/picture_layer_tiling.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 gfx::ScaleSize(layer_bounds, contents_scale)).IsEmpty()) << 42 gfx::ScaleSize(layer_bounds, contents_scale)).IsEmpty()) <<
43 "Tiling created with scale too small as contents become empty." << 43 "Tiling created with scale too small as contents become empty." <<
44 " Layer bounds: " << layer_bounds.ToString() << 44 " Layer bounds: " << layer_bounds.ToString() <<
45 " Contents scale: " << contents_scale; 45 " Contents scale: " << contents_scale;
46 46
47 tiling_data_.SetTotalSize(content_bounds); 47 tiling_data_.SetTotalSize(content_bounds);
48 tiling_data_.SetMaxTextureSize(tile_size); 48 tiling_data_.SetMaxTextureSize(tile_size);
49 } 49 }
50 50
51 PictureLayerTiling::~PictureLayerTiling() { 51 PictureLayerTiling::~PictureLayerTiling() {
52 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it)
53 client_->DestroyTile(it->second);
52 } 54 }
53 55
54 void PictureLayerTiling::SetClient(PictureLayerTilingClient* client) { 56 void PictureLayerTiling::SetClient(PictureLayerTilingClient* client) {
55 client_ = client; 57 client_ = client;
56 } 58 }
57 59
58 gfx::Rect PictureLayerTiling::ContentRect() const { 60 gfx::Rect PictureLayerTiling::ContentRect() const {
59 return gfx::Rect(tiling_data_.total_size()); 61 return gfx::Rect(tiling_data_.total_size());
60 } 62 }
61 63
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 262
261 return texture_rect; 263 return texture_rect;
262 } 264 }
263 265
264 gfx::Size PictureLayerTiling::CoverageIterator::texture_size() const { 266 gfx::Size PictureLayerTiling::CoverageIterator::texture_size() const {
265 return tiling_->tiling_data_.max_texture_size(); 267 return tiling_->tiling_data_.max_texture_size();
266 } 268 }
267 269
268 void PictureLayerTiling::Reset() { 270 void PictureLayerTiling::Reset() {
269 live_tiles_rect_ = gfx::Rect(); 271 live_tiles_rect_ = gfx::Rect();
272 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it)
273 client_->DestroyTile(it->second);
270 tiles_.clear(); 274 tiles_.clear();
271 } 275 }
272 276
273 void PictureLayerTiling::UpdateTilePriorities( 277 void PictureLayerTiling::UpdateTilePriorities(
274 WhichTree tree, 278 WhichTree tree,
275 gfx::Size device_viewport, 279 gfx::Size device_viewport,
276 gfx::Rect viewport_in_layer_space, 280 gfx::Rect viewport_in_layer_space,
277 gfx::Rect visible_layer_rect, 281 gfx::Rect visible_layer_rect,
278 gfx::Size last_layer_bounds, 282 gfx::Size last_layer_bounds,
279 gfx::Size current_layer_bounds, 283 gfx::Size current_layer_bounds,
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 live_tiles_rect_, 435 live_tiles_rect_,
432 new_live_tiles_rect); 436 new_live_tiles_rect);
433 iter; 437 iter;
434 ++iter) { 438 ++iter) {
435 TileMapKey key(iter.index()); 439 TileMapKey key(iter.index());
436 TileMap::iterator found = tiles_.find(key); 440 TileMap::iterator found = tiles_.find(key);
437 // If the tile was outside of the recorded region, it won't exist even 441 // If the tile was outside of the recorded region, it won't exist even
438 // though it was in the live rect. 442 // though it was in the live rect.
439 if (found == tiles_.end()) 443 if (found == tiles_.end())
440 continue; 444 continue;
445 client_->DestroyTile(found->second);
441 tiles_.erase(found); 446 tiles_.erase(found);
442 } 447 }
443 448
444 const PictureLayerTiling* twin_tiling = client_->GetTwinTiling(this); 449 const PictureLayerTiling* twin_tiling = client_->GetTwinTiling(this);
445 450
446 // Iterate to allocate new tiles for all regions with newly exposed area. 451 // Iterate to allocate new tiles for all regions with newly exposed area.
447 for (TilingData::DifferenceIterator iter(&tiling_data_, 452 for (TilingData::DifferenceIterator iter(&tiling_data_,
448 new_live_tiles_rect, 453 new_live_tiles_rect,
449 live_tiles_rect_); 454 live_tiles_rect_);
450 iter; 455 iter;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 616
612 // If our delta is less then our event distance, we're done. 617 // If our delta is less then our event distance, we're done.
613 if (delta < event.distance) 618 if (delta < event.distance)
614 break; 619 break;
615 } 620 }
616 621
617 return gfx::Rect(origin_x, origin_y, width, height); 622 return gfx::Rect(origin_x, origin_y, width, height);
618 } 623 }
619 624
620 } // namespace cc 625 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_layer_tiling.h ('k') | cc/test/fake_picture_layer_tiling_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698