cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / cc / base / invalidation_region.cc
blob2c39d25ba06f495f6258b52f736fd377b0986a9c
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"
9 namespace {
11 const int kMaxInvalidationRectCount = 256;
13 } // namespace
15 namespace cc {
17 InvalidationRegion::InvalidationRegion() {}
19 InvalidationRegion::~InvalidationRegion() {}
21 void InvalidationRegion::Swap(Region* region) {
22 UMA_HISTOGRAM_CUSTOM_COUNTS(
23 "Renderer4.InvalidationRegionApproximateRectCount",
24 region_.GetRegionComplexity(),
26 5000,
27 50);
29 SimplifyIfNeeded();
30 region_.Swap(region);
33 void InvalidationRegion::Clear() {
34 region_.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).
40 region_.Union(rect);
43 void InvalidationRegion::SimplifyIfNeeded() {
44 if (region_.GetRegionComplexity() > kMaxInvalidationRectCount)
45 region_ = region_.bounds();
48 } // namespace cc