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

Unified Diff: components/mus/surfaces/compositor_frame_sink_impl.h

Issue 1989693002: Introduce DisplayCompositor Mojo API for Mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix client_id Created 4 years, 7 months 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/mus/surfaces/compositor_frame_sink_impl.h
diff --git a/components/mus/surfaces/compositor_frame_sink_impl.h b/components/mus/surfaces/compositor_frame_sink_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..f1ec637a2fb01b189c4ec5a459781faa4066cc97
--- /dev/null
+++ b/components/mus/surfaces/compositor_frame_sink_impl.h
@@ -0,0 +1,74 @@
+// 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_MUS_SURFACES_COMPOSITOR_FRAME_SINK_IMPL_H_
+#define COMPONENTS_MUS_SURFACES_COMPOSITOR_FRAME_SINK_IMPL_H_
+
+#include "base/memory/ref_counted.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.h"
+#include "components/mus/public/interfaces/gpu/display_compositor.mojom.h"
+#include "components/mus/surfaces/surfaces_state.h"
+#include "mojo/public/cpp/bindings/strong_binding.h"
+
+namespace mus {
+namespace gpu {
+
+class CompositorFrameSinkDelegate;
+
+// A client presents visuals to screen by submitting CompositorFrames to a
+// CompositorFrameSink.
+class CompositorFrameSinkImpl : public cc::SurfaceFactoryClient,
+ public mojom::CompositorFrameSink,
+ public cc::BeginFrameObserver {
+ public:
+ CompositorFrameSinkImpl(
+ CompositorFrameSinkDelegate* delegate,
+ int sink_id,
+ const scoped_refptr<SurfacesState>& surfaces_state,
+ mojo::InterfaceRequest<mojom::CompositorFrameSink> request,
+ mojom::CompositorFrameSinkClientPtr client);
+ ~CompositorFrameSinkImpl() override;
+
+ // mojom::CompositorFrameSink implementation.
+ void SetNeedsBeginFrame(bool needs_begin_frame) override;
+ void SubmitCompositorFrame(
+ mus::mojom::CompositorFramePtr frame,
+ const SubmitCompositorFrameCallback& callback) override;
+
+ private:
+ // SurfaceFactoryClient implementation.
+ void ReturnResources(const cc::ReturnedResourceArray& resources) override;
+ void WillDrawSurface(cc::SurfaceId surface_id,
+ const gfx::Rect& damage_rect) override;
+ void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override;
+
+ // BeginFrameObserver implementation.
+ void OnBeginFrame(const cc::BeginFrameArgs& args) override;
+ const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override;
+ void OnBeginFrameSourcePausedChanged(bool paused) override;
+
+ void OnConnectionLost();
+
+ CompositorFrameSinkDelegate* const delegate_;
+ scoped_refptr<SurfacesState> surfaces_state_;
+ const int sink_id_;
+ cc::BeginFrameSource* begin_frame_source_;
+ bool needs_begin_frame_;
+ cc::BeginFrameArgs last_used_begin_frame_args_;
+ cc::SurfaceFactory factory_;
+ cc::SurfaceId surface_id_;
+ gfx::Size last_submitted_frame_size_;
+ mojom::CompositorFrameSinkClientPtr client_;
+ mojo::Binding<mojom::CompositorFrameSink> binding_;
+
+ DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkImpl);
+};
+
+} // namespace gpu
+} // namespace mus
+
+#endif // COMPONENTS_MUS_SURFACES_COMPOSITOR_FRAME_SINK_IMPL_H_
« no previous file with comments | « components/mus/surfaces/compositor_frame_sink_factory_impl.cc ('k') | components/mus/surfaces/compositor_frame_sink_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698