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

Unified Diff: components/exo/compositor_frame_sink.cc

Issue 2493223002: Change exo::SurfaceFactoryOwner to exo::ExoCompositorFrameSink (Closed)
Patch Set: exo::Surface uses CompositorFrameSink accessor from CompositorFrameSinkHolder 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..95d0a3d1b5f0e35dcd35aa6336b2ee5deba1d513
--- /dev/null
+++ b/components/exo/compositor_frame_sink.cc
@@ -0,0 +1,94 @@
+// 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_ =
+ 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>()),
+ 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::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);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// ExoComopositorFrameSink, private:
reveman 2016/12/07 00:46:56 nit: "cc::CompositorFrameSinkSupportClient overrid
Alex Z. 2016/12/07 20:09:34 Done.
+
+void CompositorFrameSink::DidReceiveCompositorFrameAck() {
+ if (!client_)
reveman 2016/12/07 00:46:56 nit: here you early out when client_ == null but f
Alex Z. 2016/12/07 20:09:34 Done.
+ return;
+
+ 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