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

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

Issue 18581004: cc: Remove tile ref counting in tile manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ut compile fix 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/resources/tile.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.get());
54 } 52 }
55 53
56 void PictureLayerTiling::SetClient(PictureLayerTilingClient* client) { 54 void PictureLayerTiling::SetClient(PictureLayerTilingClient* client) {
57 client_ = client; 55 client_ = client;
58 } 56 }
59 57
60 gfx::Rect PictureLayerTiling::ContentRect() const { 58 gfx::Rect PictureLayerTiling::ContentRect() const {
61 return gfx::Rect(tiling_data_.total_size()); 59 return gfx::Rect(tiling_data_.total_size());
62 } 60 }
63 61
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 328
331 return texture_rect; 329 return texture_rect;
332 } 330 }
333 331
334 gfx::Size PictureLayerTiling::CoverageIterator::texture_size() const { 332 gfx::Size PictureLayerTiling::CoverageIterator::texture_size() const {
335 return tiling_->tiling_data_.max_texture_size(); 333 return tiling_->tiling_data_.max_texture_size();
336 } 334 }
337 335
338 void PictureLayerTiling::Reset() { 336 void PictureLayerTiling::Reset() {
339 live_tiles_rect_ = gfx::Rect(); 337 live_tiles_rect_ = gfx::Rect();
340 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it)
341 client_->DestroyTile(it->second.get());
342 tiles_.clear(); 338 tiles_.clear();
343 } 339 }
344 340
345 void PictureLayerTiling::UpdateTilePriorities( 341 void PictureLayerTiling::UpdateTilePriorities(
346 WhichTree tree, 342 WhichTree tree,
347 gfx::Size device_viewport, 343 gfx::Size device_viewport,
348 gfx::Rect viewport_in_layer_space, 344 gfx::Rect viewport_in_layer_space,
349 gfx::Rect visible_layer_rect, 345 gfx::Rect visible_layer_rect,
350 gfx::Size last_layer_bounds, 346 gfx::Size last_layer_bounds,
351 gfx::Size current_layer_bounds, 347 gfx::Size current_layer_bounds,
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 // Iterate to delete all tiles outside of our new live_tiles rect. 497 // Iterate to delete all tiles outside of our new live_tiles rect.
502 for (TilingData::DifferenceIterator iter(&tiling_data_, 498 for (TilingData::DifferenceIterator iter(&tiling_data_,
503 live_tiles_rect_, 499 live_tiles_rect_,
504 new_live_tiles_rect); 500 new_live_tiles_rect);
505 iter; 501 iter;
506 ++iter) { 502 ++iter) {
507 TileMapKey key(iter.index()); 503 TileMapKey key(iter.index());
508 TileMap::iterator found = tiles_.find(key); 504 TileMap::iterator found = tiles_.find(key);
509 // If the tile was outside of the recorded region, it won't exist even 505 // If the tile was outside of the recorded region, it won't exist even
510 // though it was in the live rect. 506 // though it was in the live rect.
511 if (found == tiles_.end()) 507 if (found != tiles_.end())
512 continue; 508 tiles_.erase(found);
513 client_->DestroyTile(found->second.get());
514 tiles_.erase(found);
515 } 509 }
516 510
517 const PictureLayerTiling* twin_tiling = client_->GetTwinTiling(this); 511 const PictureLayerTiling* twin_tiling = client_->GetTwinTiling(this);
518 512
519 // Iterate to allocate new tiles for all regions with newly exposed area. 513 // Iterate to allocate new tiles for all regions with newly exposed area.
520 for (TilingData::DifferenceIterator iter(&tiling_data_, 514 for (TilingData::DifferenceIterator iter(&tiling_data_,
521 new_live_tiles_rect, 515 new_live_tiles_rect,
522 live_tiles_rect_); 516 live_tiles_rect_);
523 iter; 517 iter;
524 ++iter) { 518 ++iter) {
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 681
688 // If our delta is less then our event distance, we're done. 682 // If our delta is less then our event distance, we're done.
689 if (delta < event.distance) 683 if (delta < event.distance)
690 break; 684 break;
691 } 685 }
692 686
693 return gfx::Rect(origin_x, origin_y, width, height); 687 return gfx::Rect(origin_x, origin_y, width, height);
694 } 688 }
695 689
696 } // namespace cc 690 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_layer_tiling.h ('k') | cc/resources/tile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698