未验证 提交 995965d3 编写于 作者: Y Yilong Li 提交者: GitHub

fuchsia: Remove display device availability check from Flutter. (#21495)

When Flutter engine connects to Scenic, Scenic has already
checked the display and graphics device availability before
Scenic starts; so it is guaranteed that display devices are
available and surface is valid when it is created.

Thus this change removes the device watching details from
flutter surface on Fuchsia so that it doesn't need to do
duplicated checks and hides the device-specific details.
上级 f0ab5b5c
......@@ -24,7 +24,7 @@ Surface::~Surface() = default;
// |flutter::Surface|
bool Surface::IsValid() {
return valid_;
return true;
}
// |flutter::Surface|
......@@ -42,30 +42,6 @@ GrDirectContext* Surface::GetContext() {
return gr_context_;
}
static zx_status_t DriverWatcher(int dirfd,
int event,
const char* fn,
void* cookie) {
if (event == WATCH_EVENT_ADD_FILE && !strcmp(fn, "000")) {
return ZX_ERR_STOP;
}
return ZX_OK;
}
bool Surface::CanConnectToDisplay() {
constexpr char kGpuDriverClass[] = "/dev/class/gpu";
fml::UniqueFD fd(open(kGpuDriverClass, O_DIRECTORY | O_RDONLY));
if (fd.get() < 0) {
FML_DLOG(ERROR) << "Failed to open " << kGpuDriverClass;
return false;
}
zx_status_t status = fdio_watch_directory(
fd.get(), DriverWatcher,
zx::deadline_after(zx::duration(ZX_SEC(5))).get(), nullptr);
return status == ZX_ERR_STOP;
}
// |flutter::Surface|
SkMatrix Surface::GetRootTransformation() const {
// This backend does not support delegating to the underlying platform to
......
......@@ -22,7 +22,6 @@ class Surface final : public flutter::Surface {
~Surface() override;
private:
const bool valid_ = CanConnectToDisplay();
const std::string debug_label_;
flutter::ExternalViewEmbedder* view_embedder_;
GrDirectContext* gr_context_;
......@@ -43,8 +42,6 @@ class Surface final : public flutter::Surface {
// |flutter::Surface|
flutter::ExternalViewEmbedder* GetExternalViewEmbedder() override;
static bool CanConnectToDisplay();
FML_DISALLOW_COPY_AND_ASSIGN(Surface);
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册