| 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 #include "cc/resources/resource_provider.h" | 5 #include "cc/resources/resource_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 resource->pixels = nullptr; | 789 resource->pixels = nullptr; |
| 790 } | 790 } |
| 791 resource->release_callback_impl.Run(sync_token, lost_resource, | 791 resource->release_callback_impl.Run(sync_token, lost_resource, |
| 792 blocking_main_thread_task_runner_); | 792 blocking_main_thread_task_runner_); |
| 793 } | 793 } |
| 794 if (resource->gl_id) { | 794 if (resource->gl_id) { |
| 795 GLES2Interface* gl = ContextGL(); | 795 GLES2Interface* gl = ContextGL(); |
| 796 DCHECK(gl); | 796 DCHECK(gl); |
| 797 gl->DeleteTextures(1, &resource->gl_id); | 797 gl->DeleteTextures(1, &resource->gl_id); |
| 798 resource->gl_id = 0; | 798 resource->gl_id = 0; |
| 799 // Shallow flush after deleting a texture to make sure the memory is freed |
| 800 // as soon as possible. |
| 801 gl->ShallowFlushCHROMIUM(); |
| 799 } | 802 } |
| 800 if (resource->shared_bitmap) { | 803 if (resource->shared_bitmap) { |
| 801 DCHECK(resource->origin != Resource::EXTERNAL); | 804 DCHECK(resource->origin != Resource::EXTERNAL); |
| 802 DCHECK_EQ(RESOURCE_TYPE_BITMAP, resource->type); | 805 DCHECK_EQ(RESOURCE_TYPE_BITMAP, resource->type); |
| 803 delete resource->shared_bitmap; | 806 delete resource->shared_bitmap; |
| 804 resource->pixels = nullptr; | 807 resource->pixels = nullptr; |
| 805 } | 808 } |
| 806 if (resource->pixels) { | 809 if (resource->pixels) { |
| 807 DCHECK(resource->origin == Resource::INTERNAL); | 810 DCHECK(resource->origin == Resource::INTERNAL); |
| 808 delete[] resource->pixels; | 811 delete[] resource->pixels; |
| (...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2059 | 2062 |
| 2060 const int kImportance = 2; | 2063 const int kImportance = 2; |
| 2061 pmd->CreateSharedGlobalAllocatorDump(guid); | 2064 pmd->CreateSharedGlobalAllocatorDump(guid); |
| 2062 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); | 2065 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); |
| 2063 } | 2066 } |
| 2064 | 2067 |
| 2065 return true; | 2068 return true; |
| 2066 } | 2069 } |
| 2067 | 2070 |
| 2068 } // namespace cc | 2071 } // namespace cc |
| OLD | NEW |