Chromium Code Reviews| Index: components/exo/buffer.cc |
| diff --git a/components/exo/buffer.cc b/components/exo/buffer.cc |
| index f5040bf76a108171f04b905cd1f1f1e3213cb4d5..f8c4049d9baaf44e83beaa447c5f68a1ef29eb45 100644 |
| --- a/components/exo/buffer.cc |
| +++ b/components/exo/buffer.cc |
| @@ -369,8 +369,14 @@ Buffer::~Buffer() {} |
| std::unique_ptr<cc::SingleReleaseCallback> Buffer::ProduceTextureMailbox( |
| cc::TextureMailbox* texture_mailbox, |
| bool secure_output_only, |
| - bool lost_context) { |
| - DLOG_IF(WARNING, use_count_) |
| + bool non_client_usage) { |
| + // Non-client usage can only be allowed when the client is no allowed to |
|
Daniele Castagna
2016/06/06 02:47:53
no allow? no longer allowed? not allowed?
reveman
2016/06/06 03:17:36
not allowed, fixed.
|
| + // 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. |
| + if (non_client_usage && !use_count_) |
| + return nullptr; |
| + |
| + DLOG_IF(WARNING, use_count_ && !non_client_usage) |
|
Daniele Castagna
2016/06/06 02:47:53
I'd avoid the double negation of !non if possible.
reveman
2016/06/06 03:17:36
done
|
| << "Producing a texture mailbox for a buffer that has not been released"; |
| // Some clients think that they can reuse a buffer before it's released by |
| @@ -380,7 +386,7 @@ std::unique_ptr<cc::SingleReleaseCallback> Buffer::ProduceTextureMailbox( |
| // buffer has been reused). We stop running the release callback when this |
| // type of behavior is detected as having the buffer always be busy will |
| // result in fewer drawing artifacts. |
| - if (use_count_ && !lost_context) |
| + if (use_count_ && !non_client_usage) |
| release_callback_.Reset(); |
| // Increment the use count for this buffer. |