[gpu] Fix texture assignment in WrappedGraphiteBacking::InitWithData
Create `texture_holder_` in WrappedGraphiteBacking::InitializeWithData so that on backing construction failure, the texture will be deleted as well. Bug: 383528569 Change-Id: Ic0f621e69766d42a542787f679cdf0ab6c3e1cff Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6430128 Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org> Commit-Queue: Saifuddin Hitawala <hitawala@chromium.org> Cr-Commit-Position: refs/heads/main@{#1442381}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
e9b24dd1dc
commit
17f16c89cb
@@ -85,7 +85,7 @@ class WrappedGraphiteTextureBacking::SkiaGraphiteImageRepresentationImpl
|
|||||||
color_space().ToSkColorSpace(), &surface_props, release_proc,
|
color_space().ToSkColorSpace(), &surface_props, release_proc,
|
||||||
release_context, WrappedTextureDebugLabel(plane));
|
release_context, WrappedTextureDebugLabel(plane));
|
||||||
if (!surface) {
|
if (!surface) {
|
||||||
LOG(ERROR) << "MakeGraphiteFromBackendTexture() failed.";
|
LOG(ERROR) << "BeginWriteAccess() failed.";
|
||||||
write_surfaces_.clear();
|
write_surfaces_.clear();
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@@ -221,6 +221,12 @@ bool WrappedGraphiteTextureBacking::InitializeWithData(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create `texture_holder_` so that on backing construction failure, the
|
||||||
|
// texture will be deleted as well.
|
||||||
|
texture_holders_ = std::vector<scoped_refptr<GraphiteTextureHolder>>{
|
||||||
|
base::MakeRefCounted<WrappedGraphiteTextureHolder>(
|
||||||
|
texture, context_state_, created_task_runner_)};
|
||||||
|
|
||||||
if (format().IsCompressed()) {
|
if (format().IsCompressed()) {
|
||||||
if (!recorder()->updateCompressedBackendTexture(texture, pixels.data(),
|
if (!recorder()->updateCompressedBackendTexture(texture, pixels.data(),
|
||||||
pixels.size())) {
|
pixels.size())) {
|
||||||
@@ -246,9 +252,6 @@ bool WrappedGraphiteTextureBacking::InitializeWithData(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
texture_holders_ = std::vector<scoped_refptr<GraphiteTextureHolder>>{
|
|
||||||
base::MakeRefCounted<WrappedGraphiteTextureHolder>(
|
|
||||||
std::move(texture), context_state_, created_task_runner_)};
|
|
||||||
SetCleared();
|
SetCleared();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user