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

Unified Diff: components/exo/compositor_frame_sink.cc

Issue 2493223002: Change exo::SurfaceFactoryOwner to exo::ExoCompositorFrameSink (Closed)
Patch Set: Added dependency //mojo/edk/embedder:headers to exo_unittests Created 4 years 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.cc
diff --git a/components/exo/compositor_frame_sink.cc b/components/exo/compositor_frame_sink.cc
new file mode 100644
index 0000000000000000000000000000000000000000..60d9c3eaed638e6daeda462a01d1a173dcc99744
--- /dev/null
+++ b/components/exo/compositor_frame_sink.cc
@@ -0,0 +1,104 @@
+// 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/compositor_frame_sink.h"
+
+#include "cc/surfaces/surface.h"
+#include "cc/surfaces/surface_manager.h"
+#include "mojo/public/cpp/bindings/strong_binding.h"
+
+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_ =
Fady Samuel 2016/12/08 13:16:56 This is really weird. Anyhow, I would recommend ma
Alex Z. 2016/12/09 16:16:27 Done.
+ mojo::MakeStrongBinding(std::move(impl), std::move(request));
+}
+
+CompositorFrameSink::CompositorFrameSink(
+ const cc::FrameSinkId& frame_sink_id,
+ cc::SurfaceManager* surface_manager,
+ cc::mojom::MojoCompositorFrameSinkClientPtr client)
+ : support_(this,
+ surface_manager,
+ frame_sink_id,
+ std::unique_ptr<cc::Display>()),
Fady Samuel 2016/12/08 13:16:56 nullptr
Alex Z. 2016/12/09 16:16:27 Done.
+ client_(std::move(client)) {}
+
+CompositorFrameSink::~CompositorFrameSink() {}
+
+////////////////////////////////////////////////////////////////////////////////
+// cc::mojom::MojoCompositorFrameSink overrides:
+
+void CompositorFrameSink::SetNeedsBeginFrame(bool needs_begin_frame) {
+ support_.SetNeedsBeginFrame(needs_begin_frame);
+}
+
+void CompositorFrameSink::SubmitCompositorFrame(
+ const cc::LocalFrameId& local_frame_id,
+ cc::CompositorFrame frame) {
+ support_.SubmitCompositorFrame(local_frame_id, std::move(frame));
+}
+
+void CompositorFrameSink::AddSurfaceReferences(
+ const std::vector<cc::SurfaceReference>& references) {
+ // TODO(fsamuel, staraz): Implement this.
+ NOTIMPLEMENTED();
+}
+
+void CompositorFrameSink::RemoveSurfaceReferences(
+ const std::vector<cc::SurfaceReference>& references) {
+ // TODO(fsamuel, staraz): Implement this.
+ NOTIMPLEMENTED();
+}
+
+void CompositorFrameSink::EvictFrame() {
+ support_.EvictFrame();
+}
+
+void CompositorFrameSink::Require(const cc::LocalFrameId& local_frame_id,
+ const cc::SurfaceSequence& sequence) {
+ support_.Require(local_frame_id, sequence);
+}
+
+void CompositorFrameSink::Satisfy(const cc::SurfaceSequence& sequence) {
+ support_.Satisfy(sequence);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// cc::CompositorFrameSinkSupportClient overrides:
+
+void CompositorFrameSink::DidReceiveCompositorFrameAck() {
+ if (client_)
+ client_->DidReceiveCompositorFrameAck();
+}
+
+void CompositorFrameSink::OnBeginFrame(const cc::BeginFrameArgs& args) {
+ if (client_)
+ client_->OnBeginFrame(args);
+}
+
+void CompositorFrameSink::ReclaimResources(
+ const cc::ReturnedResourceArray& resources) {
+ if (client_)
+ client_->ReclaimResources(resources);
+}
+
+void CompositorFrameSink::WillDrawSurface() {
+ if (client_)
+ client_->WillDrawSurface();
+}
+
+} // namespace exo

Powered by Google App Engine
This is Rietveld 408576698