Don't consider a Bluetooth adapter present until it has an address.
[chromium-blink-merge.git] / cc / CCDebugRectHistory.h
blobaf542ad6d1e33d08ef5d09cbeedbb276b6c8cb20
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
3 // found in the LICENSE file.
5 #ifndef CCDebugRectHistory_h
6 #define CCDebugRectHistory_h
8 #if USE(ACCELERATED_COMPOSITING)
10 #include "FloatRect.h"
11 #include "IntRect.h"
12 #include <wtf/Noncopyable.h>
13 #include <wtf/PassOwnPtr.h>
14 #include <wtf/Vector.h>
16 namespace WebCore {
18 class CCLayerImpl;
19 struct CCLayerTreeSettings;
21 // There are currently six types of debug rects:
23 // - Paint rects (update rects): regions of a layer that needed to be re-uploaded to the
24 // texture resource; in most cases implying that WebCore had to repaint them, too.
26 // - Property-changed rects: enclosing bounds of layers that cause changes to the screen
27 // even if the layer did not change internally. (For example, if the layer's opacity or
28 // position changes.)
30 // - Surface damage rects: the aggregate damage on a target surface that is caused by all
31 // layers and surfaces that contribute to it. This includes (1) paint rects, (2) property-
32 // changed rects, and (3) newly exposed areas.
34 // - Screen space rects: this is the region the contents occupy in screen space.
36 // - Replica screen space rects: this is the region the replica's contents occupy in screen space.
38 // - Occluding rects: these are the regions that contribute to the occluded region.
40 enum DebugRectType { PaintRectType, PropertyChangedRectType, SurfaceDamageRectType, ScreenSpaceRectType, ReplicaScreenSpaceRectType, OccludingRectType };
42 struct CCDebugRect {
43 CCDebugRect(DebugRectType newType, FloatRect newRect)
44 : type(newType)
45 , rect(newRect) { }
47 DebugRectType type;
48 FloatRect rect;
51 // This class maintains a history of rects of various types that can be used
52 // for debugging purposes. The overhead of collecting rects is performed only if
53 // the appropriate CCLayerTreeSettings are enabled.
54 class CCDebugRectHistory {
55 WTF_MAKE_NONCOPYABLE(CCDebugRectHistory);
56 public:
57 static PassOwnPtr<CCDebugRectHistory> create()
59 return adoptPtr(new CCDebugRectHistory());
62 // Note: Saving debug rects must happen before layers' change tracking is reset.
63 void saveDebugRectsForCurrentFrame(CCLayerImpl* rootLayer, const Vector<CCLayerImpl*>& renderSurfaceLayerList, const Vector<IntRect>& occludingScreenSpaceRects, const CCLayerTreeSettings&);
65 const Vector<CCDebugRect>& debugRects() { return m_debugRects; }
67 private:
68 CCDebugRectHistory();
70 void savePaintRects(CCLayerImpl*);
71 void savePropertyChangedRects(const Vector<CCLayerImpl*>& renderSurfaceLayerList);
72 void saveSurfaceDamageRects(const Vector<CCLayerImpl* >& renderSurfaceLayerList);
73 void saveScreenSpaceRects(const Vector<CCLayerImpl* >& renderSurfaceLayerList);
74 void saveOccludingRects(const Vector<IntRect>& occludingScreenSpaceRects);
76 Vector<CCDebugRect> m_debugRects;
79 } // namespace WebCore
81 #endif // USE(ACCELERATED_COMPOSITING)
83 #endif