Skip to content

Commit

Permalink
Enable tracing on Fuchsia (flutter#3116)
Browse files Browse the repository at this point in the history
  • Loading branch information
abarth authored Oct 12, 2016
1 parent 260faed commit 2ff316e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions content_handler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ executable("content_handler") {
"//flutter/sky/engine/platform",
"//lib/ftl",
"//lib/mtl",
"//lib/trace_event",
"//lib/zip",
"//mojo/public/cpp/application",
"//mojo/public/cpp/bindings",
Expand Down
9 changes: 8 additions & 1 deletion content_handler/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "lib/ftl/tasks/task_runner.h"
#include "lib/mtl/tasks/message_loop.h"
#include "lib/mtl/threading/create_thread.h"
#include "lib/trace_event/tracing_client.h"
#include "mojo/public/cpp/application/application_impl_base.h"
#include "mojo/public/cpp/application/connect.h"
#include "mojo/public/cpp/application/run_application.h"
Expand All @@ -33,15 +34,21 @@ class App : public mojo::ApplicationImplBase {
public:
App() {}
~App() override {
if (initialized_)
if (initialized_) {
StopThreads();
trace_event::DestroyTracer();
}
}

// Overridden from ApplicationDelegate:
void OnInitialize() override {
FTL_DCHECK(!initialized_);
initialized_ = true;

tracing::TraceProviderRegistryPtr registry;
ConnectToService(shell(), "mojo:tracing", GetProxy(&registry));
trace_event::InitializeTracer(std::move(registry));

ftl::RefPtr<ftl::TaskRunner> gpu_task_runner;
gpu_thread_ = mtl::CreateThread(&gpu_task_runner);

Expand Down
4 changes: 4 additions & 0 deletions glue/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ source_set("glue") {
deps += [
"//lib/mtl",
]

public_deps = [
"//lib/trace_event",
]
} else {
sources += [
"drain_data_pipe_job_base.cc",
Expand Down
8 changes: 1 addition & 7 deletions glue/trace_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 "lib/trace_event/macros.h"
#else
#include "base/trace_event/trace_event.h"
#endif // defined(__Fuchsia__)

0 comments on commit 2ff316e

Please sign in to comment.