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

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: Rename to GaneshContextProvider 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>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/hash_tables.h" 14 #include "base/hash_tables.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/threading/thread_checker.h" 16 #include "base/threading/thread_checker.h"
17 #include "cc/cc_export.h" 17 #include "cc/cc_export.h"
18 #include "cc/output_surface.h" 18 #include "cc/output_surface.h"
19 #include "cc/texture_copier.h" 19 #include "cc/texture_copier.h"
20 #include "cc/texture_mailbox.h" 20 #include "cc/texture_mailbox.h"
21 #include "cc/transferable_resource.h" 21 #include "cc/transferable_resource.h"
22 #include "third_party/khronos/GLES2/gl2.h" 22 #include "third_party/khronos/GLES2/gl2.h"
23 #include "third_party/skia/include/core/SkBitmap.h" 23 #include "third_party/skia/include/core/SkBitmap.h"
24 #include "third_party/skia/include/core/SkCanvas.h" 24 #include "third_party/skia/include/core/SkCanvas.h"
25 #include "ui/gfx/size.h" 25 #include "ui/gfx/size.h"
26 26
27 class GrContext;
28
27 namespace WebKit { 29 namespace WebKit {
28 class WebGraphicsContext3D; 30 class WebGraphicsContext3D;
29 } 31 }
30 32
31 namespace gfx { 33 namespace gfx {
32 class Rect; 34 class Rect;
33 class Vector2d; 35 class Vector2d;
34 } 36 }
35 37
36 namespace cc { 38 namespace cc {
37 39
40 class GaneshContextProvider;
38 class TextureUploader; 41 class TextureUploader;
39 42
40 // This class is not thread-safe and can only be called from the thread it was 43 // This class is not thread-safe and can only be called from the thread it was
41 // created on (in practice, the impl thread). 44 // created on (in practice, the impl thread).
42 class CC_EXPORT ResourceProvider { 45 class CC_EXPORT ResourceProvider {
43 public: 46 public:
44 typedef unsigned ResourceId; 47 typedef unsigned ResourceId;
45 typedef std::vector<ResourceId> ResourceIdArray; 48 typedef std::vector<ResourceId> ResourceIdArray;
46 typedef base::hash_map<ResourceId, ResourceId> ResourceIdMap; 49 typedef base::hash_map<ResourceId, ResourceId> ResourceIdMap;
47 enum TextureUsageHint { 50 enum TextureUsageHint {
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 // until this fence has passed. 257 // until this fence has passed.
255 void setReadLockFence(scoped_refptr<Fence> fence) { m_currentReadLockFence = fence; } 258 void setReadLockFence(scoped_refptr<Fence> fence) { m_currentReadLockFence = fence; }
256 Fence* getReadLockFence() { return m_currentReadLockFence; } 259 Fence* getReadLockFence() { return m_currentReadLockFence; }
257 260
258 // Enable read lock fences for a specific resource. 261 // Enable read lock fences for a specific resource.
259 void enableReadLockFences(ResourceProvider::ResourceId, bool enable); 262 void enableReadLockFences(ResourceProvider::ResourceId, bool enable);
260 263
261 // Indicates if we can currently lock this resource for write. 264 // Indicates if we can currently lock this resource for write.
262 bool canLockForWrite(ResourceId); 265 bool canLockForWrite(ResourceId);
263 266
267 GaneshContextProvider* ganeshContextProvider() { return m_ganeshContextProvi der.get(); }
268 void setGaneshContexts(WebKit::WebGraphicsContext3D* context3d, GrContext* g rContext);
269
264 private: 270 private:
265 struct Resource { 271 struct Resource {
266 Resource(); 272 Resource();
267 ~Resource(); 273 ~Resource();
268 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);
269 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);
270 276
271 unsigned glId; 277 unsigned glId;
272 // Pixel buffer used for set pixels without unnecessary copying. 278 // Pixel buffer used for set pixels without unnecessary copying.
273 unsigned glPixelBufferId; 279 unsigned glPixelBufferId;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 331
326 ResourceType m_defaultResourceType; 332 ResourceType m_defaultResourceType;
327 bool m_useTextureStorageExt; 333 bool m_useTextureStorageExt;
328 bool m_useTextureUsageHint; 334 bool m_useTextureUsageHint;
329 bool m_useShallowFlush; 335 bool m_useShallowFlush;
330 scoped_ptr<TextureUploader> m_textureUploader; 336 scoped_ptr<TextureUploader> m_textureUploader;
331 scoped_ptr<AcceleratedTextureCopier> m_textureCopier; 337 scoped_ptr<AcceleratedTextureCopier> m_textureCopier;
332 int m_maxTextureSize; 338 int m_maxTextureSize;
333 GLenum m_bestTextureFormat; 339 GLenum m_bestTextureFormat;
334 340
341 scoped_ptr<GaneshContextProvider> m_ganeshContextProvider;
342
335 base::ThreadChecker m_threadChecker; 343 base::ThreadChecker m_threadChecker;
336 344
337 scoped_refptr<Fence> m_currentReadLockFence; 345 scoped_refptr<Fence> m_currentReadLockFence;
338 346
339 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); 347 DISALLOW_COPY_AND_ASSIGN(ResourceProvider);
340 }; 348 };
341 349
342 } 350 }
343 351
344 #endif // CC_RESOURCE_PROVIDER_H_ 352 #endif // CC_RESOURCE_PROVIDER_H_
OLDNEW
« cc/gl_renderer.cc ('K') | « cc/render_surface_filters.cc ('k') | cc/resource_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698