Commit 29140a41 authored by reveman's avatar reveman Committed by Commit bot

exo: CompositorFrameSink code cleanup.

Update comments to reflect latest code and remove unncessary
function and if-statements.

BUG=675004

Review-Url: https://codereview.chromium.org/2625153002
Cr-Commit-Position: refs/heads/master@{#442998}
parent d358fb4f
......@@ -104,29 +104,28 @@ class Buffer : public base::SupportsWeakPtr<Buffer> {
// True if this buffer is an overlay candidate.
const bool is_overlay_candidate_;
// This is incremented when a texture mailbox is produced and decremented
// when a texture mailbox is released. It is used to determine when we should
// notify the client that buffer has been released.
// This is incremented when a transferable resource is produced and
// decremented when a transferable resource is released. It is used to
// determine when we should notify the client that buffer has been released.
unsigned use_count_ = 0;
// This keeps track of how many Surfaces the buffer is attached to.
unsigned attach_count_ = 0;
// The last used texture. ProduceTextureMailbox() will use this
// The last used texture. ProduceTransferableResource() will use this
// instead of creating a new texture when possible.
std::unique_ptr<Texture> texture_;
// The last used contents texture. ProduceTextureMailbox() will use this
// The last used contents texture. ProduceTransferableResource() will use this
// instead of creating a new texture when possible.
std::unique_ptr<Texture> contents_texture_;
// The client release callback.
base::Closure release_callback_;
// The CompositorFrameSinkHolder that has the ReleaseCallback of this buffer
// produced in ProduceTextureMailbox().
// Buffer holds a reference to the CompositorFrameSinkHolder to keep it alive.
// The refptr is reset when the release callback is called.
// CompositorFrameSinkHolder instance that needs to be kept alive to receive
// a release callback when the last produced transferable resource is no
// longer in use.
scoped_refptr<CompositorFrameSinkHolder> compositor_frame_sink_holder_;
DISALLOW_COPY_AND_ASSIGN(Buffer);
......
......@@ -14,20 +14,6 @@ namespace exo {
////////////////////////////////////////////////////////////////////////////////
// ExoComopositorFrameSink, public:
// static
void CompositorFrameSink::Create(
const cc::FrameSinkId& frame_sink_id,
cc::SurfaceManager* surface_manager,
cc::mojom::MojoCompositorFrameSinkClientPtr client,
cc::mojom::MojoCompositorFrameSinkRequest request) {
std::unique_ptr<CompositorFrameSink> impl =
base::MakeUnique<CompositorFrameSink>(frame_sink_id, surface_manager,
std::move(client));
CompositorFrameSink* compositor_frame_sink = impl.get();
compositor_frame_sink->binding_ =
mojo::MakeStrongBinding(std::move(impl), std::move(request));
}
CompositorFrameSink::CompositorFrameSink(
const cc::FrameSinkId& frame_sink_id,
cc::SurfaceManager* surface_manager,
......@@ -79,24 +65,20 @@ void CompositorFrameSink::Satisfy(const cc::SurfaceSequence& sequence) {
// cc::CompositorFrameSinkSupportClient overrides:
void CompositorFrameSink::DidReceiveCompositorFrameAck() {
if (client_)
client_->DidReceiveCompositorFrameAck();
client_->DidReceiveCompositorFrameAck();
}
void CompositorFrameSink::OnBeginFrame(const cc::BeginFrameArgs& args) {
if (client_)
client_->OnBeginFrame(args);
client_->OnBeginFrame(args);
}
void CompositorFrameSink::ReclaimResources(
const cc::ReturnedResourceArray& resources) {
if (client_)
client_->ReclaimResources(resources);
client_->ReclaimResources(resources);
}
void CompositorFrameSink::WillDrawSurface() {
if (client_)
client_->WillDrawSurface();
client_->WillDrawSurface();
}
} // namespace exo
......@@ -17,11 +17,6 @@ namespace exo {
class CompositorFrameSink : public cc::CompositorFrameSinkSupportClient,
public cc::mojom::MojoCompositorFrameSink {
public:
static void Create(const cc::FrameSinkId& frame_sink_id,
cc::SurfaceManager* surface_manager,
cc::mojom::MojoCompositorFrameSinkClientPtr client,
cc::mojom::MojoCompositorFrameSinkRequest request);
CompositorFrameSink(const cc::FrameSinkId& frame_sink_id,
cc::SurfaceManager* surface_manager,
cc::mojom::MojoCompositorFrameSinkClientPtr client);
......
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