OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CCOverdrawMetrics_h | 5 #ifndef CCOverdrawMetrics_h |
6 #define CCOverdrawMetrics_h | 6 #define CCOverdrawMetrics_h |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 | 9 |
| 10 namespace gfx { |
| 11 class Rect; |
| 12 } |
| 13 |
10 namespace WebKit { | 14 namespace WebKit { |
11 class WebTransformationMatrix; | 15 class WebTransformationMatrix; |
12 } | 16 } |
13 | 17 |
14 namespace cc { | 18 namespace cc { |
15 class IntRect; | |
16 class LayerTreeHost; | 19 class LayerTreeHost; |
17 class LayerTreeHostImpl; | 20 class LayerTreeHostImpl; |
18 | 21 |
19 // FIXME: compute overdraw metrics only occasionally, not every frame. | 22 // FIXME: compute overdraw metrics only occasionally, not every frame. |
20 class OverdrawMetrics { | 23 class OverdrawMetrics { |
21 public: | 24 public: |
22 static scoped_ptr<OverdrawMetrics> create(bool recordMetricsForFrame) { retu
rn make_scoped_ptr(new OverdrawMetrics(recordMetricsForFrame)); } | 25 static scoped_ptr<OverdrawMetrics> create(bool recordMetricsForFrame) { retu
rn make_scoped_ptr(new OverdrawMetrics(recordMetricsForFrame)); } |
23 | 26 |
24 // These methods are used for saving metrics during update/commit. | 27 // These methods are used for saving metrics during update/commit. |
25 | 28 |
26 // Record pixels painted by WebKit into the texture updater, but does not me
an the pixels were rasterized in main memory. | 29 // Record pixels painted by WebKit into the texture updater, but does not me
an the pixels were rasterized in main memory. |
27 void didPaint(const IntRect& paintedRect); | 30 void didPaint(const gfx::Rect& paintedRect); |
28 // Records that an invalid tile was culled and did not need to be painted/up
loaded, and did not contribute to other tiles needing to be painted. | 31 // Records that an invalid tile was culled and did not need to be painted/up
loaded, and did not contribute to other tiles needing to be painted. |
29 void didCullTilesForUpload(int count); | 32 void didCullTilesForUpload(int count); |
30 // Records pixels that were uploaded to texture memory. | 33 // Records pixels that were uploaded to texture memory. |
31 void didUpload(const WebKit::WebTransformationMatrix& transformToTarget, con
st IntRect& uploadRect, const IntRect& opaqueRect); | 34 void didUpload(const WebKit::WebTransformationMatrix& transformToTarget, con
st gfx::Rect& uploadRect, const gfx::Rect& opaqueRect); |
32 // Record contents texture(s) behind present using the given number of bytes
. | 35 // Record contents texture(s) behind present using the given number of bytes
. |
33 void didUseContentsTextureMemoryBytes(size_t contentsTextureUseBytes); | 36 void didUseContentsTextureMemoryBytes(size_t contentsTextureUseBytes); |
34 // Record RenderSurfaceImpl texture(s) being present using the given number
of bytes. | 37 // Record RenderSurfaceImpl texture(s) being present using the given number
of bytes. |
35 void didUseRenderSurfaceTextureMemoryBytes(size_t renderSurfaceUseBytes); | 38 void didUseRenderSurfaceTextureMemoryBytes(size_t renderSurfaceUseBytes); |
36 | 39 |
37 // These methods are used for saving metrics during draw. | 40 // These methods are used for saving metrics during draw. |
38 | 41 |
39 // Record pixels that were not drawn to screen. | 42 // Record pixels that were not drawn to screen. |
40 void didCullForDrawing(const WebKit::WebTransformationMatrix& transformToTar
get, const IntRect& beforeCullRect, const IntRect& afterCullRect); | 43 void didCullForDrawing(const WebKit::WebTransformationMatrix& transformToTar
get, const gfx::Rect& beforeCullRect, const gfx::Rect& afterCullRect); |
41 // Record pixels that were drawn to screen. | 44 // Record pixels that were drawn to screen. |
42 void didDraw(const WebKit::WebTransformationMatrix& transformToTarget, const
IntRect& afterCullRect, const IntRect& opaqueRect); | 45 void didDraw(const WebKit::WebTransformationMatrix& transformToTarget, const
gfx::Rect& afterCullRect, const gfx::Rect& opaqueRect); |
43 | 46 |
44 void recordMetrics(const LayerTreeHost*) const; | 47 void recordMetrics(const LayerTreeHost*) const; |
45 void recordMetrics(const LayerTreeHostImpl*) const; | 48 void recordMetrics(const LayerTreeHostImpl*) const; |
46 | 49 |
47 // Accessors for tests. | 50 // Accessors for tests. |
48 float pixelsDrawnOpaque() const { return m_pixelsDrawnOpaque; } | 51 float pixelsDrawnOpaque() const { return m_pixelsDrawnOpaque; } |
49 float pixelsDrawnTranslucent() const { return m_pixelsDrawnTranslucent; } | 52 float pixelsDrawnTranslucent() const { return m_pixelsDrawnTranslucent; } |
50 float pixelsCulledForDrawing() const { return m_pixelsCulledForDrawing; } | 53 float pixelsCulledForDrawing() const { return m_pixelsCulledForDrawing; } |
51 float pixelsPainted() const { return m_pixelsPainted; } | 54 float pixelsPainted() const { return m_pixelsPainted; } |
52 float pixelsUploadedOpaque() const { return m_pixelsUploadedOpaque; } | 55 float pixelsUploadedOpaque() const { return m_pixelsUploadedOpaque; } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 float m_pixelsDrawnOpaque; | 91 float m_pixelsDrawnOpaque; |
89 // Count of pixels that are possibly translucent, and cannot occlude. | 92 // Count of pixels that are possibly translucent, and cannot occlude. |
90 float m_pixelsDrawnTranslucent; | 93 float m_pixelsDrawnTranslucent; |
91 // Count of pixels not drawn as they are occluded by somthing opaque. | 94 // Count of pixels not drawn as they are occluded by somthing opaque. |
92 float m_pixelsCulledForDrawing; | 95 float m_pixelsCulledForDrawing; |
93 }; | 96 }; |
94 | 97 |
95 } // namespace cc | 98 } // namespace cc |
96 | 99 |
97 #endif | 100 #endif |
OLD | NEW |