| Index: components/exo/buffer.cc
|
| diff --git a/components/exo/buffer.cc b/components/exo/buffer.cc
|
| index 5b02cc3c130e4ffff31c1659992b56af080061a7..442d6fbaed21a0724d288c9b8d9de384131f464d 100644
|
| --- a/components/exo/buffer.cc
|
| +++ b/components/exo/buffer.cc
|
| @@ -371,7 +371,9 @@ Buffer::~Buffer() {}
|
| std::unique_ptr<cc::SingleReleaseCallback> Buffer::ProduceTextureMailbox(
|
| cc::TextureMailbox* texture_mailbox,
|
| bool secure_output_only,
|
| - bool client_usage) {
|
| + bool client_usage,
|
| + base::Closure* detach_callback) {
|
| + DCHECK(detach_callback->is_null());
|
| // Non-client usage can only be allowed when the client is not allowed to
|
| // use the buffer. If the buffer has been released to the client then it
|
| // can no longer be used as the client might be writing to it.
|
| @@ -411,6 +413,11 @@ std::unique_ptr<cc::SingleReleaseCallback> Buffer::ProduceTextureMailbox(
|
| return nullptr;
|
| }
|
|
|
| + // Add a callback to ensure this buffer isn't released while it's attached
|
| + // to a surface.
|
| + use_count_++;
|
| + *detach_callback = base::Bind(&Buffer::Release, AsWeakPtr());
|
| +
|
| // Create a new image texture for |gpu_memory_buffer_| with |texture_target_|
|
| // if one doesn't already exist. The contents of this buffer are copied to
|
| // |texture| using a call to CopyTexImage.
|
|
|