fuchsia: Fix potential SDK errors (flutter/engine#31099)

This commit is contained in:
David Worsham
2022-01-26 18:58:26 -08:00
committed by GitHub
parent 2bd5a5ab79
commit e743ccaac4
6 changed files with 16 additions and 51 deletions

2
DEPS
View File

@@ -101,7 +101,7 @@ allowed_hosts = [
]
deps = {
'src': 'https://github.com/flutter/buildroot.git' + '@' + '7effd695ad31ad2f0601fe88e03b31e277fc9857',
'src': 'https://github.com/flutter/buildroot.git' + '@' + 'e7dbdae2e0c91e42c45462fd2508dc6ef18469e0',
# Fuchsia compatibility
#

View File

@@ -171,10 +171,6 @@ FakeImage ImageFromState(FakeImageState* image, FakeResourceCache& cache) {
.width = image_def.width,
.height = image_def.height,
};
} else if constexpr (std::is_same_v<T, FakeImageState::ImagePipeDef>) {
snapshot.image_def = FakeImage::ImagePipeDef{
.image_pipe_request = image_def.image_pipe_request.koid,
};
} else if constexpr (std::is_same_v<T, FakeImageState::ImagePipe2Def>) {
snapshot.image_def = FakeImage::ImagePipe2Def{
.image_pipe_request = image_def.image_pipe_request.koid,

View File

@@ -298,14 +298,6 @@ struct FakeImageT {
uint32_t height{};
};
struct ImagePipeDef {
bool operator==(const ImagePipeDef& other) const;
typename S::template HandleT<
fidl::InterfaceRequest<fuchsia::images::ImagePipe>>
image_pipe_request{};
};
struct ImagePipe2Def {
bool operator==(const ImagePipe2Def& other) const;
@@ -316,8 +308,7 @@ struct FakeImageT {
bool operator==(const FakeImageT& other) const;
std::variant<ImageDef, Image2Def, Image3Def, ImagePipeDef, ImagePipe2Def>
image_def;
std::variant<ImageDef, Image2Def, Image3Def, ImagePipe2Def> image_def;
std::shared_ptr<typename S::ResourceT> memory;
};
using FakeImageState = FakeImageT<StateT>;
@@ -508,14 +499,6 @@ bool FakeImageT<S>::Image3Def::operator==(
width == other.width && height == other.height;
}
template <typename S>
bool FakeImageT<S>::ImagePipeDef::operator==(
const FakeImageT<S>::ImagePipeDef& other) const {
return S::template HandlesAreEqual<
fidl::InterfaceRequest<fuchsia::images::ImagePipe>>(
image_pipe_request, other.image_pipe_request);
}
template <typename S>
bool FakeImageT<S>::ImagePipe2Def::operator==(
const FakeImageT<S>::ImagePipe2Def& other) const {

View File

@@ -108,7 +108,7 @@ void FakeSession::Present(uint64_t presentation_time,
ApplyCommands();
PresentHandler present_handler =
present_handler_ ? present_handler_ : [](auto... args) -> auto {
present_handler_ ? present_handler_ : [](auto... args) -> auto{
return fuchsia::images::PresentationInfo{};
};
@@ -124,7 +124,7 @@ void FakeSession::Present2(fuchsia::ui::scenic::Present2Args args,
ApplyCommands();
Present2Handler present2_handler =
present2_handler_ ? present2_handler_ : [](auto args) -> auto {
present2_handler_ ? present2_handler_ : [](auto args) -> auto{
return fuchsia::scenic::scheduling::FuturePresentationTimes{
.future_presentations = {},
.remaining_presents_in_flight_allowed = 1,
@@ -142,7 +142,7 @@ void FakeSession::RequestPresentationTimes(
RequestPresentationTimesCallback callback) {
RequestPresentationTimesHandler request_presentation_times_handler =
request_presentation_times_handler_ ? request_presentation_times_handler_
: [](auto args) -> auto {
: [](auto args) -> auto{
return fuchsia::scenic::scheduling::FuturePresentationTimes{
.future_presentations = {},
.remaining_presents_in_flight_allowed = 1,
@@ -521,10 +521,6 @@ void FakeSession::ApplyCreateResourceCmd(
case fuchsia::ui::gfx::ResourceArgs::Tag::kImage3:
ApplyCreateImage3(resource_id, std::move(command.resource.image3()));
break;
case fuchsia::ui::gfx::ResourceArgs::Tag::kImagePipe:
ApplyCreateImagePipe(resource_id,
std::move(command.resource.image_pipe()));
break;
case fuchsia::ui::gfx::ResourceArgs::Tag::kImagePipe2:
ApplyCreateImagePipe2(resource_id,
std::move(command.resource.image_pipe2()));
@@ -600,9 +596,6 @@ void FakeSession::ApplyCreateResourceCmd(
case fuchsia::ui::gfx::ResourceArgs::Tag::kDisplayCompositor:
NotImplemented_("CreateDisplayCompositorResource");
break;
case fuchsia::ui::gfx::ResourceArgs::Tag::kImagePipeCompositor:
NotImplemented_("CreateImagePipeCompositorResource");
break;
case fuchsia::ui::gfx::ResourceArgs::Tag::kLayerStack:
NotImplemented_("CreateLayerStackResource");
break;
@@ -615,6 +608,8 @@ void FakeSession::ApplyCreateResourceCmd(
case fuchsia::ui::gfx::ResourceArgs::Tag::Invalid:
FML_LOG(FATAL) << "FakeSession found Invalid CreateResource command";
break;
default:
FML_UNREACHABLE();
}
}
@@ -1019,21 +1014,6 @@ void FakeSession::ApplyCreateImage3(FakeResourceId id,
}});
}
void FakeSession::ApplyCreateImagePipe(FakeResourceId id,
fuchsia::ui::gfx::ImagePipeArgs args) {
zx_koid_t image_pipe_request_koid =
GetKoid(args.image_pipe_request.channel().get());
AddResource(
{.id = id,
.state = FakeImageState{
.image_def =
FakeImageState::ImagePipeDef{
.image_pipe_request = {std::move(args.image_pipe_request),
image_pipe_request_koid},
},
}});
}
void FakeSession::ApplyCreateImagePipe2(FakeResourceId id,
fuchsia::ui::gfx::ImagePipe2Args args) {
zx_koid_t image_pipe_request_koid =

View File

@@ -191,8 +191,6 @@ class FakeSession : public fuchsia::ui::scenic::testing::Session_TestBase {
void ApplyCreateImage(FakeResourceId id, fuchsia::ui::gfx::ImageArgs args);
void ApplyCreateImage2(FakeResourceId id, fuchsia::ui::gfx::ImageArgs2 args);
void ApplyCreateImage3(FakeResourceId id, fuchsia::ui::gfx::ImageArgs3 args);
void ApplyCreateImagePipe(FakeResourceId id,
fuchsia::ui::gfx::ImagePipeArgs args);
void ApplyCreateImagePipe2(FakeResourceId id,
fuchsia::ui::gfx::ImagePipe2Args args);
void ApplyCreateRectangle(FakeResourceId id,

View File

@@ -111,7 +111,15 @@ template("sdk_targets") {
if (part_meta != "version_history.json") {
subtarget_name = part_meta_json.name
if (part.type == target_type) {
# Check if the part is using `part.element_type` or `part.type`.
part_type = ""
if (defined(part.element_type)) {
part_type = part.element_type
} else if (defined(part.type)) {
part_type = part.type
}
if (part_type == target_type) {
if (target_type == "dart_library") {
_fuchsia_dart_library(subtarget_name) {
meta = part_meta_json