| 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_LAYERS_HEADS_UP_DISPLAY_LAYER_IMPL_H_ | 5 #ifndef CC_LAYERS_HEADS_UP_DISPLAY_LAYER_IMPL_H_ |
| 6 #define CC_LAYERS_HEADS_UP_DISPLAY_LAYER_IMPL_H_ | 6 #define CC_LAYERS_HEADS_UP_DISPLAY_LAYER_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <string> | 9 #include <string> |
| 9 #include <vector> | 10 #include <vector> |
| 10 | 11 |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/ptr_util.h" |
| 13 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 14 #include "cc/base/cc_export.h" | 15 #include "cc/base/cc_export.h" |
| 15 #include "cc/debug/debug_rect_history.h" | 16 #include "cc/debug/debug_rect_history.h" |
| 16 #include "cc/layers/layer_impl.h" | 17 #include "cc/layers/layer_impl.h" |
| 17 #include "cc/resources/memory_history.h" | 18 #include "cc/resources/memory_history.h" |
| 18 #include "cc/resources/scoped_resource.h" | 19 #include "cc/resources/scoped_resource.h" |
| 19 | 20 |
| 20 class SkCanvas; | 21 class SkCanvas; |
| 21 class SkPaint; | 22 class SkPaint; |
| 22 class SkTypeface; | 23 class SkTypeface; |
| 23 struct SkRect; | 24 struct SkRect; |
| 24 | 25 |
| 25 namespace cc { | 26 namespace cc { |
| 26 | 27 |
| 27 class FrameRateCounter; | 28 class FrameRateCounter; |
| 28 class PaintTimeCounter; | 29 class PaintTimeCounter; |
| 29 | 30 |
| 30 class CC_EXPORT HeadsUpDisplayLayerImpl : public LayerImpl { | 31 class CC_EXPORT HeadsUpDisplayLayerImpl : public LayerImpl { |
| 31 public: | 32 public: |
| 32 static scoped_ptr<HeadsUpDisplayLayerImpl> Create(LayerTreeImpl* tree_impl, | 33 static std::unique_ptr<HeadsUpDisplayLayerImpl> Create( |
| 33 int id) { | 34 LayerTreeImpl* tree_impl, |
| 34 return make_scoped_ptr(new HeadsUpDisplayLayerImpl(tree_impl, id)); | 35 int id) { |
| 36 return base::WrapUnique(new HeadsUpDisplayLayerImpl(tree_impl, id)); |
| 35 } | 37 } |
| 36 ~HeadsUpDisplayLayerImpl() override; | 38 ~HeadsUpDisplayLayerImpl() override; |
| 37 | 39 |
| 38 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 40 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
| 39 | 41 |
| 40 bool WillDraw(DrawMode draw_mode, | 42 bool WillDraw(DrawMode draw_mode, |
| 41 ResourceProvider* resource_provider) override; | 43 ResourceProvider* resource_provider) override; |
| 42 void AppendQuads(RenderPass* render_pass, | 44 void AppendQuads(RenderPass* render_pass, |
| 43 AppendQuadsData* append_quads_data) override; | 45 AppendQuadsData* append_quads_data) override; |
| 44 void UpdateHudTexture(DrawMode draw_mode, | 46 void UpdateHudTexture(DrawMode draw_mode, |
| 45 ResourceProvider* resource_provider); | 47 ResourceProvider* resource_provider); |
| 46 | 48 |
| 47 void ReleaseResources() override; | 49 void ReleaseResources() override; |
| 48 | 50 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 const DebugRect& rect, | 124 const DebugRect& rect, |
| 123 SkColor stroke_color, | 125 SkColor stroke_color, |
| 124 SkColor fill_color, | 126 SkColor fill_color, |
| 125 float stroke_width, | 127 float stroke_width, |
| 126 const std::string& label_text) const; | 128 const std::string& label_text) const; |
| 127 void DrawDebugRects(SkCanvas* canvas, DebugRectHistory* debug_rect_history); | 129 void DrawDebugRects(SkCanvas* canvas, DebugRectHistory* debug_rect_history); |
| 128 | 130 |
| 129 void AcquireResource(ResourceProvider* resource_provider); | 131 void AcquireResource(ResourceProvider* resource_provider); |
| 130 void ReleaseUnmatchedSizeResources(ResourceProvider* resource_provider); | 132 void ReleaseUnmatchedSizeResources(ResourceProvider* resource_provider); |
| 131 | 133 |
| 132 std::vector<scoped_ptr<ScopedResource>> resources_; | 134 std::vector<std::unique_ptr<ScopedResource>> resources_; |
| 133 sk_sp<SkSurface> hud_surface_; | 135 sk_sp<SkSurface> hud_surface_; |
| 134 | 136 |
| 135 skia::RefPtr<SkTypeface> typeface_; | 137 skia::RefPtr<SkTypeface> typeface_; |
| 136 | 138 |
| 137 float internal_contents_scale_; | 139 float internal_contents_scale_; |
| 138 gfx::Size internal_content_bounds_; | 140 gfx::Size internal_content_bounds_; |
| 139 | 141 |
| 140 Graph fps_graph_; | 142 Graph fps_graph_; |
| 141 Graph paint_time_graph_; | 143 Graph paint_time_graph_; |
| 142 MemoryHistory::Entry memory_entry_; | 144 MemoryHistory::Entry memory_entry_; |
| 143 int fade_step_; | 145 int fade_step_; |
| 144 std::vector<DebugRect> paint_rects_; | 146 std::vector<DebugRect> paint_rects_; |
| 145 | 147 |
| 146 base::TimeTicks time_of_last_graph_update_; | 148 base::TimeTicks time_of_last_graph_update_; |
| 147 | 149 |
| 148 DISALLOW_COPY_AND_ASSIGN(HeadsUpDisplayLayerImpl); | 150 DISALLOW_COPY_AND_ASSIGN(HeadsUpDisplayLayerImpl); |
| 149 }; | 151 }; |
| 150 | 152 |
| 151 } // namespace cc | 153 } // namespace cc |
| 152 | 154 |
| 153 #endif // CC_LAYERS_HEADS_UP_DISPLAY_LAYER_IMPL_H_ | 155 #endif // CC_LAYERS_HEADS_UP_DISPLAY_LAYER_IMPL_H_ |
| OLD | NEW |