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

Side by Side Diff: cc/resources/managed_tile_state.h

Issue 603683006: cc: Remove low quality mode and cleanup tile versions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove paint_simplifier include 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_RESOURCES_MANAGED_TILE_STATE_H_ 5 #ifndef CC_RESOURCES_MANAGED_TILE_STATE_H_
6 #define CC_RESOURCES_MANAGED_TILE_STATE_H_ 6 #define CC_RESOURCES_MANAGED_TILE_STATE_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "cc/resources/platform_color.h" 9 #include "cc/resources/platform_color.h"
10 #include "cc/resources/raster_mode.h"
11 #include "cc/resources/rasterizer.h" 10 #include "cc/resources/rasterizer.h"
12 #include "cc/resources/resource_pool.h" 11 #include "cc/resources/resource_pool.h"
13 #include "cc/resources/resource_provider.h" 12 #include "cc/resources/resource_provider.h"
14 #include "cc/resources/scoped_resource.h" 13 #include "cc/resources/scoped_resource.h"
15 #include "cc/resources/tile_priority.h" 14 #include "cc/resources/tile_priority.h"
16 15
17 namespace cc { 16 namespace cc {
18 17
19 class TileManager; 18 class TileManager;
20 19
(...skipping 10 matching lines...) Expand all
31 NUM_BINS = 8 30 NUM_BINS = 8
32 // NOTE: Be sure to update ManagedTileBinAsValue and kBinPolicyMap when adding 31 // NOTE: Be sure to update ManagedTileBinAsValue and kBinPolicyMap when adding
33 // or reordering fields. 32 // or reordering fields.
34 }; 33 };
35 scoped_ptr<base::Value> ManagedTileBinAsValue(ManagedTileBin bin); 34 scoped_ptr<base::Value> ManagedTileBinAsValue(ManagedTileBin bin);
36 35
37 // This is state that is specific to a tile that is 36 // This is state that is specific to a tile that is
38 // managed by the TileManager. 37 // managed by the TileManager.
39 class CC_EXPORT ManagedTileState { 38 class CC_EXPORT ManagedTileState {
40 public: 39 public:
41 class CC_EXPORT TileVersion { 40 class CC_EXPORT TileDrawInfo {
reveman 2014/09/27 02:57:31 nit: is the "Tile" prefix necessary? ManagedTileSt
vmpstr 2014/09/29 14:09:50 Done.
42 public: 41 public:
43 enum Mode { RESOURCE_MODE, SOLID_COLOR_MODE, PICTURE_PILE_MODE }; 42 enum Mode { RESOURCE_MODE, SOLID_COLOR_MODE, PICTURE_PILE_MODE };
44 43
45 TileVersion(); 44 TileDrawInfo();
46 ~TileVersion(); 45 ~TileDrawInfo();
47 46
48 Mode mode() const { return mode_; } 47 Mode mode() const { return mode_; }
49 48
50 bool IsReadyToDraw() const; 49 bool IsReadyToDraw() const;
51 50
52 ResourceProvider::ResourceId get_resource_id() const { 51 ResourceProvider::ResourceId get_resource_id() const {
53 DCHECK(mode_ == RESOURCE_MODE); 52 DCHECK(mode_ == RESOURCE_MODE);
54 DCHECK(resource_); 53 DCHECK(resource_);
55 54
56 return resource_->id(); 55 return resource_->id();
57 } 56 }
58 57
59 SkColor get_solid_color() const { 58 SkColor get_solid_color() const {
60 DCHECK(mode_ == SOLID_COLOR_MODE); 59 DCHECK(mode_ == SOLID_COLOR_MODE);
61 60
62 return solid_color_; 61 return solid_color_;
63 } 62 }
64 63
65 bool contents_swizzled() const { 64 bool contents_swizzled() const {
66 DCHECK(resource_); 65 DCHECK(resource_);
67 return !PlatformColor::SameComponentOrder(resource_->format()); 66 return !PlatformColor::SameComponentOrder(resource_->format());
68 } 67 }
69 68
70 bool requires_resource() const { 69 bool requires_resource() const {
71 return mode_ == RESOURCE_MODE || mode_ == PICTURE_PILE_MODE; 70 return mode_ == RESOURCE_MODE || mode_ == PICTURE_PILE_MODE;
72 } 71 }
73 72
74 inline bool has_resource() const { return !!resource_; } 73 inline bool has_resource() const { return !!resource_; }
75 74
76 size_t GPUMemoryUsageInBytes() const; 75 size_t GPUMemoryUsageInBytes() const;
reveman 2014/09/27 02:57:31 Does this belong here? The "draw info" has a memor
vmpstr 2014/09/29 14:09:50 Done (removed).
77 76
78 void SetSolidColorForTesting(SkColor color) { set_solid_color(color); } 77 void SetSolidColorForTesting(SkColor color) { set_solid_color(color); }
79 void SetResourceForTesting(scoped_ptr<ScopedResource> resource) { 78 void SetResourceForTesting(scoped_ptr<ScopedResource> resource) {
80 resource_ = resource.Pass(); 79 resource_ = resource.Pass();
81 } 80 }
82 81
83 private: 82 private:
84 friend class TileManager; 83 friend class TileManager;
85 friend class PrioritizedTileSet; 84 friend class PrioritizedTileSet;
86 friend class Tile; 85 friend class Tile;
87 friend class ManagedTileState; 86 friend class ManagedTileState;
88 87
89 void set_use_resource() { mode_ = RESOURCE_MODE; } 88 void set_use_resource() { mode_ = RESOURCE_MODE; }
90 89
91 void set_solid_color(const SkColor& color) { 90 void set_solid_color(const SkColor& color) {
92 mode_ = SOLID_COLOR_MODE; 91 mode_ = SOLID_COLOR_MODE;
93 solid_color_ = color; 92 solid_color_ = color;
94 } 93 }
95 94
96 void set_rasterize_on_demand() { mode_ = PICTURE_PILE_MODE; } 95 void set_rasterize_on_demand() { mode_ = PICTURE_PILE_MODE; }
97 96
98 Mode mode_; 97 Mode mode_;
99 SkColor solid_color_; 98 SkColor solid_color_;
100 scoped_ptr<ScopedResource> resource_; 99 scoped_ptr<ScopedResource> resource_;
101 scoped_refptr<RasterTask> raster_task_; 100 scoped_refptr<RasterTask> raster_task_;
reveman 2014/09/27 02:57:32 Does the task belong in this class? Not really use
vmpstr 2014/09/29 14:09:50 Done (moved to mts).
102 }; 101 };
103 102
104 ManagedTileState(); 103 ManagedTileState();
105 ~ManagedTileState(); 104 ~ManagedTileState();
106 105
107 void AsValueInto(base::debug::TracedValue* dict) const; 106 void AsValueInto(base::debug::TracedValue* dict) const;
108 107
109 // Persisted state: valid all the time. 108 // Persisted state: valid all the time.
110 TileVersion tile_versions[NUM_RASTER_MODES]; 109 TileDrawInfo draw_info_;
111 RasterMode raster_mode;
112 110
113 ManagedTileBin bin; 111 ManagedTileBin bin;
114 112
115 TileResolution resolution; 113 TileResolution resolution;
116 bool required_for_activation; 114 bool required_for_activation;
117 TilePriority::PriorityBin priority_bin; 115 TilePriority::PriorityBin priority_bin;
118 float distance_to_visible; 116 float distance_to_visible;
119 bool visible_and_ready_to_draw; 117 bool visible_and_ready_to_draw;
120 118
121 // Priority for this state from the last time we assigned memory. 119 // Priority for this state from the last time we assigned memory.
122 unsigned scheduled_priority; 120 unsigned scheduled_priority;
123 }; 121 };
124 122
125 } // namespace cc 123 } // namespace cc
126 124
127 #endif // CC_RESOURCES_MANAGED_TILE_STATE_H_ 125 #endif // CC_RESOURCES_MANAGED_TILE_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698