| 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 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 resource->pixels = nullptr; | 817 resource->pixels = nullptr; |
| 818 } | 818 } |
| 819 resource->release_callback_impl.Run(sync_token, lost_resource, | 819 resource->release_callback_impl.Run(sync_token, lost_resource, |
| 820 blocking_main_thread_task_runner_); | 820 blocking_main_thread_task_runner_); |
| 821 } | 821 } |
| 822 if (resource->gl_id) { | 822 if (resource->gl_id) { |
| 823 GLES2Interface* gl = ContextGL(); | 823 GLES2Interface* gl = ContextGL(); |
| 824 DCHECK(gl); | 824 DCHECK(gl); |
| 825 gl->DeleteTextures(1, &resource->gl_id); | 825 gl->DeleteTextures(1, &resource->gl_id); |
| 826 resource->gl_id = 0; | 826 resource->gl_id = 0; |
| 827 // Shallow flush after deleting a texture to make sure the memory is freed | |
| 828 // as soon as possible. | |
| 829 gl->ShallowFlushCHROMIUM(); | |
| 830 } | 827 } |
| 831 if (resource->shared_bitmap) { | 828 if (resource->shared_bitmap) { |
| 832 DCHECK(resource->origin != Resource::EXTERNAL); | 829 DCHECK(resource->origin != Resource::EXTERNAL); |
| 833 DCHECK_EQ(RESOURCE_TYPE_BITMAP, resource->type); | 830 DCHECK_EQ(RESOURCE_TYPE_BITMAP, resource->type); |
| 834 delete resource->shared_bitmap; | 831 delete resource->shared_bitmap; |
| 835 resource->pixels = nullptr; | 832 resource->pixels = nullptr; |
| 836 } | 833 } |
| 837 if (resource->pixels) { | 834 if (resource->pixels) { |
| 838 DCHECK(resource->origin == Resource::INTERNAL); | 835 DCHECK(resource->origin == Resource::INTERNAL); |
| 839 delete[] resource->pixels; | 836 delete[] resource->pixels; |
| (...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2149 | 2146 |
| 2150 const int kImportance = 2; | 2147 const int kImportance = 2; |
| 2151 pmd->CreateSharedGlobalAllocatorDump(guid); | 2148 pmd->CreateSharedGlobalAllocatorDump(guid); |
| 2152 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); | 2149 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); |
| 2153 } | 2150 } |
| 2154 | 2151 |
| 2155 return true; | 2152 return true; |
| 2156 } | 2153 } |
| 2157 | 2154 |
| 2158 } // namespace cc | 2155 } // namespace cc |
| OLD | NEW |