Index: components/exo/exo_compositor_frame_sink.h |
diff --git a/components/exo/exo_compositor_frame_sink.h b/components/exo/exo_compositor_frame_sink.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2b8156a262a2c00a726b07194898d33399371618 |
--- /dev/null |
+++ b/components/exo/exo_compositor_frame_sink.h |
@@ -0,0 +1,98 @@ |
+// 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. |
+ |
+#ifndef COMPONENTS_EXO_EXO_COMPOSITOR_FRAME_SINK_H_ |
+#define COMPONENTS_EXO_EXO_COMPOSITOR_FRAME_SINK_H_ |
+ |
+#include <list> |
Fady Samuel
2016/11/23 14:39:02
I suspect you don't need this.
Alex Z.
2016/11/23 15:27:41
Done.
|
+#include <memory> |
+#include <set> |
Fady Samuel
2016/11/23 14:39:02
I suspect you don't need this.
Alex Z.
2016/11/23 15:27:40
Done.
|
+#include <utility> |
+ |
+#include "base/callback.h" |
+#include "base/macros.h" |
+#include "base/memory/ref_counted.h" |
Fady Samuel
2016/11/23 14:39:02
You don't need this.
Alex Z.
2016/11/23 15:27:40
Done.
|
+#include "base/memory/weak_ptr.h" |
+#include "base/observer_list.h" |
Fady Samuel
2016/11/23 14:39:02
I suspect you don't need this.
Alex Z.
2016/11/23 15:27:41
Done.
|
+#include "cc/ipc/compositor_frame.mojom.h" |
+#include "cc/ipc/mojo_compositor_frame_sink.mojom.h" |
+#include "cc/resources/transferable_resource.h" |
+#include "cc/scheduler/begin_frame_source.h" |
+#include "cc/surfaces/surface_factory.h" |
+#include "cc/surfaces/surface_factory_client.h" |
+#include "cc/surfaces/surface_id_allocator.h" |
Fady Samuel
2016/11/23 14:39:02
You don't need surface_id_allocator.h
Alex Z.
2016/11/23 15:27:41
Done.
|
+#include "mojo/public/cpp/bindings/binding.h" |
+#include "third_party/skia/include/core/SkRegion.h" |
+#include "third_party/skia/include/core/SkXfermode.h" |
Fady Samuel
2016/11/23 14:39:03
I don't think you need third_party/skia.
Alex Z.
2016/11/23 15:27:41
Done.
|
+#include "ui/aura/window.h" |
+#include "ui/aura/window_observer.h" |
Fady Samuel
2016/11/23 14:39:02
You don't need to depend on aura here.
Alex Z.
2016/11/23 15:27:40
Done.
|
+#include "ui/gfx/geometry/rect.h" |
+ |
+namespace cc { |
+class SurfaceFactory; |
+} |
+ |
+namespace exo { |
+class CompositorFrameSinkHolder; |
Fady Samuel
2016/11/23 14:39:02
remove this.
Alex Z.
2016/11/23 15:27:40
Done.
|
+ |
+// This class owns the SurfaceFactory and keeps track of references to the |
+// contents of Buffers. It's keeped alive by references from |
+// release_callbacks_. It's destroyed when its owning Surface is destroyed and |
+// the last outstanding release callback is called. |
+class ExoCompositorFrameSink : public cc::SurfaceFactoryClient, |
+ public cc::BeginFrameObserver { |
+ public: |
+ ExoCompositorFrameSink(const cc::FrameSinkId& frame_sink_id, |
+ cc::SurfaceManager* surface_manager, |
+ cc::mojom::MojoCompositorFrameSinkClientPtr client); |
+ |
+ ~ExoCompositorFrameSink() override; |
+ |
+ // To be cc::mojom::MojoCompositorFrameSink: |
Fady Samuel
2016/11/23 14:39:02
Make this cc::mojom::MojoCompositorFrameSink now?
Alex Z.
2016/11/23 15:27:40
Done.
|
+ void SubmitCompositorFrame(const cc::LocalFrameId& local_frame_id, |
+ cc::CompositorFrame frame); |
+ |
+ private: |
+ friend class base::RefCounted<ExoCompositorFrameSink>; |
Fady Samuel
2016/11/23 14:39:02
remove this.
Alex Z.
2016/11/23 15:27:41
Done.
|
+ |
+ void UpdateNeedsBeginFrameInternal(); |
+ void DidReceiveCompositorFrameAck(); |
+ |
+ // cc::SurfaceFactoryClient: |
+ void ReturnResources(const cc::ReturnedResourceArray& resources) override; |
+ void WillDrawSurface(const cc::LocalFrameId& id, |
+ const gfx::Rect& damage_rect) override; |
+ void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; |
+ |
+ // cc::BeginFrameObserver: |
+ void OnBeginFrame(const cc::BeginFrameArgs& args) override; |
+ const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override; |
+ void OnBeginFrameSourcePausedChanged(bool paused) override; |
+ |
+ const cc::FrameSinkId frame_sink_id_; |
+ cc::LocalFrameId last_local_frame_id_; |
+ |
+ cc::SurfaceManager* surface_manager_; |
+ cc::SurfaceFactory surface_factory_; |
+ |
+ cc::mojom::MojoCompositorFrameSinkClientPtr client_; |
+ |
+ int ack_pending_count_ = 0; |
+ cc::ReturnedResourceArray surface_returned_resources_; |
+ |
+ cc::BeginFrameSource* begin_frame_source_ = nullptr; |
+ |
+ gfx::Size last_submitted_frame_size_; |
+ |
+ cc::BeginFrameArgs last_begin_frame_args_; |
+ |
+ bool needs_begin_frame_ = false; |
+ bool added_frame_observer_ = false; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ExoCompositorFrameSink); |
+}; |
+ |
+} // namespace exo |
+ |
+#endif // COMPONENTS_EXO_EXO_COMPOSITOR_FRAME_SINK_H_ |