#ifndef CC_SLIM_SURFACE_LAYER_H_
#define CC_SLIM_SURFACE_LAYER_H_
#include "base/component_export.h"
#include "cc/layers/deadline_policy.h"
#include "cc/slim/layer.h"
#include "components/viz/common/surfaces/surface_id.h"
#include "components/viz/common/surfaces/surface_range.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
namespace cc {
class SurfaceLayer;
}
namespace cc::slim {
class COMPONENT_EXPORT(CC_SLIM) SurfaceLayer : public Layer {
public:
static scoped_refptr<SurfaceLayer> Create();
const viz::SurfaceId& surface_id() const;
void SetSurfaceId(const viz::SurfaceId& surface_id,
const cc::DeadlinePolicy& deadline_policy);
void SetStretchContentToFillBounds(bool stretch_content_to_fill_bounds);
bool stretch_content_to_fill_bounds() const;
void SetMayContainVideo(bool may_contain_video);
void SetOldestAcceptableFallback(const viz::SurfaceId& surface_id);
const absl::optional<viz::SurfaceId>& oldest_acceptable_fallback() const;
void SetLayerTree(LayerTree* layer_tree) override;
private:
explicit SurfaceLayer(scoped_refptr<cc::SurfaceLayer> cc_layer);
~SurfaceLayer() override;
cc::SurfaceLayer* cc_layer() const;
void SetSurfaceRange(const viz::SurfaceRange& surface_range);
void AppendQuads(viz::CompositorRenderPass& render_pass,
FrameData& data,
const gfx::Transform& transform_to_root,
const gfx::Transform& transform_to_target,
const gfx::Rect* clip_in_target,
const gfx::Rect& visible_rect,
float opacity) override;
bool stretch_content_to_fill_bounds_ = false;
viz::SurfaceRange surface_range_;
absl::optional<uint32_t> deadline_in_frames_;
};
}
#endif