Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: cc/resources/resource_provider.cc

Issue 2130213002: cc: Do not synchronize on deletion of non-internal resources. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cc: Do not synchronize on deletion of non-internal resources. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 696
697 // Exported resources are lost on shutdown. 697 // Exported resources are lost on shutdown.
698 bool exported_resource_lost = 698 bool exported_resource_lost =
699 style == FOR_SHUTDOWN && resource->exported_count > 0; 699 style == FOR_SHUTDOWN && resource->exported_count > 0;
700 // GPU resources are lost when output surface is lost. 700 // GPU resources are lost when output surface is lost.
701 bool gpu_resource_lost = 701 bool gpu_resource_lost =
702 IsGpuResourceType(resource->type) && lost_output_surface_; 702 IsGpuResourceType(resource->type) && lost_output_surface_;
703 bool lost_resource = 703 bool lost_resource =
704 resource->lost || exported_resource_lost || gpu_resource_lost; 704 resource->lost || exported_resource_lost || gpu_resource_lost;
705 705
706 if (!lost_resource && 706 // Wait on sync token before deleting resources we own.
707 if (!lost_resource && resource->origin == Resource::INTERNAL &&
707 resource->synchronization_state() == Resource::NEEDS_WAIT) { 708 resource->synchronization_state() == Resource::NEEDS_WAIT) {
708 DCHECK(resource->allocated); 709 DCHECK(resource->allocated);
709 DCHECK(IsGpuResourceType(resource->type)); 710 DCHECK(IsGpuResourceType(resource->type));
710 GLES2Interface* gl = ContextGL(); 711 GLES2Interface* gl = ContextGL();
711 DCHECK(gl); 712 DCHECK(gl);
712 resource->WaitSyncToken(gl); 713 resource->WaitSyncToken(gl);
713 } 714 }
714 715
715 if (resource->image_id) { 716 if (resource->image_id) {
716 DCHECK(resource->origin == Resource::INTERNAL); 717 DCHECK(resource->origin == Resource::INTERNAL);
(...skipping 20 matching lines...) Expand all
737 gl->DeleteBuffers(1, &resource->gl_pixel_buffer_id); 738 gl->DeleteBuffers(1, &resource->gl_pixel_buffer_id);
738 } 739 }
739 if (resource->origin == Resource::EXTERNAL) { 740 if (resource->origin == Resource::EXTERNAL) {
740 DCHECK(resource->mailbox().IsValid()); 741 DCHECK(resource->mailbox().IsValid());
741 gpu::SyncToken sync_token = resource->mailbox().sync_token(); 742 gpu::SyncToken sync_token = resource->mailbox().sync_token();
742 if (IsGpuResourceType(resource->type)) { 743 if (IsGpuResourceType(resource->type)) {
743 DCHECK(resource->mailbox().IsTexture()); 744 DCHECK(resource->mailbox().IsTexture());
744 GLES2Interface* gl = ContextGL(); 745 GLES2Interface* gl = ContextGL();
745 DCHECK(gl); 746 DCHECK(gl);
746 if (resource->gl_id) { 747 if (resource->gl_id) {
748 DCHECK_NE(Resource::NEEDS_WAIT, resource->synchronization_state());
747 gl->DeleteTextures(1, &resource->gl_id); 749 gl->DeleteTextures(1, &resource->gl_id);
748 resource->gl_id = 0; 750 resource->gl_id = 0;
749 if (!lost_resource) { 751 if (!lost_resource) {
750 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM(); 752 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM();
751 gl->ShallowFlushCHROMIUM(); 753 gl->ShallowFlushCHROMIUM();
752 gl->GenSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); 754 gl->GenSyncTokenCHROMIUM(fence_sync, sync_token.GetData());
753 } 755 }
754 } 756 }
755 } else { 757 } else {
756 DCHECK(resource->mailbox().IsSharedMemory()); 758 DCHECK(resource->mailbox().IsSharedMemory());
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1973 1975
1974 const int kImportance = 2; 1976 const int kImportance = 2;
1975 pmd->CreateSharedGlobalAllocatorDump(guid); 1977 pmd->CreateSharedGlobalAllocatorDump(guid);
1976 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); 1978 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
1977 } 1979 }
1978 1980
1979 return true; 1981 return true;
1980 } 1982 }
1981 1983
1982 } // namespace cc 1984 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698