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
3 // found in the LICENSE file.
5 #include "cc/base/invalidation_region.h"
7 #include "base/metrics/histogram.h"
11 const int kMaxInvalidationRectCount
= 256;
17 InvalidationRegion::InvalidationRegion() {}
19 InvalidationRegion::~InvalidationRegion() {}
21 void InvalidationRegion::Swap(Region
* region
) {
22 UMA_HISTOGRAM_CUSTOM_COUNTS(
23 "Renderer4.InvalidationRegionApproximateRectCount",
24 region_
.GetRegionComplexity(),
33 void InvalidationRegion::Clear() {
37 void InvalidationRegion::Union(gfx::Rect rect
) {
38 // TODO(vmpstr): We should simplify the region after Union() after we get a
39 // good idea of what kind of regions are typical (from the UMA histogram).
43 void InvalidationRegion::SimplifyIfNeeded() {
44 if (region_
.GetRegionComplexity() > kMaxInvalidationRectCount
)
45 region_
= region_
.bounds();