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 | |
546 void TransferResource(gpu::gles2::GLES2Interface* gl, | 540 void TransferResource(gpu::gles2::GLES2Interface* gl, |
547 ResourceId id, | 541 ResourceId id, |
548 TransferableResource* resource); | 542 TransferableResource* resource); |
549 enum DeleteStyle { | 543 enum DeleteStyle { |
550 NORMAL, | 544 NORMAL, |
551 FOR_SHUTDOWN, | 545 FOR_SHUTDOWN, |
552 }; | 546 }; |
553 void DeleteResourceInternal(ResourceMap::iterator it, DeleteStyle style); | 547 void DeleteResourceInternal(ResourceMap::iterator it, DeleteStyle style); |
554 void DeleteAndReturnUnusedResourcesToChild(ChildMap::iterator child_it, | 548 void DeleteAndReturnUnusedResourcesToChild(ChildMap::iterator child_it, |
555 DeleteStyle style, | 549 DeleteStyle style, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 // A process-unique ID used for disambiguating memory dumps from different | 599 // A process-unique ID used for disambiguating memory dumps from different |
606 // resource providers. | 600 // resource providers. |
607 int tracing_id_; | 601 int tracing_id_; |
608 | 602 |
609 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 603 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
610 }; | 604 }; |
611 | 605 |
612 } // namespace cc | 606 } // namespace cc |
613 | 607 |
614 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 608 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
OLD | NEW |