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

Side by Side Diff: cc/prioritized_resource.cc

Issue 11412022: Switched cc::Resource and cc::ScopedResource to Chrome coding style. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed unit tests. 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/layer_tree_host.cc ('k') | cc/prioritized_resource_unittest.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 #include "cc/prioritized_resource.h" 5 #include "cc/prioritized_resource.h"
6 6
7 #include "cc/platform_color.h" 7 #include "cc/platform_color.h"
8 #include "cc/prioritized_resource_manager.h" 8 #include "cc/prioritized_resource_manager.h"
9 #include "cc/priority_calculator.h" 9 #include "cc/priority_calculator.h"
10 #include "cc/proxy.h" 10 #include "cc/proxy.h"
(...skipping 10 matching lines...) Expand all
21 , m_contentsSwizzled(false) 21 , m_contentsSwizzled(false)
22 , m_priority(PriorityCalculator::lowestPriority()) 22 , m_priority(PriorityCalculator::lowestPriority())
23 , m_isAbovePriorityCutoff(false) 23 , m_isAbovePriorityCutoff(false)
24 , m_isSelfManaged(false) 24 , m_isSelfManaged(false)
25 , m_backing(0) 25 , m_backing(0)
26 , m_manager(0) 26 , m_manager(0)
27 { 27 {
28 // m_manager is set in registerTexture() so validity can be checked. 28 // m_manager is set in registerTexture() so validity can be checked.
29 DCHECK(format || size.IsEmpty()); 29 DCHECK(format || size.IsEmpty());
30 if (format) 30 if (format)
31 m_bytes = Resource::memorySizeBytes(size, format); 31 m_bytes = Resource::MemorySizeBytes(size, format);
32 if (manager) 32 if (manager)
33 manager->registerTexture(this); 33 manager->registerTexture(this);
34 } 34 }
35 35
36 PrioritizedResource::~PrioritizedResource() 36 PrioritizedResource::~PrioritizedResource()
37 { 37 {
38 if (m_manager) 38 if (m_manager)
39 m_manager->unregisterTexture(this); 39 m_manager->unregisterTexture(this);
40 } 40 }
41 41
42 void PrioritizedResource::setTextureManager(PrioritizedResourceManager* manager) 42 void PrioritizedResource::setTextureManager(PrioritizedResourceManager* manager)
43 { 43 {
44 if (m_manager == manager) 44 if (m_manager == manager)
45 return; 45 return;
46 if (m_manager) 46 if (m_manager)
47 m_manager->unregisterTexture(this); 47 m_manager->unregisterTexture(this);
48 if (manager) 48 if (manager)
49 manager->registerTexture(this); 49 manager->registerTexture(this);
50 } 50 }
51 51
52 void PrioritizedResource::setDimensions(gfx::Size size, GLenum format) 52 void PrioritizedResource::setDimensions(gfx::Size size, GLenum format)
53 { 53 {
54 if (m_format != format || m_size != size) { 54 if (m_format != format || m_size != size) {
55 m_isAbovePriorityCutoff = false; 55 m_isAbovePriorityCutoff = false;
56 m_format = format; 56 m_format = format;
57 m_size = size; 57 m_size = size;
58 m_bytes = Resource::memorySizeBytes(size, format); 58 m_bytes = Resource::MemorySizeBytes(size, format);
59 DCHECK(m_manager || !m_backing); 59 DCHECK(m_manager || !m_backing);
60 if (m_manager) 60 if (m_manager)
61 m_manager->returnBackingTexture(this); 61 m_manager->returnBackingTexture(this);
62 } 62 }
63 } 63 }
64 64
65 bool PrioritizedResource::requestLate() 65 bool PrioritizedResource::requestLate()
66 { 66 {
67 if (!m_manager) 67 if (!m_manager)
68 return false; 68 return false;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 void PrioritizedResource::Backing::deleteResource(ResourceProvider* resourceProv ider) 152 void PrioritizedResource::Backing::deleteResource(ResourceProvider* resourceProv ider)
153 { 153 {
154 DCHECK(!proxy() || proxy()->isImplThread()); 154 DCHECK(!proxy() || proxy()->isImplThread());
155 DCHECK(!m_resourceHasBeenDeleted); 155 DCHECK(!m_resourceHasBeenDeleted);
156 #ifndef NDEBUG 156 #ifndef NDEBUG
157 DCHECK(resourceProvider == m_resourceProvider); 157 DCHECK(resourceProvider == m_resourceProvider);
158 #endif 158 #endif
159 159
160 resourceProvider->deleteResource(id()); 160 resourceProvider->deleteResource(id());
161 setId(0); 161 set_id(0);
162 m_resourceHasBeenDeleted = true; 162 m_resourceHasBeenDeleted = true;
163 } 163 }
164 164
165 bool PrioritizedResource::Backing::resourceHasBeenDeleted() const 165 bool PrioritizedResource::Backing::resourceHasBeenDeleted() const
166 { 166 {
167 DCHECK(!proxy() || proxy()->isImplThread()); 167 DCHECK(!proxy() || proxy()->isImplThread());
168 return m_resourceHasBeenDeleted; 168 return m_resourceHasBeenDeleted;
169 } 169 }
170 170
171 bool PrioritizedResource::Backing::canBeRecycled() const 171 bool PrioritizedResource::Backing::canBeRecycled() const
(...skipping 30 matching lines...) Expand all
202 } 202 }
203 203
204 const Proxy* PrioritizedResource::Backing::proxy() const 204 const Proxy* PrioritizedResource::Backing::proxy() const
205 { 205 {
206 if (!m_owner || !m_owner->resourceManager()) 206 if (!m_owner || !m_owner->resourceManager())
207 return 0; 207 return 0;
208 return m_owner->resourceManager()->proxyForDebug(); 208 return m_owner->resourceManager()->proxyForDebug();
209 } 209 }
210 210
211 } // namespace cc 211 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_tree_host.cc ('k') | cc/prioritized_resource_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698