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

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: update 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/layers/picture_layer_impl_unittest.cc ('k') | cc/resources/managed_tile_state.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 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 // This class holds all the state relevant to drawing a tile.
41 class CC_EXPORT DrawInfo {
42 public: 42 public:
43 enum Mode { RESOURCE_MODE, SOLID_COLOR_MODE, PICTURE_PILE_MODE }; 43 enum Mode { RESOURCE_MODE, SOLID_COLOR_MODE, PICTURE_PILE_MODE };
44 44
45 TileVersion(); 45 DrawInfo();
46 ~TileVersion(); 46 ~DrawInfo();
47 47
48 Mode mode() const { return mode_; } 48 Mode mode() const { return mode_; }
49 49
50 bool IsReadyToDraw() const; 50 bool IsReadyToDraw() const;
51 51
52 ResourceProvider::ResourceId get_resource_id() const { 52 ResourceProvider::ResourceId get_resource_id() const {
53 DCHECK(mode_ == RESOURCE_MODE); 53 DCHECK(mode_ == RESOURCE_MODE);
54 DCHECK(resource_); 54 DCHECK(resource_);
55 55
56 return resource_->id(); 56 return resource_->id();
57 } 57 }
58 58
59 SkColor get_solid_color() const { 59 SkColor get_solid_color() const {
60 DCHECK(mode_ == SOLID_COLOR_MODE); 60 DCHECK(mode_ == SOLID_COLOR_MODE);
61 61
62 return solid_color_; 62 return solid_color_;
63 } 63 }
64 64
65 bool contents_swizzled() const { 65 bool contents_swizzled() const {
66 DCHECK(resource_); 66 DCHECK(resource_);
67 return !PlatformColor::SameComponentOrder(resource_->format()); 67 return !PlatformColor::SameComponentOrder(resource_->format());
68 } 68 }
69 69
70 bool requires_resource() const { 70 bool requires_resource() const {
71 return mode_ == RESOURCE_MODE || mode_ == PICTURE_PILE_MODE; 71 return mode_ == RESOURCE_MODE || mode_ == PICTURE_PILE_MODE;
72 } 72 }
73 73
74 inline bool has_resource() const { return !!resource_; } 74 inline bool has_resource() const { return !!resource_; }
75 75
76 size_t GPUMemoryUsageInBytes() const;
77
78 void SetSolidColorForTesting(SkColor color) { set_solid_color(color); } 76 void SetSolidColorForTesting(SkColor color) { set_solid_color(color); }
79 void SetResourceForTesting(scoped_ptr<ScopedResource> resource) { 77 void SetResourceForTesting(scoped_ptr<ScopedResource> resource) {
80 resource_ = resource.Pass(); 78 resource_ = resource.Pass();
81 } 79 }
82 80
83 private: 81 private:
84 friend class TileManager; 82 friend class TileManager;
85 friend class PrioritizedTileSet; 83 friend class PrioritizedTileSet;
86 friend class Tile; 84 friend class Tile;
87 friend class ManagedTileState; 85 friend class ManagedTileState;
88 86
89 void set_use_resource() { mode_ = RESOURCE_MODE; } 87 void set_use_resource() { mode_ = RESOURCE_MODE; }
90 88
91 void set_solid_color(const SkColor& color) { 89 void set_solid_color(const SkColor& color) {
92 mode_ = SOLID_COLOR_MODE; 90 mode_ = SOLID_COLOR_MODE;
93 solid_color_ = color; 91 solid_color_ = color;
94 } 92 }
95 93
96 void set_rasterize_on_demand() { mode_ = PICTURE_PILE_MODE; } 94 void set_rasterize_on_demand() { mode_ = PICTURE_PILE_MODE; }
97 95
98 Mode mode_; 96 Mode mode_;
99 SkColor solid_color_; 97 SkColor solid_color_;
100 scoped_ptr<ScopedResource> resource_; 98 scoped_ptr<ScopedResource> resource_;
101 scoped_refptr<RasterTask> raster_task_;
102 }; 99 };
103 100
104 ManagedTileState(); 101 ManagedTileState();
105 ~ManagedTileState(); 102 ~ManagedTileState();
106 103
107 void AsValueInto(base::debug::TracedValue* dict) const; 104 void AsValueInto(base::debug::TracedValue* dict) const;
108 105
109 // Persisted state: valid all the time. 106 // Persisted state: valid all the time.
110 TileVersion tile_versions[NUM_RASTER_MODES]; 107 DrawInfo draw_info;
111 RasterMode raster_mode; 108 scoped_refptr<RasterTask> raster_task;
112 109
113 ManagedTileBin bin; 110 ManagedTileBin bin;
114 111
115 TileResolution resolution; 112 TileResolution resolution;
116 bool required_for_activation; 113 bool required_for_activation;
117 TilePriority::PriorityBin priority_bin; 114 TilePriority::PriorityBin priority_bin;
118 float distance_to_visible; 115 float distance_to_visible;
119 bool visible_and_ready_to_draw; 116 bool visible_and_ready_to_draw;
120 117
121 // Priority for this state from the last time we assigned memory. 118 // Priority for this state from the last time we assigned memory.
122 unsigned scheduled_priority; 119 unsigned scheduled_priority;
123 }; 120 };
124 121
125 } // namespace cc 122 } // namespace cc
126 123
127 #endif // CC_RESOURCES_MANAGED_TILE_STATE_H_ 124 #endif // CC_RESOURCES_MANAGED_TILE_STATE_H_
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl_unittest.cc ('k') | cc/resources/managed_tile_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698