| OLD | NEW |
| 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 CC_RESOURCE_PROVIDER_H_ | 5 #ifndef CC_RESOURCE_PROVIDER_H_ |
| 6 #define CC_RESOURCE_PROVIDER_H_ | 6 #define CC_RESOURCE_PROVIDER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/hash_tables.h" | 9 #include "base/hash_tables.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 unsigned glUploadQueryId; | 243 unsigned glUploadQueryId; |
| 244 Mailbox mailbox; | 244 Mailbox mailbox; |
| 245 uint8_t* pixels; | 245 uint8_t* pixels; |
| 246 uint8_t* pixelBuffer; | 246 uint8_t* pixelBuffer; |
| 247 int lockForReadCount; | 247 int lockForReadCount; |
| 248 bool lockedForWrite; | 248 bool lockedForWrite; |
| 249 bool external; | 249 bool external; |
| 250 bool exported; | 250 bool exported; |
| 251 bool markedForDeletion; | 251 bool markedForDeletion; |
| 252 bool pendingSetPixels; | 252 bool pendingSetPixels; |
| 253 bool allocated; |
| 253 gfx::Size size; | 254 gfx::Size size; |
| 254 GLenum format; | 255 GLenum format; |
| 255 // TODO(skyostil): Use a separate sampler object for filter state. | 256 // TODO(skyostil): Use a separate sampler object for filter state. |
| 256 GLenum filter; | 257 GLenum filter; |
| 257 ResourceType type; | 258 ResourceType type; |
| 258 }; | 259 }; |
| 259 typedef base::hash_map<ResourceId, Resource> ResourceMap; | 260 typedef base::hash_map<ResourceId, Resource> ResourceMap; |
| 260 struct Child { | 261 struct Child { |
| 261 Child(); | 262 Child(); |
| 262 ~Child(); | 263 ~Child(); |
| 263 | 264 |
| 264 ResourceIdMap childToParentMap; | 265 ResourceIdMap childToParentMap; |
| 265 ResourceIdMap parentToChildMap; | 266 ResourceIdMap parentToChildMap; |
| 266 }; | 267 }; |
| 267 typedef base::hash_map<int, Child> ChildMap; | 268 typedef base::hash_map<int, Child> ChildMap; |
| 268 | 269 |
| 269 explicit ResourceProvider(OutputSurface*); | 270 explicit ResourceProvider(OutputSurface*); |
| 270 bool initialize(); | 271 bool initialize(); |
| 271 | 272 |
| 272 const Resource* lockForRead(ResourceId); | 273 const Resource* lockForRead(ResourceId); |
| 273 void unlockForRead(ResourceId); | 274 void unlockForRead(ResourceId); |
| 274 const Resource* lockForWrite(ResourceId); | 275 const Resource* lockForWrite(ResourceId); |
| 275 void unlockForWrite(ResourceId); | 276 void unlockForWrite(ResourceId); |
| 276 static void populateSkBitmapWithResource(SkBitmap*, const Resource*); | 277 static void populateSkBitmapWithResource(SkBitmap*, const Resource*); |
| 277 | 278 |
| 278 bool transferResource(WebKit::WebGraphicsContext3D*, ResourceId, Transferabl
eResource*); | 279 bool transferResource(WebKit::WebGraphicsContext3D*, ResourceId, Transferabl
eResource*); |
| 279 void deleteResourceInternal(ResourceMap::iterator it); | 280 void deleteResourceInternal(ResourceMap::iterator it); |
| 281 void lazyAllocateTexture(WebKit::WebGraphicsContext3D*, Resource*); |
| 280 | 282 |
| 281 OutputSurface* m_outputSurface; | 283 OutputSurface* m_outputSurface; |
| 282 ResourceId m_nextId; | 284 ResourceId m_nextId; |
| 283 ResourceMap m_resources; | 285 ResourceMap m_resources; |
| 284 int m_nextChild; | 286 int m_nextChild; |
| 285 ChildMap m_children; | 287 ChildMap m_children; |
| 286 | 288 |
| 287 ResourceType m_defaultResourceType; | 289 ResourceType m_defaultResourceType; |
| 288 bool m_useTextureStorageExt; | 290 bool m_useTextureStorageExt; |
| 289 bool m_useTextureUsageHint; | 291 bool m_useTextureUsageHint; |
| 290 bool m_useShallowFlush; | 292 bool m_useShallowFlush; |
| 291 scoped_ptr<TextureUploader> m_textureUploader; | 293 scoped_ptr<TextureUploader> m_textureUploader; |
| 292 scoped_ptr<AcceleratedTextureCopier> m_textureCopier; | 294 scoped_ptr<AcceleratedTextureCopier> m_textureCopier; |
| 293 int m_maxTextureSize; | 295 int m_maxTextureSize; |
| 294 GLenum m_bestTextureFormat; | 296 GLenum m_bestTextureFormat; |
| 295 | 297 |
| 296 base::ThreadChecker m_threadChecker; | 298 base::ThreadChecker m_threadChecker; |
| 297 | 299 |
| 298 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 300 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
| 299 }; | 301 }; |
| 300 | 302 |
| 301 } | 303 } |
| 302 | 304 |
| 303 #endif // CC_RESOURCE_PROVIDER_H_ | 305 #endif // CC_RESOURCE_PROVIDER_H_ |
| OLD | NEW |