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

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

Issue 15995033: cc: Low quality support for low res tiles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: typo fix Created 7 years, 6 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 | « no previous file | cc/resources/managed_tile_state.cc » ('j') | cc/resources/tile_manager.h » ('J')
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 <map>
9
8 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
9 #include "cc/resources/platform_color.h" 11 #include "cc/resources/platform_color.h"
10 #include "cc/resources/raster_worker_pool.h" 12 #include "cc/resources/raster_worker_pool.h"
11 #include "cc/resources/resource_pool.h" 13 #include "cc/resources/resource_pool.h"
12 #include "cc/resources/resource_provider.h" 14 #include "cc/resources/resource_provider.h"
13 #include "cc/resources/tile_manager.h" 15 #include "cc/resources/tile_manager.h"
14 16
15 namespace cc { 17 namespace cc {
16 18
17 // This is state that is specific to a tile that is 19 // This is state that is specific to a tile that is
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 70
69 void SetResourceForTesting(scoped_ptr<ResourcePool::Resource> resource) { 71 void SetResourceForTesting(scoped_ptr<ResourcePool::Resource> resource) {
70 resource_ = resource.Pass(); 72 resource_ = resource.Pass();
71 resource_id_ = resource_->id(); 73 resource_id_ = resource_->id();
72 } 74 }
73 75
74 scoped_ptr<ResourcePool::Resource>& GetResourceForTesting() { 76 scoped_ptr<ResourcePool::Resource>& GetResourceForTesting() {
75 return resource_; 77 return resource_;
76 } 78 }
77 79
80 bool ShouldBeUpdatedBy(TileRasterMode new_mode) const;
81
78 private: 82 private:
79 friend class TileManager; 83 friend class TileManager;
80 friend class Tile; 84 friend class Tile;
81 friend class ManagedTileState; 85 friend class ManagedTileState;
82 86
83 void set_use_resource() { 87 void set_use_resource() {
84 mode_ = RESOURCE_MODE; 88 mode_ = RESOURCE_MODE;
85 } 89 }
86 90
87 void set_solid_color(const SkColor& color) { 91 void set_solid_color(const SkColor& color) {
88 mode_ = SOLID_COLOR_MODE; 92 mode_ = SOLID_COLOR_MODE;
89 solid_color_ = color; 93 solid_color_ = color;
90 resource_id_ = 0; 94 resource_id_ = 0;
91 } 95 }
92 96
93 void set_rasterize_on_demand() { 97 void set_rasterize_on_demand() {
94 mode_ = PICTURE_PILE_MODE; 98 mode_ = PICTURE_PILE_MODE;
95 resource_id_ = 0; 99 resource_id_ = 0;
96 } 100 }
97 101
102 void PushPropertiesTo(TileVersion* destination);
103
98 Mode mode_; 104 Mode mode_;
99 SkColor solid_color_; 105 SkColor solid_color_;
100 106
101 // TODO(reveman): Eliminate the need for both |resource_id_| 107 // TODO(reveman): Eliminate the need for both |resource_id_|
102 // and |resource| by re-factoring the "force upload" 108 // and |resource| by re-factoring the "force upload"
103 // mechanism. crbug.com/245767 109 // mechanism. crbug.com/245767
104 ResourceProvider::ResourceId resource_id_; 110 ResourceProvider::ResourceId resource_id_;
105 scoped_ptr<ResourcePool::Resource> resource_; 111 scoped_ptr<ResourcePool::Resource> resource_;
106 GLenum resource_format_; 112 GLenum resource_format_;
107 bool forced_upload_; 113 bool forced_upload_;
114 TileRasterMode raster_mode_;
115 RasterWorkerPool::RasterTask raster_task_;
108 }; 116 };
109 117
110 118
111 ManagedTileState(); 119 ManagedTileState();
112 ~ManagedTileState(); 120 ~ManagedTileState();
113 121
114 scoped_ptr<base::Value> AsValue() const; 122 scoped_ptr<base::Value> AsValue() const;
115 123
116 // Persisted state: valid all the time. 124 // Persisted state: valid all the time.
117 TileVersion tile_version; 125 TileVersion tile_version;
reveman 2013/06/05 14:25:13 Why not just replace |tile_version| with: typedef
126
127 typedef std::map<TileRasterMode, TileVersion*> TileVersionMap;
128 TileVersionMap pending_tile_versions;
129
118 bool picture_pile_analyzed; 130 bool picture_pile_analyzed;
119 PicturePileImpl::Analysis picture_pile_analysis; 131 PicturePileImpl::Analysis picture_pile_analysis;
120 RasterWorkerPool::RasterTask raster_task;
121 132
122 // Ephemeral state, valid only during TileManager::ManageTiles. 133 // Ephemeral state, valid only during TileManager::ManageTiles.
123 bool is_in_never_bin_on_both_trees() const { 134 bool is_in_never_bin_on_both_trees() const {
124 return bin[HIGH_PRIORITY_BIN] == NEVER_BIN && 135 return bin[HIGH_PRIORITY_BIN] == NEVER_BIN &&
125 bin[LOW_PRIORITY_BIN] == NEVER_BIN; 136 bin[LOW_PRIORITY_BIN] == NEVER_BIN;
126 } 137 }
127 bool is_in_now_bin_on_either_tree() const { 138 bool is_in_now_bin_on_either_tree() const {
128 return bin[HIGH_PRIORITY_BIN] == NOW_BIN || 139 return bin[HIGH_PRIORITY_BIN] == NOW_BIN ||
129 bin[LOW_PRIORITY_BIN] == NOW_BIN; 140 bin[LOW_PRIORITY_BIN] == NOW_BIN;
130 } 141 }
131 142
132 TileManagerBin bin[NUM_BIN_PRIORITIES]; 143 TileManagerBin bin[NUM_BIN_PRIORITIES];
133 TileManagerBin tree_bin[NUM_TREES]; 144 TileManagerBin tree_bin[NUM_TREES];
134 145
135 // The bin that the tile would have if the GPU memory manager had 146 // The bin that the tile would have if the GPU memory manager had
136 // a maximally permissive policy, send to the GPU memory manager 147 // a maximally permissive policy, send to the GPU memory manager
137 // to determine policy. 148 // to determine policy.
138 TileManagerBin gpu_memmgr_stats_bin; 149 TileManagerBin gpu_memmgr_stats_bin;
139 TileResolution resolution; 150 TileResolution resolution;
140 bool required_for_activation; 151 bool required_for_activation;
141 float time_to_needed_in_seconds; 152 float time_to_needed_in_seconds;
142 float distance_to_visible_in_pixels; 153 float distance_to_visible_in_pixels;
143 }; 154 };
144 155
145 } // namespace cc 156 } // namespace cc
146 157
147 #endif // CC_RESOURCES_MANAGED_TILE_STATE_H_ 158 #endif // CC_RESOURCES_MANAGED_TILE_STATE_H_
OLDNEW
« no previous file with comments | « no previous file | cc/resources/managed_tile_state.cc » ('j') | cc/resources/tile_manager.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698