| 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 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1133 DCHECK(it != children_.end()); | 1133 DCHECK(it != children_.end()); |
| 1134 DCHECK(!it->second.marked_for_deletion); | 1134 DCHECK(!it->second.marked_for_deletion); |
| 1135 return it->second.child_to_parent_map; | 1135 return it->second.child_to_parent_map; |
| 1136 } | 1136 } |
| 1137 | 1137 |
| 1138 void ResourceProvider::PrepareSendToParent(const ResourceIdArray& resources, | 1138 void ResourceProvider::PrepareSendToParent(const ResourceIdArray& resources, |
| 1139 TransferableResourceArray* list) { | 1139 TransferableResourceArray* list) { |
| 1140 DCHECK(thread_checker_.CalledOnValidThread()); | 1140 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1141 GLES2Interface* gl = ContextGL(); | 1141 GLES2Interface* gl = ContextGL(); |
| 1142 bool need_sync_token = false; | 1142 bool need_sync_token = false; |
| 1143 |
| 1144 gpu::SyncToken new_sync_token; |
| 1145 std::vector<GLbyte*> unverified_sync_tokens; |
| 1143 for (ResourceIdArray::const_iterator it = resources.begin(); | 1146 for (ResourceIdArray::const_iterator it = resources.begin(); |
| 1144 it != resources.end(); | 1147 it != resources.end(); |
| 1145 ++it) { | 1148 ++it) { |
| 1146 TransferableResource resource; | 1149 TransferableResource resource; |
| 1147 TransferResource(gl, *it, &resource); | 1150 TransferResource(gl, *it, &resource); |
| 1148 need_sync_token |= (!resource.mailbox_holder.sync_token.HasData() && | 1151 need_sync_token |= (!resource.mailbox_holder.sync_token.HasData() && |
| 1149 !resource.is_software); | 1152 !resource.is_software); |
| 1153 |
| 1154 if (resource.mailbox_holder.sync_token.HasData() && |
| 1155 !resource.mailbox_holder.sync_token.verified_flush()) { |
| 1156 unverified_sync_tokens.push_back( |
| 1157 resource.mailbox_holder.sync_token.GetData()); |
| 1158 } |
| 1159 |
| 1150 ++resources_.find(*it)->second.exported_count; | 1160 ++resources_.find(*it)->second.exported_count; |
| 1151 list->push_back(resource); | 1161 list->push_back(resource); |
| 1152 } | 1162 } |
| 1163 |
| 1153 if (need_sync_token && | 1164 if (need_sync_token && |
| 1154 output_surface_->capabilities().delegated_sync_points_required) { | 1165 output_surface_->capabilities().delegated_sync_points_required) { |
| 1155 gpu::SyncToken sync_token(gl->InsertSyncPointCHROMIUM()); | 1166 const uint64_t fence_sync = gl->InsertFenceSyncCHROMIUM(); |
| 1167 gl->OrderingBarrierCHROMIUM(); |
| 1168 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, new_sync_token.GetData()); |
| 1169 unverified_sync_tokens.push_back(new_sync_token.GetData()); |
| 1170 } |
| 1171 |
| 1172 if (!unverified_sync_tokens.empty()) { |
| 1173 gl->VerifySyncTokensCHROMIUM(unverified_sync_tokens.data(), |
| 1174 unverified_sync_tokens.size()); |
| 1175 } |
| 1176 |
| 1177 if (new_sync_token.HasData()) { |
| 1156 for (TransferableResourceArray::iterator it = list->begin(); | 1178 for (TransferableResourceArray::iterator it = list->begin(); |
| 1157 it != list->end(); | 1179 it != list->end(); |
| 1158 ++it) { | 1180 ++it) { |
| 1159 if (!it->mailbox_holder.sync_token.HasData()) | 1181 if (!it->mailbox_holder.sync_token.HasData()) |
| 1160 it->mailbox_holder.sync_token = sync_token; | 1182 it->mailbox_holder.sync_token = new_sync_token; |
| 1161 } | 1183 } |
| 1162 } | 1184 } |
| 1163 } | 1185 } |
| 1164 | 1186 |
| 1165 void ResourceProvider::ReceiveFromChild( | 1187 void ResourceProvider::ReceiveFromChild( |
| 1166 int child, const TransferableResourceArray& resources) { | 1188 int child, const TransferableResourceArray& resources) { |
| 1167 DCHECK(thread_checker_.CalledOnValidThread()); | 1189 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1168 GLES2Interface* gl = ContextGL(); | 1190 GLES2Interface* gl = ContextGL(); |
| 1169 Child& child_info = children_.find(child)->second; | 1191 Child& child_info = children_.find(child)->second; |
| 1170 DCHECK(!child_info.marked_for_deletion); | 1192 DCHECK(!child_info.marked_for_deletion); |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1669 const int kImportance = 2; | 1691 const int kImportance = 2; |
| 1670 pmd->CreateSharedGlobalAllocatorDump(guid); | 1692 pmd->CreateSharedGlobalAllocatorDump(guid); |
| 1671 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); | 1693 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); |
| 1672 } | 1694 } |
| 1673 } | 1695 } |
| 1674 | 1696 |
| 1675 return true; | 1697 return true; |
| 1676 } | 1698 } |
| 1677 | 1699 |
| 1678 } // namespace cc | 1700 } // namespace cc |
| OLD | NEW |