summaryrefslogtreecommitdiffstats
path: root/cc/resources
diff options
context:
space:
mode:
authordyen <dyen@chromium.org>2016-01-11 17:42:17 -0800
committerCommit bot <commit-bot@chromium.org>2016-01-12 01:43:08 +0000
commitbcd5048b5d3efa23b6742e8482c29c6dec82171d (patch)
treeaac9698871000ccc9a012f6afd647de54b3afdce /cc/resources
parent55b3b326b591e5f176d4b7c753818f1328ff9b2b (diff)
downloadchromium_src-bcd5048b5d3efa23b6742e8482c29c6dec82171d.zip
chromium_src-bcd5048b5d3efa23b6742e8482c29c6dec82171d.tar.gz
chromium_src-bcd5048b5d3efa23b6742e8482c29c6dec82171d.tar.bz2
Fixed an issue with verifying resource sync tokens.
The address of resource sync tokens were being stored in an array before passing these addresses to VerifySyncTokensCHROMIUM(). There were 2 problems with this: 1. We were storing the resource adress on the stack and not pushed the one pushed into the TransferableResourceArray which is a std::vector. 2. Even if we stored the address of the item within the vector, the address could change as we push more items. This could either be solved by storing the address within the vector while simultaneously reserving the maximum amount of space used which guarantees the address will not move, or storing the indexes and getting the address after the vector is stable. I have opted for the second option here. I also fixed a small issue in VerifySyncTokensCHROMIUM() so that it now handles invalid sync tokens being passed to be verified. R=piman@chromium.org BUG=514815 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1577103002 Cr-Commit-Position: refs/heads/master@{#368765}
Diffstat (limited to 'cc/resources')
-rw-r--r--cc/resources/resource_provider.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc
index 6ef8d59..c1f4206 100644
--- a/cc/resources/resource_provider.cc
+++ b/cc/resources/resource_provider.cc
@@ -1149,7 +1149,7 @@ void ResourceProvider::PrepareSendToParent(const ResourceIdArray& resources,
bool need_sync_token = false;
gpu::SyncToken new_sync_token;
- std::vector<GLbyte*> unverified_sync_tokens;
+ std::vector<size_t> unverified_token_indexes;
for (ResourceIdArray::const_iterator it = resources.begin();
it != resources.end();
++it) {
@@ -1160,14 +1160,22 @@ void ResourceProvider::PrepareSendToParent(const ResourceIdArray& resources,
if (resource.mailbox_holder.sync_token.HasData() &&
!resource.mailbox_holder.sync_token.verified_flush()) {
- unverified_sync_tokens.push_back(
- resource.mailbox_holder.sync_token.GetData());
+ unverified_token_indexes.push_back(list->size());
}
++resources_.find(*it)->second.exported_count;
list->push_back(resource);
}
+ // Fill out unverified sync tokens array.
+ std::vector<GLbyte*> unverified_sync_tokens;
+ unverified_sync_tokens.reserve(unverified_token_indexes.size() + 1);
+ for (auto it = unverified_token_indexes.begin();
+ it != unverified_token_indexes.end(); ++it) {
+ unverified_sync_tokens.push_back(
+ list->at(*it).mailbox_holder.sync_token.GetData());
+ }
+
if (need_sync_token &&
output_surface_->capabilities().delegated_sync_points_required) {
const uint64_t fence_sync = gl->InsertFenceSyncCHROMIUM();