From 33b412313e209dbe679348cbf56d627885005df2 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Wed, 1 Aug 2018 13:29:45 -0700 Subject: [PATCH] Fix sundry Fuchsia build issues after the tonic/fxl migration. (#5920) --- flow/BUILD.gn | 2 ++ flow/scene_update_context.h | 1 + fml/BUILD.gn | 4 ++++ fml/trace_event.h | 12 ++++++++---- lib/ui/compositing/scene_host.h | 1 + runtime/dart_vm.cc | 10 +++++----- 6 files changed, 21 insertions(+), 9 deletions(-) diff --git a/flow/BUILD.gn b/flow/BUILD.gn index 77853058e14a5..e311926fe25fe 100644 --- a/flow/BUILD.gn +++ b/flow/BUILD.gn @@ -60,6 +60,8 @@ source_set("flow") { public_configs = [ "$flutter_root:config" ] + public_deps = [] + deps = [ "$flutter_root/common", "$flutter_root/fml", diff --git a/flow/scene_update_context.h b/flow/scene_update_context.h index ac9659476ce4e..8436ad2f263bb 100644 --- a/flow/scene_update_context.h +++ b/flow/scene_update_context.h @@ -11,6 +11,7 @@ #include "flutter/flow/compositor_context.h" #include "flutter/fml/build_config.h" +#include "flutter/fml/compiler_specific.h" #include "flutter/fml/logging.h" #include "flutter/fml/macros.h" #include "lib/ui/scenic/cpp/resources.h" diff --git a/fml/BUILD.gn b/fml/BUILD.gn index 6d605ddf59f1a..aac3b3b3c34b8 100644 --- a/fml/BUILD.gn +++ b/fml/BUILD.gn @@ -60,6 +60,8 @@ source_set("fml") { "unique_object.h", ] + public_deps = [] + deps = [ "//third_party/dart/runtime:dart_api", @@ -129,6 +131,8 @@ source_set("fml") { if (is_fuchsia) { sources += [ "platform/fuchsia/paths_fuchsia.cc" ] + + public_deps += [ "//zircon/public/lib/trace-provider" ] } if (is_win) { diff --git a/fml/trace_event.h b/fml/trace_event.h index a3996c1738839..7a953adb23235 100644 --- a/fml/trace_event.h +++ b/fml/trace_event.h @@ -5,7 +5,9 @@ #ifndef FLUTTER_FML_TRACE_EVENT_H_ #define FLUTTER_FML_TRACE_EVENT_H_ -#if defined(__Fuchsia__) +#include "flutter/fml/build_config.h" + +#if defined(OS_FUCHSIA) // Forward to the system tracing mechanism on Fuchsia. @@ -19,7 +21,7 @@ #define TRACE_EVENT_ASYNC_BEGIN1(a, b, c, d, e) TRACE_ASYNC_BEGIN(a, b, c, d, e) #define TRACE_EVENT_ASYNC_END1(a, b, c, d, e) TRACE_ASYNC_END(a, b, c, d, e) -#else // defined(__Fuchsia__) +#endif // defined(OS_FUCHSIA) #include #include @@ -27,6 +29,8 @@ #include "flutter/fml/macros.h" +#if !defined(OS_FUCHSIA) + #ifndef TRACE_EVENT_HIDE_MACROS #define TRACE_EVENT0(category_group, name) \ @@ -72,6 +76,8 @@ #endif // TRACE_EVENT_HIDE_MACROS +#endif // !defined(OS_FUCHSIA) + namespace fml { namespace tracing { @@ -137,6 +143,4 @@ class ScopedInstantEnd { } // namespace tracing } // namespace fml -#endif // defined(__Fuchsia__) - #endif // FLUTTER_FML_TRACE_EVENT_H_ diff --git a/lib/ui/compositing/scene_host.h b/lib/ui/compositing/scene_host.h index 171506358d09b..897a4b754b3ec 100644 --- a/lib/ui/compositing/scene_host.h +++ b/lib/ui/compositing/scene_host.h @@ -7,6 +7,7 @@ #include +#include "flutter/fml/build_config.h" #include "flutter/lib/ui/dart_wrapper.h" #if defined(OS_FUCHSIA) diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index 3687303f4ae67..8f242cda1f13b 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -14,6 +14,7 @@ #include "flutter/fml/compiler_specific.h" #include "flutter/fml/file.h" #include "flutter/fml/logging.h" +#include "flutter/fml/mapping.h" #include "flutter/fml/time/time_delta.h" #include "flutter/fml/trace_event.h" #include "flutter/lib/io/dart_io.h" @@ -155,14 +156,13 @@ Dart_Handle GetVMServiceAssetsArchiveCallback() { (FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DYNAMIC_RELEASE) return nullptr; #elif OS_FUCHSIA - std::vector observatory_assets_archive; - if (!files::ReadFileToVector("pkg/data/observatory.tar", - &observatory_assets_archive)) { + fml::FileMapping mapping("pkg/data/observatory.tar", false /* executable */); + if (mapping.GetSize() == 0 || mapping.GetMapping() == nullptr) { FML_LOG(ERROR) << "Fail to load Observatory archive"; return nullptr; } - return tonic::DartConverter::ToDart( - observatory_assets_archive.data(), observatory_assets_archive.size()); + return tonic::DartConverter::ToDart(mapping.GetMapping(), + mapping.GetSize()); #else return tonic::DartConverter::ToDart( ::dart::observatory::observatory_assets_archive,