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/resources/tile.h" | 5 #include "cc/resources/tile.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/debug/trace_event_argument.h" | 9 #include "base/debug/trace_event_argument.h" |
10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
11 #include "cc/debug/traced_value.h" | 11 #include "cc/debug/traced_value.h" |
12 #include "cc/resources/tile_manager.h" | 12 #include "cc/resources/tile_manager.h" |
13 #include "third_party/khronos/GLES2/gl2.h" | 13 #include "third_party/khronos/GLES2/gl2.h" |
14 | 14 |
15 namespace cc { | 15 namespace cc { |
16 | 16 |
17 Tile::Id Tile::s_next_id_ = 0; | 17 Tile::Id Tile::s_next_id_ = 0; |
18 | 18 |
19 Tile::Tile(TileManager* tile_manager, | 19 Tile::Tile(TileManager* tile_manager, |
20 RasterSource* raster_source, | 20 RasterSource* raster_source, |
21 const gfx::Size& tile_size, | 21 const gfx::Size& tile_size, |
22 const gfx::Rect& content_rect, | 22 const gfx::Rect& content_rect, |
23 float contents_scale, | 23 float contents_scale, |
24 int layer_id, | 24 int layer_id, |
25 int source_frame_number, | 25 int source_frame_number, |
26 int flags) | 26 int flags) |
27 : RefCountedManaged<Tile>(tile_manager), | 27 : RefCountedManaged<Tile>(tile_manager), |
28 tile_manager_(tile_manager), | |
29 size_(tile_size), | 28 size_(tile_size), |
30 content_rect_(content_rect), | 29 content_rect_(content_rect), |
31 contents_scale_(contents_scale), | 30 contents_scale_(contents_scale), |
32 layer_id_(layer_id), | 31 layer_id_(layer_id), |
33 source_frame_number_(source_frame_number), | 32 source_frame_number_(source_frame_number), |
34 flags_(flags), | 33 flags_(flags), |
35 is_shared_(false), | |
36 tiling_i_index_(-1), | 34 tiling_i_index_(-1), |
37 tiling_j_index_(-1), | 35 tiling_j_index_(-1), |
| 36 is_shared_(false), |
38 required_for_activation_(false), | 37 required_for_activation_(false), |
39 required_for_draw_(false), | 38 required_for_draw_(false), |
40 id_(s_next_id_++), | 39 id_(s_next_id_++), |
41 scheduled_priority_(0) { | 40 scheduled_priority_(0) { |
42 set_raster_source(raster_source); | 41 set_raster_source(raster_source); |
43 for (int i = 0; i < NUM_TREES; i++) | 42 for (int i = 0; i < NUM_TREES; i++) |
44 is_occluded_[i] = false; | 43 is_occluded_[i] = false; |
45 } | 44 } |
46 | 45 |
47 Tile::~Tile() { | 46 Tile::~Tile() { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 res->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes()); | 85 res->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes()); |
87 } | 86 } |
88 | 87 |
89 size_t Tile::GPUMemoryUsageInBytes() const { | 88 size_t Tile::GPUMemoryUsageInBytes() const { |
90 if (draw_info_.resource_) | 89 if (draw_info_.resource_) |
91 return draw_info_.resource_->bytes(); | 90 return draw_info_.resource_->bytes(); |
92 return 0; | 91 return 0; |
93 } | 92 } |
94 | 93 |
95 } // namespace cc | 94 } // namespace cc |
OLD | NEW |