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_manager.h" | 5 #include "cc/tiles/tile_manager.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
7 #include <algorithm> | 10 #include <algorithm> |
8 #include <limits> | 11 #include <limits> |
9 #include <string> | 12 #include <string> |
10 | 13 |
11 #include "base/bind.h" | 14 #include "base/bind.h" |
12 #include "base/json/json_writer.h" | 15 #include "base/json/json_writer.h" |
13 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/macros.h" |
14 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
15 #include "base/numerics/safe_conversions.h" | 19 #include "base/numerics/safe_conversions.h" |
16 #include "base/trace_event/trace_event_argument.h" | 20 #include "base/trace_event/trace_event_argument.h" |
17 #include "cc/base/histograms.h" | 21 #include "cc/base/histograms.h" |
18 #include "cc/debug/devtools_instrumentation.h" | 22 #include "cc/debug/devtools_instrumentation.h" |
19 #include "cc/debug/frame_viewer_instrumentation.h" | 23 #include "cc/debug/frame_viewer_instrumentation.h" |
20 #include "cc/debug/traced_value.h" | 24 #include "cc/debug/traced_value.h" |
21 #include "cc/layers/picture_layer_impl.h" | 25 #include "cc/layers/picture_layer_impl.h" |
22 #include "cc/raster/raster_buffer.h" | 26 #include "cc/raster/raster_buffer.h" |
23 #include "cc/raster/tile_task_runner.h" | 27 #include "cc/raster/tile_task_runner.h" |
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 return make_scoped_refptr(new TaskSetFinishedTaskImpl( | 1099 return make_scoped_refptr(new TaskSetFinishedTaskImpl( |
1096 task_runner_.get(), | 1100 task_runner_.get(), |
1097 base::Bind(callback, task_set_finished_weak_ptr_factory_.GetWeakPtr()))); | 1101 base::Bind(callback, task_set_finished_weak_ptr_factory_.GetWeakPtr()))); |
1098 } | 1102 } |
1099 | 1103 |
1100 TileManager::MemoryUsage::MemoryUsage() | 1104 TileManager::MemoryUsage::MemoryUsage() |
1101 : memory_bytes_(0), resource_count_(0) {} | 1105 : memory_bytes_(0), resource_count_(0) {} |
1102 | 1106 |
1103 TileManager::MemoryUsage::MemoryUsage(size_t memory_bytes, | 1107 TileManager::MemoryUsage::MemoryUsage(size_t memory_bytes, |
1104 size_t resource_count) | 1108 size_t resource_count) |
1105 : memory_bytes_(static_cast<int64>(memory_bytes)), | 1109 : memory_bytes_(static_cast<int64_t>(memory_bytes)), |
1106 resource_count_(static_cast<int>(resource_count)) { | 1110 resource_count_(static_cast<int>(resource_count)) { |
1107 // MemoryUsage is constructed using size_ts, since it deals with memory and | 1111 // MemoryUsage is constructed using size_ts, since it deals with memory and |
1108 // the inputs are typically size_t. However, during the course of usage (in | 1112 // the inputs are typically size_t. However, during the course of usage (in |
1109 // particular operator-=) can cause internal values to become negative. Thus, | 1113 // particular operator-=) can cause internal values to become negative. Thus, |
1110 // member variables are signed. | 1114 // member variables are signed. |
1111 DCHECK_LE(memory_bytes, | 1115 DCHECK_LE(memory_bytes, |
1112 static_cast<size_t>(std::numeric_limits<int64>::max())); | 1116 static_cast<size_t>(std::numeric_limits<int64_t>::max())); |
1113 DCHECK_LE(resource_count, | 1117 DCHECK_LE(resource_count, |
1114 static_cast<size_t>(std::numeric_limits<int>::max())); | 1118 static_cast<size_t>(std::numeric_limits<int>::max())); |
1115 } | 1119 } |
1116 | 1120 |
1117 // static | 1121 // static |
1118 TileManager::MemoryUsage TileManager::MemoryUsage::FromConfig( | 1122 TileManager::MemoryUsage TileManager::MemoryUsage::FromConfig( |
1119 const gfx::Size& size, | 1123 const gfx::Size& size, |
1120 ResourceFormat format) { | 1124 ResourceFormat format) { |
1121 // We can use UncheckedSizeInBytes here since this is used with a tile | 1125 // We can use UncheckedSizeInBytes here since this is used with a tile |
1122 // size which is determined by the compositor (it's at most max texture size). | 1126 // size which is determined by the compositor (it's at most max texture size). |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 void TileManager::Signals::reset() { | 1171 void TileManager::Signals::reset() { |
1168 ready_to_activate = false; | 1172 ready_to_activate = false; |
1169 did_notify_ready_to_activate = false; | 1173 did_notify_ready_to_activate = false; |
1170 ready_to_draw = false; | 1174 ready_to_draw = false; |
1171 did_notify_ready_to_draw = false; | 1175 did_notify_ready_to_draw = false; |
1172 all_tile_tasks_completed = false; | 1176 all_tile_tasks_completed = false; |
1173 did_notify_all_tile_tasks_completed = false; | 1177 did_notify_all_tile_tasks_completed = false; |
1174 } | 1178 } |
1175 | 1179 |
1176 } // namespace cc | 1180 } // namespace cc |
OLD | NEW |