| 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 CC_DEBUG_OVERDRAW_METRICS_H_ | 5 #ifndef CC_DEBUG_OVERDRAW_METRICS_H_ |
| 6 #define CC_DEBUG_OVERDRAW_METRICS_H_ | 6 #define CC_DEBUG_OVERDRAW_METRICS_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 | 10 |
| 11 namespace gfx { | 11 namespace gfx { |
| 12 class Rect; | 12 class Rect; |
| 13 class Transform; | 13 class Transform; |
| 14 } | 14 } |
| 15 | 15 |
| 16 namespace cc { | 16 namespace cc { |
| 17 class LayerTreeHost; | 17 class LayerTreeHost; |
| 18 class LayerTreeHostImpl; | 18 class LayerTreeHostImpl; |
| 19 | 19 |
| 20 class OverdrawMetrics { | 20 class OverdrawMetrics { |
| 21 public: | 21 public: |
| 22 static scoped_ptr<OverdrawMetrics> Create(bool record_metrics_for_frame) { | 22 static scoped_ptr<OverdrawMetrics> Create(bool record_metrics_for_frame) { |
| 23 return make_scoped_ptr(new OverdrawMetrics(record_metrics_for_frame)); | 23 return make_scoped_ptr(new OverdrawMetrics(record_metrics_for_frame)); |
| 24 } | 24 } |
| 25 | 25 |
| 26 // These methods are used for saving metrics during update/commit. | 26 // These methods are used for saving metrics during update/commit. |
| 27 | 27 |
| 28 // Record pixels painted by WebKit into the texture updater, but does not mean | 28 // Record pixels painted by WebKit into the texture updater, but does not mean |
| 29 // the pixels were rasterized in main memory. | 29 // the pixels were rasterized in main memory. |
| 30 void DidPaint(gfx::Rect painted_rect); | 30 void DidPaint(const gfx::Rect& painted_rect); |
| 31 // Records that an invalid tile was culled and did not need to be | 31 // Records that an invalid tile was culled and did not need to be |
| 32 // painted/uploaded, and did not contribute to other tiles needing to be | 32 // painted/uploaded, and did not contribute to other tiles needing to be |
| 33 // painted. | 33 // painted. |
| 34 void DidCullTilesForUpload(int count); | 34 void DidCullTilesForUpload(int count); |
| 35 // Records pixels that were uploaded to texture memory. | 35 // Records pixels that were uploaded to texture memory. |
| 36 void DidUpload(const gfx::Transform& transform_to_target, | 36 void DidUpload(const gfx::Transform& transform_to_target, |
| 37 gfx::Rect upload_rect, | 37 const gfx::Rect& upload_rect, |
| 38 gfx::Rect opaque_rect); | 38 const gfx::Rect& opaque_rect); |
| 39 // Record contents texture(s) behind present using the given number of bytes. | 39 // Record contents texture(s) behind present using the given number of bytes. |
| 40 void DidUseContentsTextureMemoryBytes(size_t contents_texture_use_bytes); | 40 void DidUseContentsTextureMemoryBytes(size_t contents_texture_use_bytes); |
| 41 // Record RenderSurfaceImpl texture(s) being present using the given number of | 41 // Record RenderSurfaceImpl texture(s) being present using the given number of |
| 42 // bytes. | 42 // bytes. |
| 43 void DidUseRenderSurfaceTextureMemoryBytes(size_t render_surface_use_bytes); | 43 void DidUseRenderSurfaceTextureMemoryBytes(size_t render_surface_use_bytes); |
| 44 | 44 |
| 45 // These methods are used for saving metrics during draw. | 45 // These methods are used for saving metrics during draw. |
| 46 | 46 |
| 47 // Record pixels that were not drawn to screen. | 47 // Record pixels that were not drawn to screen. |
| 48 void DidCullForDrawing(const gfx::Transform& transform_to_target, | 48 void DidCullForDrawing(const gfx::Transform& transform_to_target, |
| 49 gfx::Rect before_cull_rect, | 49 const gfx::Rect& before_cull_rect, |
| 50 gfx::Rect after_cull_rect); | 50 const gfx::Rect& after_cull_rect); |
| 51 // Record pixels that were drawn to screen. | 51 // Record pixels that were drawn to screen. |
| 52 void DidDraw(const gfx::Transform& transform_to_target, | 52 void DidDraw(const gfx::Transform& transform_to_target, |
| 53 gfx::Rect after_cull_rect, | 53 const gfx::Rect& after_cull_rect, |
| 54 gfx::Rect opaque_rect); | 54 const gfx::Rect& opaque_rect); |
| 55 | 55 |
| 56 void RecordMetrics(const LayerTreeHost* layer_tree_host) const; | 56 void RecordMetrics(const LayerTreeHost* layer_tree_host) const; |
| 57 void RecordMetrics(const LayerTreeHostImpl* layer_tree_host_impl) const; | 57 void RecordMetrics(const LayerTreeHostImpl* layer_tree_host_impl) const; |
| 58 | 58 |
| 59 // Accessors for tests. | 59 // Accessors for tests. |
| 60 float pixels_drawn_opaque() const { return pixels_drawn_opaque_; } | 60 float pixels_drawn_opaque() const { return pixels_drawn_opaque_; } |
| 61 float pixels_drawn_translucent() const { return pixels_drawn_translucent_; } | 61 float pixels_drawn_translucent() const { return pixels_drawn_translucent_; } |
| 62 float pixels_culled_for_drawing() const { return pixels_culled_for_drawing_; } | 62 float pixels_culled_for_drawing() const { return pixels_culled_for_drawing_; } |
| 63 float pixels_painted() const { return pixels_painted_; } | 63 float pixels_painted() const { return pixels_painted_; } |
| 64 float pixels_uploaded_opaque() const { return pixels_uploaded_opaque_; } | 64 float pixels_uploaded_opaque() const { return pixels_uploaded_opaque_; } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 float pixels_drawn_translucent_; | 106 float pixels_drawn_translucent_; |
| 107 // Count of pixels not drawn as they are occluded by somthing opaque. | 107 // Count of pixels not drawn as they are occluded by somthing opaque. |
| 108 float pixels_culled_for_drawing_; | 108 float pixels_culled_for_drawing_; |
| 109 | 109 |
| 110 DISALLOW_COPY_AND_ASSIGN(OverdrawMetrics); | 110 DISALLOW_COPY_AND_ASSIGN(OverdrawMetrics); |
| 111 }; | 111 }; |
| 112 | 112 |
| 113 } // namespace cc | 113 } // namespace cc |
| 114 | 114 |
| 115 #endif // CC_DEBUG_OVERDRAW_METRICS_H_ | 115 #endif // CC_DEBUG_OVERDRAW_METRICS_H_ |
| OLD | NEW |