Index: components/exo/exo_compositor_frame_sink.cc |
diff --git a/components/exo/exo_compositor_frame_sink.cc b/components/exo/exo_compositor_frame_sink.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ef0d1c70510b6b0e73165787df9f2bfd465977f3 |
--- /dev/null |
+++ b/components/exo/exo_compositor_frame_sink.cc |
@@ -0,0 +1,48 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "components/exo/exo_compositor_frame_sink.h" |
+ |
+namespace exo { |
+ |
+//////////////////////////////////////////////////////////////////////////////// |
+// ExoComopositorFrameSink, public: |
+ |
+ExoComopositorFrameSink::ExoComopositorFrameSink() {} |
+ |
+//////////////////////////////////////////////////////////////////////////////// |
+// cc::SurfaceFactoryClient overrides: |
+ |
+void ExoComopositorFrameSink::ReturnResources( |
+ const cc::ReturnedResourceArray& resources) { |
+ scoped_refptr<ExoComopositorFrameSink> holder(this); |
+ for (auto& resource : resources) { |
+ auto it = release_callbacks_.find(resource.id); |
+ DCHECK(it != release_callbacks_.end()); |
+ it->second.second->Run(resource.sync_token, resource.lost); |
+ release_callbacks_.erase(it); |
+ } |
+} |
+ |
+void ExoComopositorFrameSink::WillDrawSurface(const cc::LocalFrameId& id, |
+ const gfx::Rect& damage_rect) { |
+ if (surface_) |
+ surface_->WillDraw(); |
+} |
+ |
+void ExoComopositorFrameSink::SetBeginFrameSource( |
+ cc::BeginFrameSource* begin_frame_source) { |
+ if (surface_) |
+ surface_->SetBeginFrameSource(begin_frame_source); |
+} |
+ |
+//////////////////////////////////////////////////////////////////////////////// |
+// ExoComopositorFrameSink, private: |
+ |
+ExoComopositorFrameSink::~ExoComopositorFrameSink() { |
+ if (surface_factory_->manager()) |
+ surface_factory_->manager()->InvalidateFrameSinkId(frame_sink_id_); |
+} |
+ |
+} // namespace exo |