| OLD | NEW |
| 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_RESOURCES_RESOURCE_PROVIDER_H_ | 5 #ifndef CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| 6 #define CC_RESOURCES_RESOURCE_PROVIDER_H_ | 6 #define CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 typedef base::hash_map<ResourceId, ResourceId> ResourceIdMap; | 48 typedef base::hash_map<ResourceId, ResourceId> ResourceIdMap; |
| 49 enum TextureUsageHint { | 49 enum TextureUsageHint { |
| 50 TextureUsageAny, | 50 TextureUsageAny, |
| 51 TextureUsageFramebuffer, | 51 TextureUsageFramebuffer, |
| 52 }; | 52 }; |
| 53 enum ResourceType { | 53 enum ResourceType { |
| 54 GLTexture = 1, | 54 GLTexture = 1, |
| 55 Bitmap, | 55 Bitmap, |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 static scoped_ptr<ResourceProvider> Create(OutputSurface* output_surface); | 58 static scoped_ptr<ResourceProvider> Create(OutputSurface* output_surface, |
| 59 int highp_threshold_min); |
| 59 | 60 |
| 60 virtual ~ResourceProvider(); | 61 virtual ~ResourceProvider(); |
| 61 | 62 |
| 62 WebKit::WebGraphicsContext3D* GraphicsContext3D(); | 63 WebKit::WebGraphicsContext3D* GraphicsContext3D(); |
| 63 TextureCopier* texture_copier() const { return texture_copier_.get(); } | 64 TextureCopier* texture_copier() const { return texture_copier_.get(); } |
| 64 int max_texture_size() const { return max_texture_size_; } | 65 int max_texture_size() const { return max_texture_size_; } |
| 65 GLenum best_texture_format() const { return best_texture_format_; } | 66 GLenum best_texture_format() const { return best_texture_format_; } |
| 66 unsigned num_resources() const { return resources_.size(); } | 67 unsigned num_resources() const { return resources_.size(); } |
| 67 | 68 |
| 68 // Checks whether a resource is in use by a consumer. | 69 // Checks whether a resource is in use by a consumer. |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 ResourceIdMap parent_to_child_map; | 350 ResourceIdMap parent_to_child_map; |
| 350 }; | 351 }; |
| 351 typedef base::hash_map<int, Child> ChildMap; | 352 typedef base::hash_map<int, Child> ChildMap; |
| 352 | 353 |
| 353 bool ReadLockFenceHasPassed(Resource* resource) { | 354 bool ReadLockFenceHasPassed(Resource* resource) { |
| 354 return !resource->read_lock_fence || | 355 return !resource->read_lock_fence || |
| 355 resource->read_lock_fence->HasPassed(); | 356 resource->read_lock_fence->HasPassed(); |
| 356 } | 357 } |
| 357 | 358 |
| 358 explicit ResourceProvider(OutputSurface* output_surface); | 359 explicit ResourceProvider(OutputSurface* output_surface); |
| 359 bool Initialize(); | 360 bool Initialize(int highp_threshold_min); |
| 360 | 361 |
| 361 const Resource* LockForRead(ResourceId id); | 362 const Resource* LockForRead(ResourceId id); |
| 362 void UnlockForRead(ResourceId id); | 363 void UnlockForRead(ResourceId id); |
| 363 const Resource* LockForWrite(ResourceId id); | 364 const Resource* LockForWrite(ResourceId id); |
| 364 void UnlockForWrite(ResourceId id); | 365 void UnlockForWrite(ResourceId id); |
| 365 static void PopulateSkBitmapWithResource(SkBitmap* sk_bitmap, | 366 static void PopulateSkBitmapWithResource(SkBitmap* sk_bitmap, |
| 366 const Resource* resource); | 367 const Resource* resource); |
| 367 | 368 |
| 368 bool TransferResource(WebKit::WebGraphicsContext3D* context, | 369 bool TransferResource(WebKit::WebGraphicsContext3D* context, |
| 369 ResourceId id, | 370 ResourceId id, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 391 base::ThreadChecker thread_checker_; | 392 base::ThreadChecker thread_checker_; |
| 392 | 393 |
| 393 scoped_refptr<Fence> current_read_lock_fence_; | 394 scoped_refptr<Fence> current_read_lock_fence_; |
| 394 | 395 |
| 395 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 396 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
| 396 }; | 397 }; |
| 397 | 398 |
| 398 } // namespace cc | 399 } // namespace cc |
| 399 | 400 |
| 400 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 401 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| OLD | NEW |