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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 Resource* InsertResource(ResourceId id, const Resource& resource); | 530 Resource* InsertResource(ResourceId id, const Resource& resource); |
531 Resource* GetResource(ResourceId id); | 531 Resource* GetResource(ResourceId id); |
532 const Resource* LockForRead(ResourceId id); | 532 const Resource* LockForRead(ResourceId id); |
533 void UnlockForRead(ResourceId id); | 533 void UnlockForRead(ResourceId id); |
534 Resource* LockForWrite(ResourceId id); | 534 Resource* LockForWrite(ResourceId id); |
535 void UnlockForWrite(Resource* resource); | 535 void UnlockForWrite(Resource* resource); |
536 | 536 |
537 static void PopulateSkBitmapWithResource(SkBitmap* sk_bitmap, | 537 static void PopulateSkBitmapWithResource(SkBitmap* sk_bitmap, |
538 const Resource* resource); | 538 const Resource* resource); |
539 | 539 |
| 540 // This creates the resource mailbox and also binds the texture if dirty. This |
| 541 // is meant to be called lazily internally and returns true if a mailbox |
| 542 // was created or if the resource was bound. |
| 543 bool CreateMailboxAndBindResource(gpu::gles2::GLES2Interface* gl, |
| 544 Resource* resource); |
| 545 |
540 void TransferResource(gpu::gles2::GLES2Interface* gl, | 546 void TransferResource(gpu::gles2::GLES2Interface* gl, |
541 ResourceId id, | 547 ResourceId id, |
542 TransferableResource* resource); | 548 TransferableResource* resource); |
543 enum DeleteStyle { | 549 enum DeleteStyle { |
544 NORMAL, | 550 NORMAL, |
545 FOR_SHUTDOWN, | 551 FOR_SHUTDOWN, |
546 }; | 552 }; |
547 void DeleteResourceInternal(ResourceMap::iterator it, DeleteStyle style); | 553 void DeleteResourceInternal(ResourceMap::iterator it, DeleteStyle style); |
548 void DeleteAndReturnUnusedResourcesToChild(ChildMap::iterator child_it, | 554 void DeleteAndReturnUnusedResourcesToChild(ChildMap::iterator child_it, |
549 DeleteStyle style, | 555 DeleteStyle style, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 // A process-unique ID used for disambiguating memory dumps from different | 605 // A process-unique ID used for disambiguating memory dumps from different |
600 // resource providers. | 606 // resource providers. |
601 int tracing_id_; | 607 int tracing_id_; |
602 | 608 |
603 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 609 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
604 }; | 610 }; |
605 | 611 |
606 } // namespace cc | 612 } // namespace cc |
607 | 613 |
608 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 614 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
OLD | NEW |