| 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 void acquirePixelBuffer(ResourceId id); | 215 void acquirePixelBuffer(ResourceId id); |
| 216 void releasePixelBuffer(ResourceId id); | 216 void releasePixelBuffer(ResourceId id); |
| 217 | 217 |
| 218 // Map/unmap the acquired pixel buffer. | 218 // Map/unmap the acquired pixel buffer. |
| 219 uint8_t* mapPixelBuffer(ResourceId id); | 219 uint8_t* mapPixelBuffer(ResourceId id); |
| 220 void unmapPixelBuffer(ResourceId id); | 220 void unmapPixelBuffer(ResourceId id); |
| 221 | 221 |
| 222 // Update pixels from acquired pixel buffer. | 222 // Update pixels from acquired pixel buffer. |
| 223 void setPixelsFromBuffer(ResourceId id); | 223 void setPixelsFromBuffer(ResourceId id); |
| 224 | 224 |
| 225 // Asynchronously update pixels from acquired pixel buffer. |
| 226 void beginSetPixels(ResourceId id); |
| 227 bool didSetPixelsComplete(ResourceId id); |
| 228 |
| 225 private: | 229 private: |
| 226 struct Resource { | 230 struct Resource { |
| 227 Resource(); | 231 Resource(); |
| 228 Resource(unsigned textureId, int pool, const gfx::Size& size, GLenum for
mat, GLenum filter); | 232 Resource(unsigned textureId, int pool, const gfx::Size& size, GLenum for
mat, GLenum filter); |
| 229 Resource(uint8_t* pixels, int pool, const gfx::Size& size, GLenum format
, GLenum filter); | 233 Resource(uint8_t* pixels, int pool, const gfx::Size& size, GLenum format
, GLenum filter); |
| 230 | 234 |
| 231 unsigned glId; | 235 unsigned glId; |
| 232 // Pixel buffer used for set pixels without unnecessary copying. | 236 // Pixel buffer used for set pixels without unnecessary copying. |
| 233 unsigned glPixelBufferId; | 237 unsigned glPixelBufferId; |
| 238 // Query used to determine when asynchronous set pixels complete. |
| 239 unsigned glUploadQueryId; |
| 234 Mailbox mailbox; | 240 Mailbox mailbox; |
| 235 uint8_t* pixels; | 241 uint8_t* pixels; |
| 236 uint8_t* pixelBuffer; | 242 uint8_t* pixelBuffer; |
| 237 int pool; | 243 int pool; |
| 238 int lockForReadCount; | 244 int lockForReadCount; |
| 239 bool lockedForWrite; | 245 bool lockedForWrite; |
| 240 bool external; | 246 bool external; |
| 241 bool exported; | 247 bool exported; |
| 242 bool markedForDeletion; | 248 bool markedForDeletion; |
| 249 bool pendingSetPixels; |
| 243 gfx::Size size; | 250 gfx::Size size; |
| 244 GLenum format; | 251 GLenum format; |
| 245 // TODO(skyostil): Use a separate sampler object for filter state. | 252 // TODO(skyostil): Use a separate sampler object for filter state. |
| 246 GLenum filter; | 253 GLenum filter; |
| 247 ResourceType type; | 254 ResourceType type; |
| 248 }; | 255 }; |
| 249 typedef base::hash_map<ResourceId, Resource> ResourceMap; | 256 typedef base::hash_map<ResourceId, Resource> ResourceMap; |
| 250 struct Child { | 257 struct Child { |
| 251 Child(); | 258 Child(); |
| 252 ~Child(); | 259 ~Child(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 int m_maxTextureSize; | 291 int m_maxTextureSize; |
| 285 | 292 |
| 286 base::ThreadChecker m_threadChecker; | 293 base::ThreadChecker m_threadChecker; |
| 287 | 294 |
| 288 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 295 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
| 289 }; | 296 }; |
| 290 | 297 |
| 291 } | 298 } |
| 292 | 299 |
| 293 #endif // CC_RESOURCE_PROVIDER_H_ | 300 #endif // CC_RESOURCE_PROVIDER_H_ |
| OLD | NEW |