Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Side by Side Diff: cc/test/tiled_layer_test_common.h

Issue 645853008: Standardize usage of virtual/override/final in cc/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatted Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/test/test_shared_bitmap_manager.h ('k') | cc/trees/layer_tree_host_common_perftest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_TEST_TILED_LAYER_TEST_COMMON_H_ 5 #ifndef CC_TEST_TILED_LAYER_TEST_COMMON_H_
6 #define CC_TEST_TILED_LAYER_TEST_COMMON_H_ 6 #define CC_TEST_TILED_LAYER_TEST_COMMON_H_
7 7
8 #include "cc/base/region.h" 8 #include "cc/base/region.h"
9 #include "cc/layers/tiled_layer.h" 9 #include "cc/layers/tiled_layer.h"
10 #include "cc/layers/tiled_layer_impl.h" 10 #include "cc/layers/tiled_layer_impl.h"
11 #include "cc/resources/layer_updater.h" 11 #include "cc/resources/layer_updater.h"
12 #include "cc/resources/prioritized_resource.h" 12 #include "cc/resources/prioritized_resource.h"
13 #include "cc/resources/resource_provider.h" 13 #include "cc/resources/resource_provider.h"
14 #include "cc/resources/resource_update_queue.h" 14 #include "cc/resources/resource_update_queue.h"
15 #include "ui/gfx/rect.h" 15 #include "ui/gfx/rect.h"
16 #include "ui/gfx/size.h" 16 #include "ui/gfx/size.h"
17 17
18 namespace cc { 18 namespace cc {
19 19
20 class FakeTiledLayer; 20 class FakeTiledLayer;
21 21
22 class FakeLayerUpdater : public LayerUpdater { 22 class FakeLayerUpdater : public LayerUpdater {
23 public: 23 public:
24 class Resource : public LayerUpdater::Resource { 24 class Resource : public LayerUpdater::Resource {
25 public: 25 public:
26 Resource(FakeLayerUpdater* updater, 26 Resource(FakeLayerUpdater* updater,
27 scoped_ptr<PrioritizedResource> resource); 27 scoped_ptr<PrioritizedResource> resource);
28 virtual ~Resource(); 28 ~Resource() override;
29 29
30 virtual void Update(ResourceUpdateQueue* queue, 30 void Update(ResourceUpdateQueue* queue,
31 const gfx::Rect& source_rect, 31 const gfx::Rect& source_rect,
32 const gfx::Vector2d& dest_offset, 32 const gfx::Vector2d& dest_offset,
33 bool partial_update) override; 33 bool partial_update) override;
34 34
35 private: 35 private:
36 FakeLayerUpdater* layer_; 36 FakeLayerUpdater* layer_;
37 SkBitmap bitmap_; 37 SkBitmap bitmap_;
38 38
39 DISALLOW_COPY_AND_ASSIGN(Resource); 39 DISALLOW_COPY_AND_ASSIGN(Resource);
40 }; 40 };
41 41
42 FakeLayerUpdater(); 42 FakeLayerUpdater();
43 43
44 virtual scoped_ptr<LayerUpdater::Resource> CreateResource( 44 scoped_ptr<LayerUpdater::Resource> CreateResource(
45 PrioritizedResourceManager* resource) override; 45 PrioritizedResourceManager* resource) override;
46 46
47 virtual void PrepareToUpdate(const gfx::Size& content_size, 47 void PrepareToUpdate(const gfx::Size& content_size,
48 const gfx::Rect& paint_rect, 48 const gfx::Rect& paint_rect,
49 const gfx::Size& tile_size, 49 const gfx::Size& tile_size,
50 float contents_width_scale, 50 float contents_width_scale,
51 float contents_height_scale) override; 51 float contents_height_scale) override;
52 // Sets the rect to invalidate during the next call to PrepareToUpdate(). 52 // Sets the rect to invalidate during the next call to PrepareToUpdate().
53 // After the next call to PrepareToUpdate() the rect is reset. 53 // After the next call to PrepareToUpdate() the rect is reset.
54 void SetRectToInvalidate(const gfx::Rect& rect, FakeTiledLayer* layer); 54 void SetRectToInvalidate(const gfx::Rect& rect, FakeTiledLayer* layer);
55 // Last rect passed to PrepareToUpdate(). 55 // Last rect passed to PrepareToUpdate().
56 gfx::Rect last_update_rect() const { return last_update_rect_; } 56 gfx::Rect last_update_rect() const { return last_update_rect_; }
57 57
58 // Value of |contents_width_scale| last passed to PrepareToUpdate(). 58 // Value of |contents_width_scale| last passed to PrepareToUpdate().
59 float last_contents_width_scale() const { return last_contents_width_scale_; } 59 float last_contents_width_scale() const { return last_contents_width_scale_; }
60 60
61 // Number of times PrepareToUpdate has been invoked. 61 // Number of times PrepareToUpdate has been invoked.
62 int prepare_count() const { return prepare_count_; } 62 int prepare_count() const { return prepare_count_; }
63 void ClearPrepareCount() { prepare_count_ = 0; } 63 void ClearPrepareCount() { prepare_count_ = 0; }
64 64
65 // Number of times Update() has been invoked on a texture. 65 // Number of times Update() has been invoked on a texture.
66 int update_count() const { return update_count_; } 66 int update_count() const { return update_count_; }
67 void ClearUpdateCount() { update_count_ = 0; } 67 void ClearUpdateCount() { update_count_ = 0; }
68 void Update() { update_count_++; } 68 void Update() { update_count_++; }
69 69
70 protected: 70 protected:
71 virtual ~FakeLayerUpdater(); 71 ~FakeLayerUpdater() override;
72 72
73 private: 73 private:
74 int prepare_count_; 74 int prepare_count_;
75 int update_count_; 75 int update_count_;
76 gfx::Rect rect_to_invalidate_; 76 gfx::Rect rect_to_invalidate_;
77 gfx::Rect last_update_rect_; 77 gfx::Rect last_update_rect_;
78 float last_contents_width_scale_; 78 float last_contents_width_scale_;
79 scoped_refptr<FakeTiledLayer> layer_; 79 scoped_refptr<FakeTiledLayer> layer_;
80 80
81 DISALLOW_COPY_AND_ASSIGN(FakeLayerUpdater); 81 DISALLOW_COPY_AND_ASSIGN(FakeLayerUpdater);
82 }; 82 };
83 83
84 class FakeTiledLayerImpl : public TiledLayerImpl { 84 class FakeTiledLayerImpl : public TiledLayerImpl {
85 public: 85 public:
86 FakeTiledLayerImpl(LayerTreeImpl* tree_impl, int id); 86 FakeTiledLayerImpl(LayerTreeImpl* tree_impl, int id);
87 virtual ~FakeTiledLayerImpl(); 87 ~FakeTiledLayerImpl() override;
88 88
89 using TiledLayerImpl::HasTileAt; 89 using TiledLayerImpl::HasTileAt;
90 using TiledLayerImpl::HasResourceIdForTileAt; 90 using TiledLayerImpl::HasResourceIdForTileAt;
91 }; 91 };
92 92
93 class FakeTiledLayer : public TiledLayer { 93 class FakeTiledLayer : public TiledLayer {
94 public: 94 public:
95 explicit FakeTiledLayer(PrioritizedResourceManager* resource_manager); 95 explicit FakeTiledLayer(PrioritizedResourceManager* resource_manager);
96 96
97 static gfx::Size tile_size() { return gfx::Size(100, 100); } 97 static gfx::Size tile_size() { return gfx::Size(100, 100); }
98 98
99 using TiledLayer::InvalidateContentRect; 99 using TiledLayer::InvalidateContentRect;
100 using TiledLayer::NeedsIdlePaint; 100 using TiledLayer::NeedsIdlePaint;
101 using TiledLayer::SkipsDraw; 101 using TiledLayer::SkipsDraw;
102 using TiledLayer::NumPaintedTiles; 102 using TiledLayer::NumPaintedTiles;
103 using TiledLayer::IdlePaintRect; 103 using TiledLayer::IdlePaintRect;
104 104
105 virtual void SetNeedsDisplayRect(const gfx::Rect& rect) override; 105 void SetNeedsDisplayRect(const gfx::Rect& rect) override;
106 const gfx::Rect& last_needs_display_rect() const { 106 const gfx::Rect& last_needs_display_rect() const {
107 return last_needs_display_rect_; 107 return last_needs_display_rect_;
108 } 108 }
109 109
110 virtual void SetTexturePriorities( 110 void SetTexturePriorities(
111 const PriorityCalculator& priority_calculator) override; 111 const PriorityCalculator& priority_calculator) override;
112 112
113 virtual PrioritizedResourceManager* ResourceManager() override; 113 PrioritizedResourceManager* ResourceManager() override;
114 FakeLayerUpdater* fake_layer_updater() { return fake_updater_.get(); } 114 FakeLayerUpdater* fake_layer_updater() { return fake_updater_.get(); }
115 gfx::RectF update_rect() { return update_rect_; } 115 gfx::RectF update_rect() { return update_rect_; }
116 116
117 // Simulate CalcDrawProperties. 117 // Simulate CalcDrawProperties.
118 void UpdateContentsScale(float ideal_contents_scale); 118 void UpdateContentsScale(float ideal_contents_scale);
119 119
120 void ResetNumDependentsNeedPushProperties(); 120 void ResetNumDependentsNeedPushProperties();
121 121
122 protected: 122 protected:
123 virtual LayerUpdater* Updater() const override; 123 LayerUpdater* Updater() const override;
124 virtual void CreateUpdaterIfNeeded() override {} 124 void CreateUpdaterIfNeeded() override {}
125 virtual ~FakeTiledLayer(); 125 ~FakeTiledLayer() override;
126 126
127 private: 127 private:
128 scoped_refptr<FakeLayerUpdater> fake_updater_; 128 scoped_refptr<FakeLayerUpdater> fake_updater_;
129 PrioritizedResourceManager* resource_manager_; 129 PrioritizedResourceManager* resource_manager_;
130 gfx::Rect last_needs_display_rect_; 130 gfx::Rect last_needs_display_rect_;
131 131
132 DISALLOW_COPY_AND_ASSIGN(FakeTiledLayer); 132 DISALLOW_COPY_AND_ASSIGN(FakeTiledLayer);
133 }; 133 };
134 134
135 class FakeTiledLayerWithScaledBounds : public FakeTiledLayer { 135 class FakeTiledLayerWithScaledBounds : public FakeTiledLayer {
136 public: 136 public:
137 explicit FakeTiledLayerWithScaledBounds( 137 explicit FakeTiledLayerWithScaledBounds(
138 PrioritizedResourceManager* resource_manager); 138 PrioritizedResourceManager* resource_manager);
139 139
140 void SetContentBounds(const gfx::Size& content_bounds); 140 void SetContentBounds(const gfx::Size& content_bounds);
141 virtual void CalculateContentsScale(float ideal_contents_scale, 141 void CalculateContentsScale(float ideal_contents_scale,
142 float* contents_scale_x, 142 float* contents_scale_x,
143 float* contents_scale_y, 143 float* contents_scale_y,
144 gfx::Size* content_bounds) override; 144 gfx::Size* content_bounds) override;
145 145
146 protected: 146 protected:
147 virtual ~FakeTiledLayerWithScaledBounds(); 147 ~FakeTiledLayerWithScaledBounds() override;
148 gfx::Size forced_content_bounds_; 148 gfx::Size forced_content_bounds_;
149 149
150 private: 150 private:
151 DISALLOW_COPY_AND_ASSIGN(FakeTiledLayerWithScaledBounds); 151 DISALLOW_COPY_AND_ASSIGN(FakeTiledLayerWithScaledBounds);
152 }; 152 };
153 153
154 } // namespace cc 154 } // namespace cc
155 155
156 #endif // CC_TEST_TILED_LAYER_TEST_COMMON_H_ 156 #endif // CC_TEST_TILED_LAYER_TEST_COMMON_H_
OLDNEW
« no previous file with comments | « cc/test/test_shared_bitmap_manager.h ('k') | cc/trees/layer_tree_host_common_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698