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

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: 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 {
(...skipping 19 matching lines...) Expand all
56 static scoped_ptr<ResourceProvider> create(OutputSurface*); 58 static scoped_ptr<ResourceProvider> create(OutputSurface*);
57 59
58 virtual ~ResourceProvider(); 60 virtual ~ResourceProvider();
59 61
60 WebKit::WebGraphicsContext3D* graphicsContext3D(); 62 WebKit::WebGraphicsContext3D* graphicsContext3D();
61 TextureCopier* textureCopier() const { return m_textureCopier.get(); } 63 TextureCopier* textureCopier() const { return m_textureCopier.get(); }
62 int maxTextureSize() const { return m_maxTextureSize; } 64 int maxTextureSize() const { return m_maxTextureSize; }
63 GLenum bestTextureFormat() const { return m_bestTextureFormat; } 65 GLenum bestTextureFormat() const { return m_bestTextureFormat; }
64 unsigned numResources() const { return m_resources.size(); } 66 unsigned numResources() const { return m_resources.size(); }
65 67
68 WebKit::WebGraphicsContext3D* offscreenGraphicsContext3d() { return m_offscr eenContext3d; }
piman 2013/02/05 22:42:48 I don't think it belongs here, since it has nothin
danakj 2013/02/05 22:56:00 Oh, ya ok I'll give that a shot. The one problem I
69 GrContext* offscreenGrContext() { return m_offscreenGrContext; }
70
71 void setOffscreenContexts(WebKit::WebGraphicsContext3D* context,
72 GrContext* grContext)
73 {
74 m_offscreenContext3d = context;
75 m_offscreenGrContext = grContext;
76 }
77
78
66 // Checks whether a resource is in use by a consumer. 79 // Checks whether a resource is in use by a consumer.
67 bool inUseByConsumer(ResourceId); 80 bool inUseByConsumer(ResourceId);
68 81
69 82
70 // Producer interface. 83 // Producer interface.
71 84
72 void setDefaultResourceType(ResourceType type) { m_defaultResourceType = typ e; } 85 void setDefaultResourceType(ResourceType type) { m_defaultResourceType = typ e; }
73 ResourceType defaultResourceType() const { return m_defaultResourceType; } 86 ResourceType defaultResourceType() const { return m_defaultResourceType; }
74 ResourceType resourceType(ResourceId); 87 ResourceType resourceType(ResourceId);
75 88
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 void unlockForRead(ResourceId); 299 void unlockForRead(ResourceId);
287 const Resource* lockForWrite(ResourceId); 300 const Resource* lockForWrite(ResourceId);
288 void unlockForWrite(ResourceId); 301 void unlockForWrite(ResourceId);
289 static void populateSkBitmapWithResource(SkBitmap*, const Resource*); 302 static void populateSkBitmapWithResource(SkBitmap*, const Resource*);
290 303
291 bool transferResource(WebKit::WebGraphicsContext3D*, ResourceId, Transferabl eResource*); 304 bool transferResource(WebKit::WebGraphicsContext3D*, ResourceId, Transferabl eResource*);
292 void deleteResourceInternal(ResourceMap::iterator it); 305 void deleteResourceInternal(ResourceMap::iterator it);
293 void lazyAllocate(Resource*); 306 void lazyAllocate(Resource*);
294 307
295 OutputSurface* m_outputSurface; 308 OutputSurface* m_outputSurface;
309 WebKit::WebGraphicsContext3D* m_offscreenContext3d;
310 GrContext* m_offscreenGrContext;
296 ResourceId m_nextId; 311 ResourceId m_nextId;
297 ResourceMap m_resources; 312 ResourceMap m_resources;
298 int m_nextChild; 313 int m_nextChild;
299 ChildMap m_children; 314 ChildMap m_children;
300 315
301 ResourceType m_defaultResourceType; 316 ResourceType m_defaultResourceType;
302 bool m_useTextureStorageExt; 317 bool m_useTextureStorageExt;
303 bool m_useTextureUsageHint; 318 bool m_useTextureUsageHint;
304 bool m_useShallowFlush; 319 bool m_useShallowFlush;
305 scoped_ptr<TextureUploader> m_textureUploader; 320 scoped_ptr<TextureUploader> m_textureUploader;
306 scoped_ptr<AcceleratedTextureCopier> m_textureCopier; 321 scoped_ptr<AcceleratedTextureCopier> m_textureCopier;
307 int m_maxTextureSize; 322 int m_maxTextureSize;
308 GLenum m_bestTextureFormat; 323 GLenum m_bestTextureFormat;
309 324
310 base::ThreadChecker m_threadChecker; 325 base::ThreadChecker m_threadChecker;
311 326
312 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); 327 DISALLOW_COPY_AND_ASSIGN(ResourceProvider);
313 }; 328 };
314 329
315 } 330 }
316 331
317 #endif // CC_RESOURCE_PROVIDER_H_ 332 #endif // CC_RESOURCE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698