| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_pile_base.h" | 5 #include "cc/resources/picture_pile_base.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/debug/traced_value.h" |
| 11 #include "base/logging.h" | 12 #include "base/logging.h" |
| 12 #include "base/values.h" | 13 #include "base/values.h" |
| 13 #include "cc/base/math_util.h" | 14 #include "cc/base/math_util.h" |
| 14 #include "cc/debug/traced_value.h" | |
| 15 #include "third_party/skia/include/core/SkColor.h" | 15 #include "third_party/skia/include/core/SkColor.h" |
| 16 #include "ui/gfx/rect_conversions.h" | 16 #include "ui/gfx/rect_conversions.h" |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 // Dimensions of the tiles in this picture pile as well as the dimensions of | 19 // Dimensions of the tiles in this picture pile as well as the dimensions of |
| 20 // the base picture in each tile. | 20 // the base picture in each tile. |
| 21 const int kBasePictureSize = 512; | 21 const int kBasePictureSize = 512; |
| 22 const int kTileGridBorderPixels = 1; | 22 const int kTileGridBorderPixels = 1; |
| 23 #ifdef NDEBUG | 23 #ifdef NDEBUG |
| 24 const bool kDefaultClearCanvasSetting = false; | 24 const bool kDefaultClearCanvasSetting = false; |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 for (TilingData::Iterator tile_iter(&tiling_, tiling_rect, include_borders); | 244 for (TilingData::Iterator tile_iter(&tiling_, tiling_rect, include_borders); |
| 245 tile_iter; | 245 tile_iter; |
| 246 ++tile_iter) { | 246 ++tile_iter) { |
| 247 PictureMap::const_iterator map_iter = picture_map_.find(tile_iter.index()); | 247 PictureMap::const_iterator map_iter = picture_map_.find(tile_iter.index()); |
| 248 if (map_iter == picture_map_.end()) | 248 if (map_iter == picture_map_.end()) |
| 249 continue; | 249 continue; |
| 250 | 250 |
| 251 Picture* picture = map_iter->second.GetPicture(); | 251 Picture* picture = map_iter->second.GetPicture(); |
| 252 if (picture && (appended_pictures.count(picture) == 0)) { | 252 if (picture && (appended_pictures.count(picture) == 0)) { |
| 253 appended_pictures.insert(picture); | 253 appended_pictures.insert(picture); |
| 254 pictures->Append(TracedValue::CreateIDRef(picture).release()); | 254 pictures->Append( |
| 255 base::debug::TracedValue::CreateIDRef(picture).release()); |
| 255 } | 256 } |
| 256 } | 257 } |
| 257 return pictures.PassAs<base::Value>(); | 258 return pictures.PassAs<base::Value>(); |
| 258 } | 259 } |
| 259 | 260 |
| 260 PicturePileBase::PictureInfo::PictureInfo() : last_frame_number_(0) {} | 261 PicturePileBase::PictureInfo::PictureInfo() : last_frame_number_(0) {} |
| 261 | 262 |
| 262 PicturePileBase::PictureInfo::~PictureInfo() {} | 263 PicturePileBase::PictureInfo::~PictureInfo() {} |
| 263 | 264 |
| 264 void PicturePileBase::PictureInfo::AdvanceInvalidationHistory( | 265 void PicturePileBase::PictureInfo::AdvanceInvalidationHistory( |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 info.picture_ = picture_->GetCloneForDrawingOnThread(thread_index); | 309 info.picture_ = picture_->GetCloneForDrawingOnThread(thread_index); |
| 309 return info; | 310 return info; |
| 310 } | 311 } |
| 311 | 312 |
| 312 float PicturePileBase::PictureInfo::GetInvalidationFrequency() const { | 313 float PicturePileBase::PictureInfo::GetInvalidationFrequency() const { |
| 313 return invalidation_history_.count() / | 314 return invalidation_history_.count() / |
| 314 static_cast<float>(INVALIDATION_FRAMES_TRACKED); | 315 static_cast<float>(INVALIDATION_FRAMES_TRACKED); |
| 315 } | 316 } |
| 316 | 317 |
| 317 } // namespace cc | 318 } // namespace cc |
| OLD | NEW |