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

Side by Side Diff: cc/resource_provider.h

Issue 11439026: Revert 171403 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years 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 | « cc/renderer.h ('k') | cc/resource_provider.cc » ('j') | no next file with comments »
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"
11 #include "base/threading/thread_checker.h" 11 #include "base/threading/thread_checker.h"
12 #include "cc/cc_export.h" 12 #include "cc/cc_export.h"
13 #include "cc/output_surface.h" 13 #include "cc/graphics_context.h"
14 #include "cc/texture_copier.h" 14 #include "cc/texture_copier.h"
15 #include "cc/transferable_resource.h" 15 #include "cc/transferable_resource.h"
16 #include "third_party/khronos/GLES2/gl2.h" 16 #include "third_party/khronos/GLES2/gl2.h"
17 #include "third_party/skia/include/core/SkBitmap.h" 17 #include "third_party/skia/include/core/SkBitmap.h"
18 #include "third_party/skia/include/core/SkCanvas.h" 18 #include "third_party/skia/include/core/SkCanvas.h"
19 #include "ui/gfx/size.h" 19 #include "ui/gfx/size.h"
20 #include <deque> 20 #include <deque>
21 #include <vector> 21 #include <vector>
22 22
23 namespace WebKit { 23 namespace WebKit {
(...skipping 15 matching lines...) Expand all
39 public: 39 public:
40 typedef unsigned ResourceId; 40 typedef unsigned ResourceId;
41 typedef std::vector<ResourceId> ResourceIdArray; 41 typedef std::vector<ResourceId> ResourceIdArray;
42 typedef base::hash_map<ResourceId, ResourceId> ResourceIdMap; 42 typedef base::hash_map<ResourceId, ResourceId> ResourceIdMap;
43 enum TextureUsageHint { TextureUsageAny, TextureUsageFramebuffer }; 43 enum TextureUsageHint { TextureUsageAny, TextureUsageFramebuffer };
44 enum ResourceType { 44 enum ResourceType {
45 GLTexture = 1, 45 GLTexture = 1,
46 Bitmap, 46 Bitmap,
47 }; 47 };
48 48
49 static scoped_ptr<ResourceProvider> create(OutputSurface*); 49 static scoped_ptr<ResourceProvider> create(GraphicsContext*);
50 50
51 virtual ~ResourceProvider(); 51 virtual ~ResourceProvider();
52 52
53 WebKit::WebGraphicsContext3D* graphicsContext3D(); 53 WebKit::WebGraphicsContext3D* graphicsContext3D();
54 TextureCopier* textureCopier() const { return m_textureCopier.get(); } 54 TextureCopier* textureCopier() const { return m_textureCopier.get(); }
55 int maxTextureSize() const { return m_maxTextureSize; } 55 int maxTextureSize() const { return m_maxTextureSize; }
56 unsigned numResources() const { return m_resources.size(); } 56 unsigned numResources() const { return m_resources.size(); }
57 57
58 // Checks whether a resource is in use by a consumer. 58 // Checks whether a resource is in use by a consumer.
59 bool inUseByConsumer(ResourceId); 59 bool inUseByConsumer(ResourceId);
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 struct Child { 250 struct Child {
251 Child(); 251 Child();
252 ~Child(); 252 ~Child();
253 253
254 int pool; 254 int pool;
255 ResourceIdMap childToParentMap; 255 ResourceIdMap childToParentMap;
256 ResourceIdMap parentToChildMap; 256 ResourceIdMap parentToChildMap;
257 }; 257 };
258 typedef base::hash_map<int, Child> ChildMap; 258 typedef base::hash_map<int, Child> ChildMap;
259 259
260 explicit ResourceProvider(OutputSurface*); 260 explicit ResourceProvider(GraphicsContext*);
261 bool initialize(); 261 bool initialize();
262 262
263 const Resource* lockForRead(ResourceId); 263 const Resource* lockForRead(ResourceId);
264 void unlockForRead(ResourceId); 264 void unlockForRead(ResourceId);
265 const Resource* lockForWrite(ResourceId); 265 const Resource* lockForWrite(ResourceId);
266 void unlockForWrite(ResourceId); 266 void unlockForWrite(ResourceId);
267 static void populateSkBitmapWithResource(SkBitmap*, const Resource*); 267 static void populateSkBitmapWithResource(SkBitmap*, const Resource*);
268 268
269 bool transferResource(WebKit::WebGraphicsContext3D*, ResourceId, Transferabl eResource*); 269 bool transferResource(WebKit::WebGraphicsContext3D*, ResourceId, Transferabl eResource*);
270 void deleteResourceInternal(ResourceMap::iterator it); 270 void deleteResourceInternal(ResourceMap::iterator it);
271 271
272 OutputSurface* m_outputSurface; 272 GraphicsContext* m_context;
273 ResourceId m_nextId; 273 ResourceId m_nextId;
274 ResourceMap m_resources; 274 ResourceMap m_resources;
275 int m_nextChild; 275 int m_nextChild;
276 ChildMap m_children; 276 ChildMap m_children;
277 277
278 ResourceType m_defaultResourceType; 278 ResourceType m_defaultResourceType;
279 bool m_useTextureStorageExt; 279 bool m_useTextureStorageExt;
280 bool m_useTextureUsageHint; 280 bool m_useTextureUsageHint;
281 bool m_useShallowFlush; 281 bool m_useShallowFlush;
282 scoped_ptr<TextureUploader> m_textureUploader; 282 scoped_ptr<TextureUploader> m_textureUploader;
283 scoped_ptr<AcceleratedTextureCopier> m_textureCopier; 283 scoped_ptr<AcceleratedTextureCopier> m_textureCopier;
284 int m_maxTextureSize; 284 int m_maxTextureSize;
285 285
286 base::ThreadChecker m_threadChecker; 286 base::ThreadChecker m_threadChecker;
287 287
288 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); 288 DISALLOW_COPY_AND_ASSIGN(ResourceProvider);
289 }; 289 };
290 290
291 } 291 }
292 292
293 #endif // CC_RESOURCE_PROVIDER_H_ 293 #endif // CC_RESOURCE_PROVIDER_H_
OLDNEW
« no previous file with comments | « cc/renderer.h ('k') | cc/resource_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698