#ifndef CC_MOJO_EMBEDDER_VIZ_LAYER_CONTEXT_H_
#define CC_MOJO_EMBEDDER_VIZ_LAYER_CONTEXT_H_
#include "base/memory/raw_ptr.h"
#include "cc/mojo_embedder/mojo_embedder_export.h"
#include "cc/trees/layer_context.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "services/viz/public/mojom/compositing/compositor_frame_sink.mojom.h"
#include "services/viz/public/mojom/compositing/layer_context.mojom.h"
namespace cc {
class LayerContextClient;
}
namespace cc::mojo_embedder {
class CC_MOJO_EMBEDDER_EXPORT VizLayerContext
: public LayerContext,
public viz::mojom::LayerContextClient {
public:
VizLayerContext(viz::mojom::CompositorFrameSink& frame_sink,
cc::LayerContextClient* client);
~VizLayerContext() override;
void SetTargetLocalSurfaceId(const viz::LocalSurfaceId& id) override;
void SetVisible(bool visible) override;
void Commit(const CommitState& state) override;
void OnRequestCommitForFrame(const viz::BeginFrameArgs& args) override;
private:
raw_ptr<cc::LayerContextClient> client_;
mojo::AssociatedReceiver<viz::mojom::LayerContextClient> client_receiver_{
this};
mojo::AssociatedRemote<viz::mojom::LayerContext> service_;
};
}
#endif