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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
296 ResourceProvider::ResourceId resource_id); | 296 ResourceProvider::ResourceId resource_id); |
297 ~ScopedWriteLockSoftware(); | 297 ~ScopedWriteLockSoftware(); |
298 | 298 |
299 SkCanvas* sk_canvas() { return sk_canvas_.get(); } | 299 SkCanvas* sk_canvas() { return sk_canvas_.get(); } |
300 bool valid() const { return !!sk_bitmap_.getPixels(); } | 300 bool valid() const { return !!sk_bitmap_.getPixels(); } |
301 | 301 |
302 private: | 302 private: |
303 ResourceProvider* resource_provider_; | 303 ResourceProvider* resource_provider_; |
304 ResourceProvider::Resource* resource_; | 304 ResourceProvider::Resource* resource_; |
305 SkBitmap sk_bitmap_; | 305 SkBitmap sk_bitmap_; |
306 scoped_ptr<SkCanvas> sk_canvas_; | 306 scoped_ptr<SkCanvas> sk_canvas_; |
reveman
2014/10/29 21:08:27
Add a ThreadChecker here too?
dshwang
2014/10/30 05:58:12
I added it although it can be checked in only dest
| |
307 | 307 |
308 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware); | 308 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware); |
309 }; | 309 }; |
310 | 310 |
311 class CC_EXPORT ScopedWriteLockGpuMemoryBuffer { | 311 class CC_EXPORT ScopedWriteLockGpuMemoryBuffer { |
312 public: | 312 public: |
313 ScopedWriteLockGpuMemoryBuffer(ResourceProvider* resource_provider, | 313 ScopedWriteLockGpuMemoryBuffer(ResourceProvider* resource_provider, |
314 ResourceProvider::ResourceId resource_id); | 314 ResourceProvider::ResourceId resource_id); |
315 ~ScopedWriteLockGpuMemoryBuffer(); | 315 ~ScopedWriteLockGpuMemoryBuffer(); |
316 | 316 |
317 gfx::GpuMemoryBuffer* GetGpuMemoryBuffer(); | 317 gfx::GpuMemoryBuffer* GetGpuMemoryBuffer(); |
318 | 318 |
319 private: | 319 private: |
320 ResourceProvider* resource_provider_; | 320 ResourceProvider* resource_provider_; |
321 ResourceProvider::Resource* resource_; | 321 ResourceProvider::Resource* resource_; |
322 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 322 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
323 gfx::GpuMemoryBuffer* gpu_memory_buffer_; | 323 gfx::GpuMemoryBuffer* gpu_memory_buffer_; |
324 gfx::Size size_; | 324 gfx::Size size_; |
325 ResourceFormat format_; | 325 ResourceFormat format_; |
326 #if DCHECK_IS_ON | |
reveman
2014/10/29 21:08:27
No need for DCHECK_IS_ON. base::ThreadChecker hand
dshwang
2014/10/30 05:58:12
Yes, thank you. Done.
| |
327 base::ThreadChecker thread_checker_; | |
328 #endif | |
326 | 329 |
327 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGpuMemoryBuffer); | 330 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGpuMemoryBuffer); |
328 }; | 331 }; |
329 | 332 |
330 class CC_EXPORT ScopedWriteLockGr { | 333 class CC_EXPORT ScopedWriteLockGr { |
331 public: | 334 public: |
332 ScopedWriteLockGr(ResourceProvider* resource_provider, | 335 ScopedWriteLockGr(ResourceProvider* resource_provider, |
333 ResourceProvider::ResourceId resource_id); | 336 ResourceProvider::ResourceId resource_id); |
334 ~ScopedWriteLockGr(); | 337 ~ScopedWriteLockGr(); |
335 | 338 |
336 SkSurface* GetSkSurface(bool use_distance_field_text); | 339 SkSurface* GetSkSurface(bool use_distance_field_text); |
337 | 340 |
338 private: | 341 private: |
339 ResourceProvider* resource_provider_; | 342 ResourceProvider* resource_provider_; |
340 ResourceProvider::Resource* resource_; | 343 ResourceProvider::Resource* resource_; |
344 #if DCHECK_IS_ON | |
reveman
2014/10/29 21:08:27
No need for DCHECK_IS_ON
| |
345 base::ThreadChecker thread_checker_; | |
346 #endif | |
341 | 347 |
342 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGr); | 348 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGr); |
343 }; | 349 }; |
344 | 350 |
345 class Fence : public base::RefCounted<Fence> { | 351 class Fence : public base::RefCounted<Fence> { |
346 public: | 352 public: |
347 Fence() {} | 353 Fence() {} |
348 | 354 |
349 virtual void Set() = 0; | 355 virtual void Set() = 0; |
350 virtual bool HasPassed() = 0; | 356 virtual bool HasPassed() = 0; |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
546 | 552 |
547 ResourceType default_resource_type_; | 553 ResourceType default_resource_type_; |
548 bool use_texture_storage_ext_; | 554 bool use_texture_storage_ext_; |
549 bool use_texture_format_bgra_; | 555 bool use_texture_format_bgra_; |
550 bool use_texture_usage_hint_; | 556 bool use_texture_usage_hint_; |
551 bool use_compressed_texture_etc1_; | 557 bool use_compressed_texture_etc1_; |
552 scoped_ptr<TextureUploader> texture_uploader_; | 558 scoped_ptr<TextureUploader> texture_uploader_; |
553 int max_texture_size_; | 559 int max_texture_size_; |
554 ResourceFormat best_texture_format_; | 560 ResourceFormat best_texture_format_; |
555 | 561 |
562 #if DCHECK_IS_ON | |
reveman
2014/10/29 21:08:27
No need for DCHECK_IS_ON
| |
556 base::ThreadChecker thread_checker_; | 563 base::ThreadChecker thread_checker_; |
564 #endif | |
557 | 565 |
558 scoped_refptr<Fence> current_read_lock_fence_; | 566 scoped_refptr<Fence> current_read_lock_fence_; |
559 bool use_rgba_4444_texture_format_; | 567 bool use_rgba_4444_texture_format_; |
560 | 568 |
561 const size_t id_allocation_chunk_size_; | 569 const size_t id_allocation_chunk_size_; |
562 scoped_ptr<IdAllocator> texture_id_allocator_; | 570 scoped_ptr<IdAllocator> texture_id_allocator_; |
563 scoped_ptr<IdAllocator> buffer_id_allocator_; | 571 scoped_ptr<IdAllocator> buffer_id_allocator_; |
564 | 572 |
565 bool use_sync_query_; | 573 bool use_sync_query_; |
566 | 574 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
612 return format_gl_data_format[format]; | 620 return format_gl_data_format[format]; |
613 } | 621 } |
614 | 622 |
615 inline GLenum GLInternalFormat(ResourceFormat format) { | 623 inline GLenum GLInternalFormat(ResourceFormat format) { |
616 return GLDataFormat(format); | 624 return GLDataFormat(format); |
617 } | 625 } |
618 | 626 |
619 } // namespace cc | 627 } // namespace cc |
620 | 628 |
621 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 629 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
OLD | NEW |