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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 | 305 |
306 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware); | 306 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware); |
307 }; | 307 }; |
308 | 308 |
309 class CC_EXPORT ScopedWriteLockGpuMemoryBuffer { | 309 class CC_EXPORT ScopedWriteLockGpuMemoryBuffer { |
310 public: | 310 public: |
311 ScopedWriteLockGpuMemoryBuffer(ResourceProvider* resource_provider, | 311 ScopedWriteLockGpuMemoryBuffer(ResourceProvider* resource_provider, |
312 ResourceProvider::ResourceId resource_id); | 312 ResourceProvider::ResourceId resource_id); |
313 ~ScopedWriteLockGpuMemoryBuffer(); | 313 ~ScopedWriteLockGpuMemoryBuffer(); |
314 | 314 |
315 gfx::GpuMemoryBuffer* gpu_memory_buffer() { return gpu_memory_buffer_; } | 315 gfx::GpuMemoryBuffer* GetGpuMemoryBuffer(); |
316 | 316 |
317 private: | 317 private: |
318 ResourceProvider* resource_provider_; | 318 ResourceProvider* resource_provider_; |
319 ResourceProvider::ResourceId resource_id_; | 319 ResourceProvider::ResourceId resource_id_; |
| 320 gfx::Size size_; |
| 321 ResourceFormat format_; |
320 gfx::GpuMemoryBuffer* gpu_memory_buffer_; | 322 gfx::GpuMemoryBuffer* gpu_memory_buffer_; |
321 | 323 |
322 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGpuMemoryBuffer); | 324 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGpuMemoryBuffer); |
323 }; | 325 }; |
324 | 326 |
325 class CC_EXPORT ScopedWriteLockGr { | 327 class CC_EXPORT ScopedWriteLockGr { |
326 public: | 328 public: |
327 ScopedWriteLockGr(ResourceProvider* resource_provider, | 329 ScopedWriteLockGr(ResourceProvider* resource_provider, |
328 ResourceProvider::ResourceId resource_id); | 330 ResourceProvider::ResourceId resource_id); |
329 ~ScopedWriteLockGr(); | 331 ~ScopedWriteLockGr(); |
330 | 332 |
331 SkSurface* sk_surface() { return sk_surface_; } | 333 SkSurface* sk_surface() { return sk_surface_.get(); } |
332 | 334 |
333 private: | 335 private: |
334 ResourceProvider* resource_provider_; | 336 ResourceProvider* resource_provider_; |
335 ResourceProvider::ResourceId resource_id_; | 337 ResourceProvider::ResourceId resource_id_; |
336 SkSurface* sk_surface_; | 338 skia::RefPtr<SkSurface> sk_surface_; |
337 | 339 |
338 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGr); | 340 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGr); |
339 }; | 341 }; |
340 | 342 |
341 class Fence : public base::RefCounted<Fence> { | 343 class Fence : public base::RefCounted<Fence> { |
342 public: | 344 public: |
343 Fence() {} | 345 Fence() {} |
344 | 346 |
345 virtual void Set() = 0; | 347 virtual void Set() = 0; |
346 virtual bool HasPassed() = 0; | 348 virtual bool HasPassed() = 0; |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 int highp_threshold_min, | 491 int highp_threshold_min, |
490 bool use_rgba_4444_texture_format, | 492 bool use_rgba_4444_texture_format, |
491 size_t id_allocation_chunk_size, | 493 size_t id_allocation_chunk_size, |
492 bool use_distance_field_text); | 494 bool use_distance_field_text); |
493 | 495 |
494 void CleanUpGLIfNeeded(); | 496 void CleanUpGLIfNeeded(); |
495 | 497 |
496 Resource* GetResource(ResourceId id); | 498 Resource* GetResource(ResourceId id); |
497 const Resource* LockForRead(ResourceId id); | 499 const Resource* LockForRead(ResourceId id); |
498 void UnlockForRead(ResourceId id); | 500 void UnlockForRead(ResourceId id); |
499 const Resource* LockForWrite(ResourceId id); | 501 Resource* LockForWrite(ResourceId id); |
500 void UnlockForWrite(ResourceId id); | 502 Resource* UnlockForWrite(ResourceId id); |
501 const Resource* LockForWriteToGpuMemoryBuffer(ResourceId id); | |
502 void UnlockForWriteToGpuMemoryBuffer(ResourceId id); | |
503 const Resource* LockForWriteToSkSurface(ResourceId id); | |
504 void UnlockForWriteToSkSurface(ResourceId id); | |
505 | 503 |
506 static void PopulateSkBitmapWithResource(SkBitmap* sk_bitmap, | 504 static void PopulateSkBitmapWithResource(SkBitmap* sk_bitmap, |
507 const Resource* resource); | 505 const Resource* resource); |
508 | 506 |
509 void TransferResource(gpu::gles2::GLES2Interface* gl, | 507 void TransferResource(gpu::gles2::GLES2Interface* gl, |
510 ResourceId id, | 508 ResourceId id, |
511 TransferableResource* resource); | 509 TransferableResource* resource); |
512 enum DeleteStyle { | 510 enum DeleteStyle { |
513 Normal, | 511 Normal, |
514 ForShutdown, | 512 ForShutdown, |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 return format_gl_data_format[format]; | 610 return format_gl_data_format[format]; |
613 } | 611 } |
614 | 612 |
615 inline GLenum GLInternalFormat(ResourceFormat format) { | 613 inline GLenum GLInternalFormat(ResourceFormat format) { |
616 return GLDataFormat(format); | 614 return GLDataFormat(format); |
617 } | 615 } |
618 | 616 |
619 } // namespace cc | 617 } // namespace cc |
620 | 618 |
621 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 619 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
OLD | NEW |