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

Side by Side Diff: cc/resource_provider.h

Issue 12212007: cc: Route offscreen context creation for compositor to the browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix typo Created 7 years, 10 months 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
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 <deque> 8 #include <deque>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 17 matching lines...) Expand all
28 class WebGraphicsContext3D; 28 class WebGraphicsContext3D;
29 } 29 }
30 30
31 namespace gfx { 31 namespace gfx {
32 class Rect; 32 class Rect;
33 class Vector2d; 33 class Vector2d;
34 } 34 }
35 35
36 namespace cc { 36 namespace cc {
37 37
38 class ContextProvider;
38 class TextureUploader; 39 class TextureUploader;
39 40
40 // This class is not thread-safe and can only be called from the thread it was 41 // This class is not thread-safe and can only be called from the thread it was
41 // created on (in practice, the impl thread). 42 // created on (in practice, the impl thread).
42 class CC_EXPORT ResourceProvider { 43 class CC_EXPORT ResourceProvider {
43 public: 44 public:
44 typedef unsigned ResourceId; 45 typedef unsigned ResourceId;
45 typedef std::vector<ResourceId> ResourceIdArray; 46 typedef std::vector<ResourceId> ResourceIdArray;
46 typedef base::hash_map<ResourceId, ResourceId> ResourceIdMap; 47 typedef base::hash_map<ResourceId, ResourceId> ResourceIdMap;
47 enum TextureUsageHint { 48 enum TextureUsageHint {
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 // until this fence has passed. 257 // until this fence has passed.
257 void setReadLockFence(scoped_refptr<Fence> fence) { m_currentReadLockFence = fence; } 258 void setReadLockFence(scoped_refptr<Fence> fence) { m_currentReadLockFence = fence; }
258 Fence* getReadLockFence() { return m_currentReadLockFence; } 259 Fence* getReadLockFence() { return m_currentReadLockFence; }
259 260
260 // Enable read lock fences for a specific resource. 261 // Enable read lock fences for a specific resource.
261 void enableReadLockFences(ResourceProvider::ResourceId, bool enable); 262 void enableReadLockFences(ResourceProvider::ResourceId, bool enable);
262 263
263 // Indicates if we can currently lock this resource for write. 264 // Indicates if we can currently lock this resource for write.
264 bool canLockForWrite(ResourceId); 265 bool canLockForWrite(ResourceId);
265 266
267 cc::ContextProvider* offscreenContextProvider() { return m_offscreenContextP rovider.get(); }
268 void setOffscreenContextProvider(scoped_refptr<cc::ContextProvider> offscree nContextProvider);
269
266 private: 270 private:
267 struct Resource { 271 struct Resource {
268 Resource(); 272 Resource();
269 ~Resource(); 273 ~Resource();
270 Resource(unsigned textureId, const gfx::Size& size, GLenum format, GLenu m filter); 274 Resource(unsigned textureId, const gfx::Size& size, GLenum format, GLenu m filter);
271 Resource(uint8_t* pixels, const gfx::Size& size, GLenum format, GLenum f ilter); 275 Resource(uint8_t* pixels, const gfx::Size& size, GLenum format, GLenum f ilter);
272 276
273 unsigned glId; 277 unsigned glId;
274 // Pixel buffer used for set pixels without unnecessary copying. 278 // Pixel buffer used for set pixels without unnecessary copying.
275 unsigned glPixelBufferId; 279 unsigned glPixelBufferId;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 331
328 ResourceType m_defaultResourceType; 332 ResourceType m_defaultResourceType;
329 bool m_useTextureStorageExt; 333 bool m_useTextureStorageExt;
330 bool m_useTextureUsageHint; 334 bool m_useTextureUsageHint;
331 bool m_useShallowFlush; 335 bool m_useShallowFlush;
332 scoped_ptr<TextureUploader> m_textureUploader; 336 scoped_ptr<TextureUploader> m_textureUploader;
333 scoped_ptr<AcceleratedTextureCopier> m_textureCopier; 337 scoped_ptr<AcceleratedTextureCopier> m_textureCopier;
334 int m_maxTextureSize; 338 int m_maxTextureSize;
335 GLenum m_bestTextureFormat; 339 GLenum m_bestTextureFormat;
336 340
341 scoped_refptr<cc::ContextProvider> m_offscreenContextProvider;
342
337 base::ThreadChecker m_threadChecker; 343 base::ThreadChecker m_threadChecker;
338 344
339 scoped_refptr<Fence> m_currentReadLockFence; 345 scoped_refptr<Fence> m_currentReadLockFence;
340 346
341 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); 347 DISALLOW_COPY_AND_ASSIGN(ResourceProvider);
342 }; 348 };
343 349
344 } 350 }
345 351
346 #endif // CC_RESOURCE_PROVIDER_H_ 352 #endif // CC_RESOURCE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698