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