mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Make sure only valid pipeline futures are awaited upon.
This commit is contained in:
parent
37aa63cf06
commit
d279337bdb
@ -12,6 +12,7 @@ namespace impeller {
|
||||
|
||||
struct Paint {
|
||||
Color color;
|
||||
Scalar stroke_width = 0.0;
|
||||
};
|
||||
|
||||
} // namespace impeller
|
||||
|
||||
@ -63,10 +63,21 @@ class PipelineT {
|
||||
context,
|
||||
Builder::MakeDefaultPipelineDescriptor(context))) {}
|
||||
|
||||
std::shared_ptr<Pipeline> WaitAndGet() { return pipeline_future_.get(); }
|
||||
std::shared_ptr<Pipeline> WaitAndGet() {
|
||||
if (did_wait_) {
|
||||
return pipeline_;
|
||||
}
|
||||
did_wait_ = true;
|
||||
if (pipeline_future_.valid()) {
|
||||
pipeline_ = pipeline_future_.get();
|
||||
}
|
||||
return pipeline_;
|
||||
}
|
||||
|
||||
private:
|
||||
PipelineFuture pipeline_future_;
|
||||
std::shared_ptr<Pipeline> pipeline_;
|
||||
bool did_wait_ = false;
|
||||
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(PipelineT);
|
||||
};
|
||||
|
||||
@ -31,8 +31,7 @@ bool EntityRendererImpl::RenderEntity(const Surface& surface,
|
||||
}
|
||||
|
||||
if (entity.HasContents()) {
|
||||
using CurrentPipeline = decltype(solid_fill_pipeline_)::element_type;
|
||||
using VS = CurrentPipeline::VertexShader;
|
||||
using VS = SolidFillPipeline::VertexShader;
|
||||
|
||||
Command cmd;
|
||||
cmd.pipeline = solid_fill_pipeline_->WaitAndGet();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user