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

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

Issue 1479673003: Verify resource provider sync tokens before sending to parent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/atomic_sequence_num.h" 10 #include "base/atomic_sequence_num.h"
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 ChildMap::const_iterator it = children_.find(child); 1128 ChildMap::const_iterator it = children_.find(child);
1129 DCHECK(it != children_.end()); 1129 DCHECK(it != children_.end());
1130 DCHECK(!it->second.marked_for_deletion); 1130 DCHECK(!it->second.marked_for_deletion);
1131 return it->second.child_to_parent_map; 1131 return it->second.child_to_parent_map;
1132 } 1132 }
1133 1133
1134 void ResourceProvider::PrepareSendToParent(const ResourceIdArray& resources, 1134 void ResourceProvider::PrepareSendToParent(const ResourceIdArray& resources,
1135 TransferableResourceArray* list) { 1135 TransferableResourceArray* list) {
1136 DCHECK(thread_checker_.CalledOnValidThread()); 1136 DCHECK(thread_checker_.CalledOnValidThread());
1137 GLES2Interface* gl = ContextGL(); 1137 GLES2Interface* gl = ContextGL();
1138 bool need_sync_token = false; 1138
1139 gpu::SyncToken new_sync_token;
1140 std::vector<GLbyte*> unverified_sync_tokens;
1139 for (ResourceIdArray::const_iterator it = resources.begin(); 1141 for (ResourceIdArray::const_iterator it = resources.begin();
1140 it != resources.end(); 1142 it != resources.end();
1141 ++it) { 1143 ++it) {
1142 TransferableResource resource; 1144 TransferableResource resource;
1143 TransferResource(gl, *it, &resource); 1145 TransferResource(gl, *it, &resource);
1144 need_sync_token |= (!resource.mailbox_holder.sync_token.HasData() && 1146 if (!resource.is_software &&
1145 !resource.is_software); 1147 !resource.mailbox_holder.sync_token.HasData()) {
1148 if (!new_sync_token.HasData()) {
1149 const uint64_t fence_sync = gl->InsertFenceSyncCHROMIUM();
1150 gl->OrderingBarrierCHROMIUM();
1151 GenUnverifiedSyncTokenCHROMIUM(fence_sync, new_sync_token.GetData());
1152 unverified_sync_tokens.push_back(new_sync_token.GetData());
piman 2015/11/26 02:32:44 Actually, the VerifySyncTokensCHROMIUM below will
David Yen 2015/12/08 00:57:56 Done.
1153 }
1154 resource.mailbox_holder.sync_token = new_sync_token;
1155 } else if (!resource.mailbox_holder.sync_token.verified_flush()) {
1156 unverified_sync_tokens.push_back(
1157 resource.mailbox_holder.sync_token.GetData());
1158 }
1159
1146 ++resources_.find(*it)->second.exported_count; 1160 ++resources_.find(*it)->second.exported_count;
1147 list->push_back(resource); 1161 list->push_back(resource);
1148 } 1162 }
1149 if (need_sync_token && 1163
1150 output_surface_->capabilities().delegated_sync_points_required) { 1164 if (!unverified_sync_tokens.empty()) {
1151 gpu::SyncToken sync_token(gl->InsertSyncPointCHROMIUM()); 1165 gl->VerifySyncTokensCHROMIUM(unverified_sync_tokens.data(),
1152 for (TransferableResourceArray::iterator it = list->begin(); 1166 unverified_sync_tokens.size());
1153 it != list->end();
1154 ++it) {
1155 if (!it->mailbox_holder.sync_token.HasData())
1156 it->mailbox_holder.sync_token = sync_token;
1157 }
1158 } 1167 }
1159 } 1168 }
1160 1169
1161 void ResourceProvider::ReceiveFromChild( 1170 void ResourceProvider::ReceiveFromChild(
1162 int child, const TransferableResourceArray& resources) { 1171 int child, const TransferableResourceArray& resources) {
1163 DCHECK(thread_checker_.CalledOnValidThread()); 1172 DCHECK(thread_checker_.CalledOnValidThread());
1164 GLES2Interface* gl = ContextGL(); 1173 GLES2Interface* gl = ContextGL();
1165 Child& child_info = children_.find(child)->second; 1174 Child& child_info = children_.find(child)->second;
1166 DCHECK(!child_info.marked_for_deletion); 1175 DCHECK(!child_info.marked_for_deletion);
1167 for (TransferableResourceArray::const_iterator it = resources.begin(); 1176 for (TransferableResourceArray::const_iterator it = resources.begin();
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
1661 const int kImportance = 2; 1670 const int kImportance = 2;
1662 pmd->CreateSharedGlobalAllocatorDump(guid); 1671 pmd->CreateSharedGlobalAllocatorDump(guid);
1663 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); 1672 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
1664 } 1673 }
1665 } 1674 }
1666 1675
1667 return true; 1676 return true;
1668 } 1677 }
1669 1678
1670 } // namespace cc 1679 } // 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