Commit bef05e34 authored by Adrienne Walker's avatar Adrienne Walker Committed by Commit Bot

cc: handle failed image transfer cache entry failure

This is the GpuImageDecodeCache equivalent of this change:
https://chromium-review.googlesource.com/c/chromium/src/+/1147102

Bug: 866434
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I59da18646c0817f011a464b7571a9b6abf7b8455
Reviewed-on: https://chromium-review.googlesource.com/1147243Reviewed-by: default avatarEric Karl <ericrk@chromium.org>
Commit-Queue: enne <enne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577279}
parent 8712347b
...@@ -1526,14 +1526,20 @@ void GpuImageDecodeCache::UploadImageIfNecessary(const DrawImage& draw_image, ...@@ -1526,14 +1526,20 @@ void GpuImageDecodeCache::UploadImageIfNecessary(const DrawImage& draw_image,
image_data->needs_mips); image_data->needs_mips);
size_t size = image_entry.SerializedSize(); size_t size = image_entry.SerializedSize();
void* data = context_->ContextSupport()->MapTransferCacheEntry(size); void* data = context_->ContextSupport()->MapTransferCacheEntry(size);
// TODO(piman): handle error (failed to allocate/map shm) if (data) {
DCHECK(data); bool succeeded = image_entry.Serialize(
bool succeeded = image_entry.Serialize( base::make_span(reinterpret_cast<uint8_t*>(data), size));
base::make_span(reinterpret_cast<uint8_t*>(data), size)); DCHECK(succeeded);
DCHECK(succeeded); context_->ContextSupport()->UnmapAndCreateTransferCacheEntry(
context_->ContextSupport()->UnmapAndCreateTransferCacheEntry( image_entry.UnsafeType(), image_entry.Id());
image_entry.UnsafeType(), image_entry.Id()); image_data->upload.SetTransferCacheId(image_entry.Id());
image_data->upload.SetTransferCacheId(image_entry.Id()); } else {
// Transfer cache entry can fail due to a lost gpu context or failure
// to allocate shared memory. Handle this gracefully. Mark this
// image as "decode failed" so that we do not try to handle it again.
// If this was a lost context, we'll recreate this image decode cache.
image_data->decode.decode_failure = true;
}
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment