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

Side by Side Diff: cc/resource_provider.h

Issue 11412043: cc: Add asynchronous setPixel interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Lock for write until asynchronous setPixels complete. 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 | « no previous file | cc/resource_provider.cc » ('j') | cc/resource_provider.cc » ('J')
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 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 190
191 private: 191 private:
192 ResourceProvider* m_resourceProvider; 192 ResourceProvider* m_resourceProvider;
193 ResourceProvider::ResourceId m_resourceId; 193 ResourceProvider::ResourceId m_resourceId;
194 SkBitmap m_skBitmap; 194 SkBitmap m_skBitmap;
195 scoped_ptr<SkCanvas> m_skCanvas; 195 scoped_ptr<SkCanvas> m_skCanvas;
196 196
197 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware); 197 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware);
198 }; 198 };
199 199
200 // This set of functions can be used to asynchronously set pixel values
201 // for a resource.
202 void acquirePixelBuffer(ResourceId id);
203 void releasePixelBuffer(ResourceId id);
204 uint8_t* mapPixelBuffer(ResourceId id);
205 void unmapPixelBuffer(ResourceId id);
206 void beginSetPixels(ResourceId id);
207 bool didSetPixelsComplete(ResourceId id);
208
200 private: 209 private:
201 struct Resource { 210 struct Resource {
202 Resource(); 211 Resource();
203 Resource(unsigned textureId, int pool, const gfx::Size& size, GLenum for mat); 212 Resource(unsigned textureId, int pool, const gfx::Size& size, GLenum for mat);
204 Resource(uint8_t* pixels, int pool, const gfx::Size& size, GLenum format ); 213 Resource(uint8_t* pixels, int pool, const gfx::Size& size, GLenum format );
205 214
206 unsigned glId; 215 unsigned glId;
216 // Pixel buffer used for asynchronous set pixels.
217 unsigned glPixelBufferId;
218 // Query used to determine when asynchronous set pixels complete.
219 unsigned glUploadQueryId;
207 Mailbox mailbox; 220 Mailbox mailbox;
208 uint8_t* pixels; 221 uint8_t* pixels;
222 uint8_t* pixelBuffer;
209 int pool; 223 int pool;
210 int lockForReadCount; 224 int lockForReadCount;
211 bool lockedForWrite; 225 bool lockedForWrite;
212 bool external; 226 bool external;
213 bool exported; 227 bool exported;
214 bool markedForDeletion; 228 bool markedForDeletion;
215 gfx::Size size; 229 gfx::Size size;
216 GLenum format; 230 GLenum format;
217 ResourceType type; 231 ResourceType type;
218 }; 232 };
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 int m_maxTextureSize; 268 int m_maxTextureSize;
255 269
256 base::ThreadChecker m_threadChecker; 270 base::ThreadChecker m_threadChecker;
257 271
258 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); 272 DISALLOW_COPY_AND_ASSIGN(ResourceProvider);
259 }; 273 };
260 274
261 } 275 }
262 276
263 #endif // CC_RESOURCE_PROVIDER_H_ 277 #endif // CC_RESOURCE_PROVIDER_H_
OLDNEW
« no previous file with comments | « no previous file | cc/resource_provider.cc » ('j') | cc/resource_provider.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698