Chromium Code Reviews| Index: components/exo/buffer.cc |
| diff --git a/components/exo/buffer.cc b/components/exo/buffer.cc |
| index 9b1778d989d6c0250efff832d6372f401e15e129..9e77ab31b10abf129332a8e6326da17628c8f412 100644 |
| --- a/components/exo/buffer.cc |
| +++ b/components/exo/buffer.cc |
| @@ -24,6 +24,7 @@ |
| #include "cc/output/context_provider.h" |
| #include "cc/resources/single_release_callback.h" |
| #include "cc/resources/texture_mailbox.h" |
| +#include "components/exo/compositor_frame_sink_holder.h" |
| #include "gpu/command_buffer/client/context_support.h" |
| #include "gpu/command_buffer/client/gles2_interface.h" |
| #include "ui/aura/env.h" |
| @@ -401,7 +402,8 @@ Buffer::~Buffer() {} |
| std::unique_ptr<cc::SingleReleaseCallback> Buffer::ProduceTextureMailbox( |
| cc::TextureMailbox* texture_mailbox, |
| bool secure_output_only, |
| - bool client_usage) { |
| + bool client_usage, |
| + scoped_refptr<CompositorFrameSinkHolder> compositor_frame_sink_holder) { |
| DCHECK(attach_count_); |
| DLOG_IF(WARNING, use_count_ && client_usage) |
| << "Producing a texture mailbox for a buffer that has not been released"; |
| @@ -461,7 +463,8 @@ std::unique_ptr<cc::SingleReleaseCallback> Buffer::ProduceTextureMailbox( |
| return cc::SingleReleaseCallback::Create( |
| base::Bind(&Buffer::Texture::ReleaseTexImage, base::Unretained(texture), |
| base::Bind(&Buffer::ReleaseContentsTexture, AsWeakPtr(), |
| - base::Passed(&contents_texture_)))); |
| + base::Passed(&contents_texture_), |
| + (compositor_frame_sink_holder)))); |
|
reveman
2016/12/21 20:05:42
s/(compositor_frame_sink_holder)/compositor_frame_
Alex Z.
2016/12/21 22:35:33
Done.
|
| } |
| // Create a mailbox texture that we copy the buffer contents to. |
| @@ -478,17 +481,17 @@ std::unique_ptr<cc::SingleReleaseCallback> Buffer::ProduceTextureMailbox( |
| // The contents texture will be released when copy has completed. |
| gpu::SyncToken sync_token = contents_texture->CopyTexImage( |
| texture, base::Bind(&Buffer::ReleaseContentsTexture, AsWeakPtr(), |
| - base::Passed(&contents_texture_))); |
| + base::Passed(&contents_texture_), nullptr)); |
| *texture_mailbox = |
| cc::TextureMailbox(texture->mailbox(), sync_token, GL_TEXTURE_2D, |
| gpu_memory_buffer_->GetSize(), |
| false /* is_overlay_candidate */, secure_output_only); |
| // The mailbox texture will be released when no longer used by the |
| // compositor. |
| - return cc::SingleReleaseCallback::Create( |
| - base::Bind(&Buffer::Texture::Release, base::Unretained(texture), |
| - base::Bind(&Buffer::ReleaseTexture, AsWeakPtr(), |
| - base::Passed(&texture_)))); |
| + return cc::SingleReleaseCallback::Create(base::Bind( |
| + &Buffer::Texture::Release, base::Unretained(texture), |
| + base::Bind(&Buffer::ReleaseTexture, AsWeakPtr(), base::Passed(&texture_), |
| + (compositor_frame_sink_holder)))); |
| } |
| void Buffer::OnAttach() { |
| @@ -536,11 +539,15 @@ void Buffer::CheckReleaseCallback() { |
| release_callback_.Run(); |
| } |
| -void Buffer::ReleaseTexture(std::unique_ptr<Texture> texture) { |
| +void Buffer::ReleaseTexture( |
| + std::unique_ptr<Texture> texture, |
| + scoped_refptr<CompositorFrameSinkHolder> compositor_frame_sink_holder) { |
| texture_ = std::move(texture); |
| } |
| -void Buffer::ReleaseContentsTexture(std::unique_ptr<Texture> texture) { |
| +void Buffer::ReleaseContentsTexture( |
| + std::unique_ptr<Texture> texture, |
| + scoped_refptr<CompositorFrameSinkHolder> compositor_frame_sink_holder) { |
| TRACE_EVENT0("exo", "Buffer::ReleaseContentsTexture"); |
| contents_texture_ = std::move(texture); |