| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 class CC_EXPORT ScopedReadLockGL { | 215 class CC_EXPORT ScopedReadLockGL { |
| 216 public: | 216 public: |
| 217 ScopedReadLockGL(ResourceProvider* resource_provider, | 217 ScopedReadLockGL(ResourceProvider* resource_provider, |
| 218 ResourceId resource_id); | 218 ResourceId resource_id); |
| 219 ~ScopedReadLockGL(); | 219 ~ScopedReadLockGL(); |
| 220 | 220 |
| 221 unsigned texture_id() const { return texture_id_; } | 221 unsigned texture_id() const { return texture_id_; } |
| 222 GLenum target() const { return target_; } | 222 GLenum target() const { return target_; } |
| 223 const gfx::Size& size() const { return size_; } | 223 const gfx::Size& size() const { return size_; } |
| 224 | 224 |
| 225 private: | 225 protected: |
| 226 ResourceProvider* resource_provider_; | 226 ResourceProvider* resource_provider_; |
| 227 ResourceId resource_id_; | 227 ResourceId resource_id_; |
| 228 unsigned texture_id_; | 228 unsigned texture_id_; |
| 229 GLenum target_; | 229 GLenum target_; |
| 230 gfx::Size size_; | 230 gfx::Size size_; |
| 231 | 231 |
| 232 private: |
| 232 DISALLOW_COPY_AND_ASSIGN(ScopedReadLockGL); | 233 DISALLOW_COPY_AND_ASSIGN(ScopedReadLockGL); |
| 233 }; | 234 }; |
| 234 | 235 |
| 235 class CC_EXPORT ScopedSamplerGL { | 236 class CC_EXPORT ScopedSamplerGL { |
| 236 public: | 237 public: |
| 237 ScopedSamplerGL(ResourceProvider* resource_provider, | 238 ScopedSamplerGL(ResourceProvider* resource_provider, |
| 238 ResourceId resource_id, | 239 ResourceId resource_id, |
| 239 GLenum filter); | 240 GLenum filter); |
| 240 ScopedSamplerGL(ResourceProvider* resource_provider, | 241 ScopedSamplerGL(ResourceProvider* resource_provider, |
| 241 ResourceId resource_id, | 242 ResourceId resource_id, |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 bool valid() const { return !!sk_bitmap_.getPixels(); } | 340 bool valid() const { return !!sk_bitmap_.getPixels(); } |
| 340 | 341 |
| 341 private: | 342 private: |
| 342 ResourceProvider* resource_provider_; | 343 ResourceProvider* resource_provider_; |
| 343 ResourceId resource_id_; | 344 ResourceId resource_id_; |
| 344 SkBitmap sk_bitmap_; | 345 SkBitmap sk_bitmap_; |
| 345 | 346 |
| 346 DISALLOW_COPY_AND_ASSIGN(ScopedReadLockSoftware); | 347 DISALLOW_COPY_AND_ASSIGN(ScopedReadLockSoftware); |
| 347 }; | 348 }; |
| 348 | 349 |
| 350 class CC_EXPORT ScopedReadLockSkImage { |
| 351 public: |
| 352 ScopedReadLockSkImage(ResourceProvider* resource_provider, |
| 353 ResourceId resource_id); |
| 354 ~ScopedReadLockSkImage(); |
| 355 |
| 356 const SkImage* sk_image() const { return sk_image_.get(); } |
| 357 |
| 358 bool valid() const { return !!sk_image_; } |
| 359 |
| 360 private: |
| 361 ResourceProvider* resource_provider_; |
| 362 ResourceId resource_id_; |
| 363 sk_sp<SkImage> sk_image_; |
| 364 |
| 365 DISALLOW_COPY_AND_ASSIGN(ScopedReadLockSkImage); |
| 366 }; |
| 367 |
| 349 class CC_EXPORT ScopedWriteLockSoftware { | 368 class CC_EXPORT ScopedWriteLockSoftware { |
| 350 public: | 369 public: |
| 351 ScopedWriteLockSoftware(ResourceProvider* resource_provider, | 370 ScopedWriteLockSoftware(ResourceProvider* resource_provider, |
| 352 ResourceId resource_id); | 371 ResourceId resource_id); |
| 353 ~ScopedWriteLockSoftware(); | 372 ~ScopedWriteLockSoftware(); |
| 354 | 373 |
| 355 SkBitmap& sk_bitmap() { return sk_bitmap_; } | 374 SkBitmap& sk_bitmap() { return sk_bitmap_; } |
| 356 bool valid() const { return !!sk_bitmap_.getPixels(); } | 375 bool valid() const { return !!sk_bitmap_.getPixels(); } |
| 357 | 376 |
| 358 private: | 377 private: |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 // A process-unique ID used for disambiguating memory dumps from different | 700 // A process-unique ID used for disambiguating memory dumps from different |
| 682 // resource providers. | 701 // resource providers. |
| 683 int tracing_id_; | 702 int tracing_id_; |
| 684 | 703 |
| 685 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 704 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
| 686 }; | 705 }; |
| 687 | 706 |
| 688 } // namespace cc | 707 } // namespace cc |
| 689 | 708 |
| 690 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 709 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| OLD | NEW |