Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2663)

Unified Diff: components/exo/compositor_frame_sink_holder.h

Issue 2493223002: Change exo::SurfaceFactoryOwner to exo::ExoCompositorFrameSink (Closed)
Patch Set: Addressed some comments and rebased Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/exo/compositor_frame_sink_holder.h
diff --git a/components/exo/compositor_frame_sink_holder.h b/components/exo/compositor_frame_sink_holder.h
new file mode 100644
index 0000000000000000000000000000000000000000..cc313e64574b08ca7afbe4ada2afa224509e7d92
--- /dev/null
+++ b/components/exo/compositor_frame_sink_holder.h
@@ -0,0 +1,66 @@
+// 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_COMPOSITOR_FRAME_SINK_HOLDER_H_
+#define COMPONENTS_EXO_COMPOSITOR_FRAME_SINK_HOLDER_H_
+
+#include <map>
+#include <memory>
+
+#include "cc/ipc/mojo_compositor_frame_sink.mojom.h"
+#include "cc/resources/single_release_callback.h"
+#include "cc/resources/transferable_resource.h"
+#include "cc/scheduler/begin_frame_source.h"
+#include "components/exo/exo_compositor_frame_sink.h"
+#include "mojo/public/cpp/bindings/binding.h"
+
+namespace exo {
+class Surface;
+
+class CompositorFrameSinkHolder
+ : public base::RefCounted<CompositorFrameSinkHolder>,
+ public cc::mojom::MojoCompositorFrameSinkClient {
+ public:
+ CompositorFrameSinkHolder(
+ std::unique_ptr<ExoCompositorFrameSink> compositor_frame_sink,
+ Surface* surface,
Fady Samuel 2016/11/23 14:39:02 base::WeakPtr<Surface> surface
Alex Z. 2016/11/23 15:11:41 Done.
+ cc::mojom::MojoCompositorFrameSinkClientRequest request);
+
+ bool HasReleaseCallbacks(cc::ResourceId id);
+ void AddResourceReleaseCallback(
+ cc::ResourceId id,
+ std::unique_ptr<cc::SingleReleaseCallback> callback);
+
+ void SubmitCompositorFrame(const cc::LocalFrameId& local_frame_id,
+ cc::CompositorFrame frame);
+
+ // cc::mojom::MojoCompositorFrameSinkClient:
+ void DidReceiveCompositorFrameAck() override;
+ void OnBeginFrame(const cc::BeginFrameArgs& args) override;
+ void ReclaimResources(const cc::ReturnedResourceArray& resources) override;
+ void WillDrawSurface() override;
+
+ private:
+ friend class base::RefCounted<CompositorFrameSinkHolder>;
+
+ ~CompositorFrameSinkHolder() override;
+
+ using ResourceReleaseCallbacks =
+ std::map<int,
+ std::pair<scoped_refptr<CompositorFrameSinkHolder>,
+ std::unique_ptr<cc::SingleReleaseCallback>>>;
+ ResourceReleaseCallbacks release_callbacks_;
+
+ std::unique_ptr<ExoCompositorFrameSink> compositor_frame_sink_;
+
+ Surface* surface_;
+
+ mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient> binding_;
+
+ DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkHolder);
+};
+
+} // namespace exo
+
+#endif // COMPONENTS_EXO_COMPOSITOR_FRAME_SINK_HOLDER_H_

Powered by Google App Engine
This is Rietveld 408576698