提交 960da66f 编写于 作者: T Thomas Voß 提交者: Adam Barth

Wire up mojo tracing (#3047)

* Wire up to mojo::tracing::* infrastructure.

* Initialize tracing as early as possible.

* Make dependency specific to fuchsia.
上级 75673cb0
...@@ -36,6 +36,7 @@ executable("content_handler") { ...@@ -36,6 +36,7 @@ executable("content_handler") {
"//lib/ftl", "//lib/ftl",
"//lib/mtl", "//lib/mtl",
"//lib/zip", "//lib/zip",
"//mojo/public/c",
"//mojo/public/cpp/application", "//mojo/public/cpp/application",
"//mojo/public/cpp/bindings", "//mojo/public/cpp/bindings",
"//mojo/public/cpp/system", "//mojo/public/cpp/system",
...@@ -43,6 +44,7 @@ executable("content_handler") { ...@@ -43,6 +44,7 @@ executable("content_handler") {
"//mojo/services/asset_bundle/interfaces", "//mojo/services/asset_bundle/interfaces",
"//mojo/services/content_handler/interfaces", "//mojo/services/content_handler/interfaces",
"//mojo/services/framebuffer/interfaces", "//mojo/services/framebuffer/interfaces",
"//mojo/services/tracing/cpp",
"//mojo/system", "//mojo/system",
"//third_party/skia", "//third_party/skia",
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "mojo/public/cpp/application/run_application.h" #include "mojo/public/cpp/application/run_application.h"
#include "mojo/public/cpp/application/service_provider_impl.h" #include "mojo/public/cpp/application/service_provider_impl.h"
#include "mojo/services/content_handler/interfaces/content_handler.mojom.h" #include "mojo/services/content_handler/interfaces/content_handler.mojom.h"
#include "mojo/services/tracing/cpp/tracing_client.h"
namespace flutter_content_handler { namespace flutter_content_handler {
namespace { namespace {
...@@ -33,8 +34,10 @@ class App : public mojo::ApplicationImplBase { ...@@ -33,8 +34,10 @@ class App : public mojo::ApplicationImplBase {
public: public:
App() {} App() {}
~App() override { ~App() override {
if (initialized_) if (initialized_) {
StopThreads(); StopThreads();
mojo::tracing::DestroyTracer();
}
} }
// Overridden from ApplicationDelegate: // Overridden from ApplicationDelegate:
...@@ -42,6 +45,10 @@ class App : public mojo::ApplicationImplBase { ...@@ -42,6 +45,10 @@ class App : public mojo::ApplicationImplBase {
FTL_DCHECK(!initialized_); FTL_DCHECK(!initialized_);
initialized_ = true; initialized_ = true;
tracing::TraceProviderRegistryPtr registry;
ConnectToService(shell(), "mojo:tracing", GetProxy(&registry));
mojo::tracing::InitializeTracer(std::move(registry));
ftl::RefPtr<ftl::TaskRunner> gpu_task_runner; ftl::RefPtr<ftl::TaskRunner> gpu_task_runner;
gpu_thread_ = mtl::CreateThread(&gpu_task_runner); gpu_thread_ = mtl::CreateThread(&gpu_task_runner);
......
...@@ -29,6 +29,10 @@ source_set("glue") { ...@@ -29,6 +29,10 @@ source_set("glue") {
deps += [ deps += [
"//lib/mtl", "//lib/mtl",
] ]
public_deps = [
"//mojo/services/tracing/cpp",
]
} else { } else {
sources += [ sources += [
"drain_data_pipe_job_base.cc", "drain_data_pipe_job_base.cc",
......
...@@ -3,13 +3,7 @@ ...@@ -3,13 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
#if defined(__Fuchsia__) #if defined(__Fuchsia__)
#define TRACE_EVENT0(a, b) #include "mojo/services/tracing/cpp/macros.h"
#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)
#else #else
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#endif // defined(__Fuchsia__) #endif // defined(__Fuchsia__)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册