Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/tiles/tile.h" | 5 #include "cc/tiles/tile.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/numerics/safe_conversions.h" | 9 #include "base/numerics/safe_conversions.h" |
| 10 #include "base/trace_event/trace_event_argument.h" | 10 #include "base/trace_event/trace_event_argument.h" |
| 11 #include "cc/base/math_util.h" | 11 #include "cc/base/math_util.h" |
| 12 #include "cc/debug/traced_value.h" | 12 #include "cc/debug/traced_value.h" |
| 13 #include "cc/tiles/tile_manager.h" | 13 #include "cc/tiles/tile_manager.h" |
| 14 | 14 |
| 15 namespace cc { | 15 namespace cc { |
| 16 | 16 |
| 17 Tile::Id Tile::s_next_id_ = 1; | 17 Tile::Id Tile::s_next_id_ = 1; |
| 18 | 18 |
| 19 Tile::Tile(TileManager* tile_manager, | 19 Tile::Tile(TileManager* tile_manager, |
| 20 const gfx::Size& desired_texture_size, | 20 const CreateInfo& info, |
|
vmpstr
2015/08/28 21:05:30
Also, why not just store the info?
danakj
2015/08/31 21:12:12
Well, that would add a lot of indirections/typing
vmpstr
2015/08/31 21:15:10
Makes sense.
| |
| 21 const gfx::Rect& content_rect, | |
| 22 float contents_scale, | |
| 23 int layer_id, | 21 int layer_id, |
| 24 int source_frame_number, | 22 int source_frame_number, |
| 25 int flags) | 23 int flags) |
| 26 : tile_manager_(tile_manager), | 24 : tile_manager_(tile_manager), |
| 27 desired_texture_size_(desired_texture_size), | 25 content_rect_(info.content_rect), |
| 28 content_rect_(content_rect), | 26 enclosing_layer_rect_(info.enclosing_layer_rect), |
| 29 contents_scale_(contents_scale), | 27 contents_scale_(info.contents_scale), |
| 30 layer_id_(layer_id), | 28 layer_id_(layer_id), |
| 31 source_frame_number_(source_frame_number), | 29 source_frame_number_(source_frame_number), |
| 32 flags_(flags), | 30 flags_(flags), |
| 33 tiling_i_index_(-1), | 31 tiling_i_index_(info.tiling_i_index), |
| 34 tiling_j_index_(-1), | 32 tiling_j_index_(info.tiling_j_index), |
| 35 required_for_activation_(false), | 33 required_for_activation_(false), |
| 36 required_for_draw_(false), | 34 required_for_draw_(false), |
| 37 id_(s_next_id_++), | 35 id_(s_next_id_++), |
| 38 invalidated_id_(0), | 36 invalidated_id_(0), |
| 39 scheduled_priority_(0) { | 37 scheduled_priority_(0) {} |
| 40 } | |
| 41 | 38 |
| 42 Tile::~Tile() { | 39 Tile::~Tile() { |
| 43 TRACE_EVENT_OBJECT_DELETED_WITH_ID( | 40 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
| 44 TRACE_DISABLED_BY_DEFAULT("cc.debug"), | 41 TRACE_DISABLED_BY_DEFAULT("cc.debug"), |
| 45 "cc::Tile", this); | 42 "cc::Tile", this); |
| 46 } | 43 } |
| 47 | 44 |
| 48 void Tile::AsValueInto(base::trace_event::TracedValue* value) const { | 45 void Tile::AsValueInto(base::trace_event::TracedValue* value) const { |
| 49 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( | 46 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( |
| 50 TRACE_DISABLED_BY_DEFAULT("cc.debug"), value, "cc::Tile", this); | 47 TRACE_DISABLED_BY_DEFAULT("cc.debug"), value, "cc::Tile", this); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 71 if (draw_info_.resource_) { | 68 if (draw_info_.resource_) { |
| 72 // We can use UncheckedSizeInBytes, since the tile size is determined by the | 69 // We can use UncheckedSizeInBytes, since the tile size is determined by the |
| 73 // compositor. | 70 // compositor. |
| 74 return ResourceUtil::UncheckedSizeInBytes<size_t>( | 71 return ResourceUtil::UncheckedSizeInBytes<size_t>( |
| 75 draw_info_.resource_->size(), draw_info_.resource_->format()); | 72 draw_info_.resource_->size(), draw_info_.resource_->format()); |
| 76 } | 73 } |
| 77 return 0; | 74 return 0; |
| 78 } | 75 } |
| 79 | 76 |
| 80 void Tile::Deleter::operator()(Tile* tile) const { | 77 void Tile::Deleter::operator()(Tile* tile) const { |
| 81 TileManager* tile_manager = tile->tile_manager_; | 78 tile->tile_manager_->Release(tile); |
| 82 tile_manager->Release(tile); | |
| 83 } | 79 } |
| 84 | 80 |
| 85 } // namespace cc | 81 } // namespace cc |
| OLD | NEW |