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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 Resource* InsertResource(ResourceId id, const Resource& resource); | 539 Resource* InsertResource(ResourceId id, const Resource& resource); |
540 Resource* GetResource(ResourceId id); | 540 Resource* GetResource(ResourceId id); |
541 const Resource* LockForRead(ResourceId id); | 541 const Resource* LockForRead(ResourceId id); |
542 void UnlockForRead(ResourceId id); | 542 void UnlockForRead(ResourceId id); |
543 Resource* LockForWrite(ResourceId id); | 543 Resource* LockForWrite(ResourceId id); |
544 void UnlockForWrite(Resource* resource); | 544 void UnlockForWrite(Resource* resource); |
545 | 545 |
546 static void PopulateSkBitmapWithResource(SkBitmap* sk_bitmap, | 546 static void PopulateSkBitmapWithResource(SkBitmap* sk_bitmap, |
547 const Resource* resource); | 547 const Resource* resource); |
548 | 548 |
| 549 // This creates the resource mailbox and also binds the texture if dirty. This |
| 550 // is meant to be called lazily internally and returns true if a mailbox |
| 551 // was created or if the resource was bound. |
| 552 bool CreateMailboxAndBindResource(gpu::gles2::GLES2Interface* gl, |
| 553 Resource* resource); |
| 554 |
549 void TransferResource(gpu::gles2::GLES2Interface* gl, | 555 void TransferResource(gpu::gles2::GLES2Interface* gl, |
550 ResourceId id, | 556 ResourceId id, |
551 TransferableResource* resource); | 557 TransferableResource* resource); |
552 enum DeleteStyle { | 558 enum DeleteStyle { |
553 NORMAL, | 559 NORMAL, |
554 FOR_SHUTDOWN, | 560 FOR_SHUTDOWN, |
555 }; | 561 }; |
556 void DeleteResourceInternal(ResourceMap::iterator it, DeleteStyle style); | 562 void DeleteResourceInternal(ResourceMap::iterator it, DeleteStyle style); |
557 void DeleteAndReturnUnusedResourcesToChild(ChildMap::iterator child_it, | 563 void DeleteAndReturnUnusedResourcesToChild(ChildMap::iterator child_it, |
558 DeleteStyle style, | 564 DeleteStyle style, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 // A process-unique ID used for disambiguating memory dumps from different | 614 // A process-unique ID used for disambiguating memory dumps from different |
609 // resource providers. | 615 // resource providers. |
610 int tracing_id_; | 616 int tracing_id_; |
611 | 617 |
612 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 618 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
613 }; | 619 }; |
614 | 620 |
615 } // namespace cc | 621 } // namespace cc |
616 | 622 |
617 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 623 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
OLD | NEW |