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

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

Issue 421183003: Revert of Add builders for tracing event's structural arguments (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « cc/resources/picture_pile_base.h ('k') | cc/resources/pixel_buffer_raster_worker_pool.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 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/trace_event_argument.h"
12 #include "base/logging.h" 11 #include "base/logging.h"
13 #include "base/values.h" 12 #include "base/values.h"
14 #include "cc/base/math_util.h" 13 #include "cc/base/math_util.h"
15 #include "cc/debug/traced_value.h" 14 #include "cc/debug/traced_value.h"
16 #include "third_party/skia/include/core/SkColor.h" 15 #include "third_party/skia/include/core/SkColor.h"
17 #include "ui/gfx/rect_conversions.h" 16 #include "ui/gfx/rect_conversions.h"
18 17
19 namespace { 18 namespace {
20 // 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
21 // the base picture in each tile. 20 // the base picture in each tile.
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 return PadRect(tile); 191 return PadRect(tile);
193 } 192 }
194 193
195 gfx::Rect PicturePileBase::PadRect(const gfx::Rect& rect) { 194 gfx::Rect PicturePileBase::PadRect(const gfx::Rect& rect) {
196 gfx::Rect padded_rect = rect; 195 gfx::Rect padded_rect = rect;
197 padded_rect.Inset( 196 padded_rect.Inset(
198 -buffer_pixels(), -buffer_pixels(), -buffer_pixels(), -buffer_pixels()); 197 -buffer_pixels(), -buffer_pixels(), -buffer_pixels(), -buffer_pixels());
199 return padded_rect; 198 return padded_rect;
200 } 199 }
201 200
202 void PicturePileBase::AsValueInto(base::debug::TracedValue* pictures) const { 201 scoped_ptr<base::Value> PicturePileBase::AsValue() const {
202 scoped_ptr<base::ListValue> pictures(new base::ListValue());
203 gfx::Rect tiling_rect(tiling_.tiling_size()); 203 gfx::Rect tiling_rect(tiling_.tiling_size());
204 std::set<void*> appended_pictures; 204 std::set<void*> appended_pictures;
205 bool include_borders = true; 205 bool include_borders = true;
206 for (TilingData::Iterator tile_iter(&tiling_, tiling_rect, include_borders); 206 for (TilingData::Iterator tile_iter(&tiling_, tiling_rect, include_borders);
207 tile_iter; 207 tile_iter;
208 ++tile_iter) { 208 ++tile_iter) {
209 PictureMap::const_iterator map_iter = picture_map_.find(tile_iter.index()); 209 PictureMap::const_iterator map_iter = picture_map_.find(tile_iter.index());
210 if (map_iter == picture_map_.end()) 210 if (map_iter == picture_map_.end())
211 continue; 211 continue;
212 212
213 Picture* picture = map_iter->second.GetPicture(); 213 Picture* picture = map_iter->second.GetPicture();
214 if (picture && (appended_pictures.count(picture) == 0)) { 214 if (picture && (appended_pictures.count(picture) == 0)) {
215 appended_pictures.insert(picture); 215 appended_pictures.insert(picture);
216 TracedValue::AppendIDRef(picture, pictures); 216 pictures->Append(TracedValue::CreateIDRef(picture).release());
217 } 217 }
218 } 218 }
219 return pictures.PassAs<base::Value>();
219 } 220 }
220 221
221 PicturePileBase::PictureInfo::PictureInfo() : last_frame_number_(0) {} 222 PicturePileBase::PictureInfo::PictureInfo() : last_frame_number_(0) {}
222 223
223 PicturePileBase::PictureInfo::~PictureInfo() {} 224 PicturePileBase::PictureInfo::~PictureInfo() {}
224 225
225 void PicturePileBase::PictureInfo::AdvanceInvalidationHistory( 226 void PicturePileBase::PictureInfo::AdvanceInvalidationHistory(
226 int frame_number) { 227 int frame_number) {
227 DCHECK_GE(frame_number, last_frame_number_); 228 DCHECK_GE(frame_number, last_frame_number_);
228 if (frame_number == last_frame_number_) 229 if (frame_number == last_frame_number_)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 info.picture_ = picture_->GetCloneForDrawingOnThread(thread_index); 270 info.picture_ = picture_->GetCloneForDrawingOnThread(thread_index);
270 return info; 271 return info;
271 } 272 }
272 273
273 float PicturePileBase::PictureInfo::GetInvalidationFrequency() const { 274 float PicturePileBase::PictureInfo::GetInvalidationFrequency() const {
274 return invalidation_history_.count() / 275 return invalidation_history_.count() /
275 static_cast<float>(INVALIDATION_FRAMES_TRACKED); 276 static_cast<float>(INVALIDATION_FRAMES_TRACKED);
276 } 277 }
277 278
278 } // namespace cc 279 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_pile_base.h ('k') | cc/resources/pixel_buffer_raster_worker_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698