Chromium Code Reviews| 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 202 void acquirePixelBuffer(ResourceId id); | 202 void acquirePixelBuffer(ResourceId id); |
| 203 void releasePixelBuffer(ResourceId id); | 203 void releasePixelBuffer(ResourceId id); |
| 204 | 204 |
| 205 // Map/unmap the acquired pixel buffer. | 205 // Map/unmap the acquired pixel buffer. |
| 206 uint8_t* mapPixelBuffer(ResourceId id); | 206 uint8_t* mapPixelBuffer(ResourceId id); |
| 207 void unmapPixelBuffer(ResourceId id); | 207 void unmapPixelBuffer(ResourceId id); |
| 208 | 208 |
| 209 // Update pixels from acquired pixel buffer. | 209 // Update pixels from acquired pixel buffer. |
| 210 void setPixelsFromBuffer(ResourceId id); | 210 void setPixelsFromBuffer(ResourceId id); |
| 211 | 211 |
| 212 // Asynchronously update pixels from acquired pixel buffer. | |
| 213 void beginSetPixels(ResourceId id); | |
|
piman
2012/11/27 00:40:01
naming nit: I would name this something like setPi
| |
| 214 bool didSetPixelsComplete(ResourceId id); | |
| 215 void abortSetPixels(ResourceId id); | |
| 216 | |
| 212 private: | 217 private: |
| 213 struct Resource { | 218 struct Resource { |
| 214 Resource(); | 219 Resource(); |
| 215 Resource(unsigned textureId, int pool, const gfx::Size& size, GLenum for mat); | 220 Resource(unsigned textureId, int pool, const gfx::Size& size, GLenum for mat); |
| 216 Resource(uint8_t* pixels, int pool, const gfx::Size& size, GLenum format ); | 221 Resource(uint8_t* pixels, int pool, const gfx::Size& size, GLenum format ); |
| 217 | 222 |
| 218 unsigned glId; | 223 unsigned glId; |
| 219 // Pixel buffer used for set pixels without unnecessary copying. | 224 // Pixel buffer used for set pixels without unnecessary copying. |
| 220 unsigned glPixelBufferId; | 225 unsigned glPixelBufferId; |
| 226 // Query used to determine when asynchronous set pixels complete. | |
| 227 unsigned glUploadQueryId; | |
| 221 Mailbox mailbox; | 228 Mailbox mailbox; |
| 222 uint8_t* pixels; | 229 uint8_t* pixels; |
| 223 uint8_t* pixelBuffer; | 230 uint8_t* pixelBuffer; |
| 224 int pool; | 231 int pool; |
| 225 int lockForReadCount; | 232 int lockForReadCount; |
| 226 bool lockedForWrite; | 233 bool lockedForWrite; |
| 227 bool external; | 234 bool external; |
| 228 bool exported; | 235 bool exported; |
| 229 bool markedForDeletion; | 236 bool markedForDeletion; |
| 230 gfx::Size size; | 237 gfx::Size size; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 269 int m_maxTextureSize; | 276 int m_maxTextureSize; |
| 270 | 277 |
| 271 base::ThreadChecker m_threadChecker; | 278 base::ThreadChecker m_threadChecker; |
| 272 | 279 |
| 273 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 280 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
| 274 }; | 281 }; |
| 275 | 282 |
| 276 } | 283 } |
| 277 | 284 |
| 278 #endif // CC_RESOURCE_PROVIDER_H_ | 285 #endif // CC_RESOURCE_PROVIDER_H_ |
| OLD | NEW |