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

Side by Side Diff: cc/prioritized_texture_manager.h

Issue 11266030: Use gfx:: Geometry types for the resource provider and layer updater classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: uint8 Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « cc/prioritized_texture.cc ('k') | cc/prioritized_texture_manager.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 CCPrioritizedTextureManager_h 5 #ifndef CCPrioritizedTextureManager_h
6 #define CCPrioritizedTextureManager_h 6 #define CCPrioritizedTextureManager_h
7 7
8 #include <list> 8 #include <list>
9 #include <vector> 9 #include <vector>
10 10
11 #include "IntRect.h"
12 #include "IntSize.h"
13 #include "base/basictypes.h" 11 #include "base/basictypes.h"
14 #include "base/hash_tables.h" 12 #include "base/hash_tables.h"
15 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
16 #include "cc/prioritized_texture.h" 14 #include "cc/prioritized_texture.h"
17 #include "cc/priority_calculator.h" 15 #include "cc/priority_calculator.h"
18 #include "cc/texture.h" 16 #include "cc/texture.h"
19 #include "third_party/khronos/GLES2/gl2.h" 17 #include "third_party/khronos/GLES2/gl2.h"
18 #include "ui/gfx/size.h"
20 19
21 #if defined(COMPILER_GCC) 20 #if defined(COMPILER_GCC)
22 namespace BASE_HASH_NAMESPACE { 21 namespace BASE_HASH_NAMESPACE {
23 template<> 22 template<>
24 struct hash<cc::PrioritizedTexture*> { 23 struct hash<cc::PrioritizedTexture*> {
25 size_t operator()(cc::PrioritizedTexture* ptr) const { 24 size_t operator()(cc::PrioritizedTexture* ptr) const {
26 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); 25 return hash<size_t>()(reinterpret_cast<size_t>(ptr));
27 } 26 }
28 }; 27 };
29 } // namespace BASE_HASH_NAMESPACE 28 } // namespace BASE_HASH_NAMESPACE
30 #endif // COMPILER 29 #endif // COMPILER
31 30
32 namespace cc { 31 namespace cc {
33 32
34 class PriorityCalculator; 33 class PriorityCalculator;
35 34
36 class PrioritizedTextureManager { 35 class PrioritizedTextureManager {
37 public: 36 public:
38 static scoped_ptr<PrioritizedTextureManager> create(size_t maxMemoryLimitByt es, int maxTextureSize, int pool) 37 static scoped_ptr<PrioritizedTextureManager> create(size_t maxMemoryLimitByt es, int maxTextureSize, int pool)
39 { 38 {
40 return make_scoped_ptr(new PrioritizedTextureManager(maxMemoryLimitBytes , maxTextureSize, pool)); 39 return make_scoped_ptr(new PrioritizedTextureManager(maxMemoryLimitBytes , maxTextureSize, pool));
41 } 40 }
42 scoped_ptr<PrioritizedTexture> createTexture(IntSize size, GLenum format) 41 scoped_ptr<PrioritizedTexture> createTexture(gfx::Size size, GLenum format)
43 { 42 {
44 return make_scoped_ptr(new PrioritizedTexture(this, size, format)); 43 return make_scoped_ptr(new PrioritizedTexture(this, size, format));
45 } 44 }
46 ~PrioritizedTextureManager(); 45 ~PrioritizedTextureManager();
47 46
48 typedef std::list<PrioritizedTexture::Backing*> BackingList; 47 typedef std::list<PrioritizedTexture::Backing*> BackingList;
49 48
50 // FIXME (http://crbug.com/137094): This 64MB default is a straggler from th e 49 // FIXME (http://crbug.com/137094): This 64MB default is a straggler from th e
51 // old texture manager and is just to give us a default memory allocation be fore 50 // old texture manager and is just to give us a default memory allocation be fore
52 // we get a callback from the GPU memory manager. We should probaby either: 51 // we get a callback from the GPU memory manager. We should probaby either:
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 return PriorityCalculator::priorityIsLower(a->requestPriorityAtLastP riorityUpdate(), b->requestPriorityAtLastPriorityUpdate()); 137 return PriorityCalculator::priorityIsLower(a->requestPriorityAtLastP riorityUpdate(), b->requestPriorityAtLastPriorityUpdate());
139 // Finally sort by being in the impl tree versus being completely unrefe renced 138 // Finally sort by being in the impl tree versus being completely unrefe renced
140 if (a->inDrawingImplTree() != b->inDrawingImplTree()) 139 if (a->inDrawingImplTree() != b->inDrawingImplTree())
141 return (a->inDrawingImplTree() < b->inDrawingImplTree()); 140 return (a->inDrawingImplTree() < b->inDrawingImplTree());
142 return a < b; 141 return a < b;
143 } 142 }
144 143
145 PrioritizedTextureManager(size_t maxMemoryLimitBytes, int maxTextureSize, in t pool); 144 PrioritizedTextureManager(size_t maxMemoryLimitBytes, int maxTextureSize, in t pool);
146 145
147 bool evictBackingsToReduceMemory(size_t limitBytes, int priorityCutoff, Evic tionPolicy, ResourceProvider*); 146 bool evictBackingsToReduceMemory(size_t limitBytes, int priorityCutoff, Evic tionPolicy, ResourceProvider*);
148 PrioritizedTexture::Backing* createBacking(IntSize, GLenum format, ResourceP rovider*); 147 PrioritizedTexture::Backing* createBacking(gfx::Size, GLenum format, Resourc eProvider*);
149 void evictFirstBackingResource(ResourceProvider*); 148 void evictFirstBackingResource(ResourceProvider*);
150 void deleteUnlinkedEvictedBackings(); 149 void deleteUnlinkedEvictedBackings();
151 void sortBackings(); 150 void sortBackings();
152 151
153 void assertInvariants(); 152 void assertInvariants();
154 153
155 size_t m_maxMemoryLimitBytes; 154 size_t m_maxMemoryLimitBytes;
156 // The priority cutoff based on memory pressure. This is not a strict 155 // The priority cutoff based on memory pressure. This is not a strict
157 // cutoff -- requestLate allows textures with priority equal to this 156 // cutoff -- requestLate allows textures with priority equal to this
158 // cutoff to be allowed. 157 // cutoff to be allowed.
(...skipping 26 matching lines...) Expand all
185 // Statistics copied at the time of pushTexturePrioritiesToBackings. 184 // Statistics copied at the time of pushTexturePrioritiesToBackings.
186 size_t m_memoryVisibleLastPushedBytes; 185 size_t m_memoryVisibleLastPushedBytes;
187 size_t m_memoryVisibleAndNearbyLastPushedBytes; 186 size_t m_memoryVisibleAndNearbyLastPushedBytes;
188 187
189 DISALLOW_COPY_AND_ASSIGN(PrioritizedTextureManager); 188 DISALLOW_COPY_AND_ASSIGN(PrioritizedTextureManager);
190 }; 189 };
191 190
192 } // namespace cc 191 } // namespace cc
193 192
194 #endif 193 #endif
OLDNEW
« no previous file with comments | « cc/prioritized_texture.cc ('k') | cc/prioritized_texture_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698