From 960da66f34fb7bd219c0cb8d313b25c8c54c1034 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Vo=C3=9F?= Date: Wed, 21 Sep 2016 21:18:27 +0200 Subject: [PATCH] Wire up mojo tracing (#3047) * Wire up to mojo::tracing::* infrastructure. * Initialize tracing as early as possible. * Make dependency specific to fuchsia. --- content_handler/BUILD.gn | 2 ++ content_handler/main.cc | 9 ++++++++- glue/BUILD.gn | 4 ++++ glue/trace_event.h | 8 +------- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/content_handler/BUILD.gn b/content_handler/BUILD.gn index 08d26c34dd..518a9fe045 100644 --- a/content_handler/BUILD.gn +++ b/content_handler/BUILD.gn @@ -36,6 +36,7 @@ executable("content_handler") { "//lib/ftl", "//lib/mtl", "//lib/zip", + "//mojo/public/c", "//mojo/public/cpp/application", "//mojo/public/cpp/bindings", "//mojo/public/cpp/system", @@ -43,6 +44,7 @@ executable("content_handler") { "//mojo/services/asset_bundle/interfaces", "//mojo/services/content_handler/interfaces", "//mojo/services/framebuffer/interfaces", + "//mojo/services/tracing/cpp", "//mojo/system", "//third_party/skia", diff --git a/content_handler/main.cc b/content_handler/main.cc index bb1f038a0a..a2d1d72c04 100644 --- a/content_handler/main.cc +++ b/content_handler/main.cc @@ -21,6 +21,7 @@ #include "mojo/public/cpp/application/run_application.h" #include "mojo/public/cpp/application/service_provider_impl.h" #include "mojo/services/content_handler/interfaces/content_handler.mojom.h" +#include "mojo/services/tracing/cpp/tracing_client.h" namespace flutter_content_handler { namespace { @@ -33,8 +34,10 @@ class App : public mojo::ApplicationImplBase { public: App() {} ~App() override { - if (initialized_) + if (initialized_) { StopThreads(); + mojo::tracing::DestroyTracer(); + } } // Overridden from ApplicationDelegate: @@ -42,6 +45,10 @@ class App : public mojo::ApplicationImplBase { FTL_DCHECK(!initialized_); initialized_ = true; + tracing::TraceProviderRegistryPtr registry; + ConnectToService(shell(), "mojo:tracing", GetProxy(®istry)); + mojo::tracing::InitializeTracer(std::move(registry)); + ftl::RefPtr gpu_task_runner; gpu_thread_ = mtl::CreateThread(&gpu_task_runner); diff --git a/glue/BUILD.gn b/glue/BUILD.gn index 81cc7893c7..e09380f2e1 100644 --- a/glue/BUILD.gn +++ b/glue/BUILD.gn @@ -29,6 +29,10 @@ source_set("glue") { deps += [ "//lib/mtl", ] + + public_deps = [ + "//mojo/services/tracing/cpp", + ] } else { sources += [ "drain_data_pipe_job_base.cc", diff --git a/glue/trace_event.h b/glue/trace_event.h index e84a2f2049..eaae7a8988 100644 --- a/glue/trace_event.h +++ b/glue/trace_event.h @@ -3,13 +3,7 @@ // found in the LICENSE file. #if defined(__Fuchsia__) -#define TRACE_EVENT0(a, b) -#define TRACE_EVENT1(a, b, c, d) -#define TRACE_EVENT2(a, b, c, d, e, f) -#define TRACE_EVENT_ASYNC_BEGIN0(a, b, c) -#define TRACE_EVENT_ASYNC_END0(a, b, c) -#define TRACE_EVENT_ASYNC_BEGIN1(a, b, c, d, e) -#define TRACE_EVENT_ASYNC_END1(a, b, c, d, e) +#include "mojo/services/tracing/cpp/macros.h" #else #include "base/trace_event/trace_event.h" #endif // defined(__Fuchsia__) -- GitLab