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

Unified Diff: components/exo/exo_compositor_frame_sink.h

Issue 2493223002: Change exo::SurfaceFactoryOwner to exo::ExoCompositorFrameSink (Closed)
Patch Set: Undid a change on an if condition in exo::Surface::CommitSurfaceHierarchy() 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/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..58a3ca1791c5f526f08a7d80e8e55837255c5306
--- /dev/null
+++ b/components/exo/exo_compositor_frame_sink.h
@@ -0,0 +1,89 @@
+// 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 <memory>
+#include <utility>
+
+#include "base/callback.h"
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#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 "mojo/public/cpp/bindings/binding.h"
+#include "ui/gfx/geometry/rect.h"
+
+namespace cc {
+class SurfaceFactory;
+}
+
+namespace exo {
+
+// 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 cc::mojom::MojoCompositorFrameSink {
+ public:
+ ExoCompositorFrameSink(const cc::FrameSinkId& frame_sink_id,
+ cc::SurfaceManager* surface_manager,
+ cc::mojom::MojoCompositorFrameSinkClientPtr client);
+
+ ~ExoCompositorFrameSink() override;
+
+ // cc::mojom::MojoCompositorFrameSink:
+ void SetNeedsBeginFrame(bool needs_begin_frame) override;
+ void SubmitCompositorFrame(const cc::LocalFrameId& local_frame_id,
+ cc::CompositorFrame frame) override;
+ void EvictFrame() override;
+
+ private:
+ 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_

Powered by Google App Engine
This is Rietveld 408576698