flutter_flutter/mojo/common/tracing_impl.cc
Adam Barth f91f5ad62f Update to mojo fd8d18dbf7a4f9ed8a607648cca6d2c595b1c580 (#2770)
* Update to mojo fd8d18dbf7a4f9ed8a607648cca6d2c595b1c580

* Update mojo_sdk

* Update to account for Mojo API changes

* Backport to older base
2016-06-21 12:52:09 -07:00

42 lines
1.2 KiB
C++

// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "mojo/common/tracing_impl.h"
#include <algorithm>
#include "base/trace_event/trace_event_impl.h"
#include "mojo/public/cpp/application/connect.h"
#include "mojo/public/cpp/bindings/interface_handle.h"
#include "mojo/public/cpp/bindings/interface_request.h"
#include "mojo/services/tracing/interfaces/trace_provider_registry.mojom.h"
#include "mojo/services/tracing/interfaces/tracing.mojom.h"
namespace mojo {
TracingImpl::TracingImpl() {}
TracingImpl::~TracingImpl() {}
void TracingImpl::Initialize(Shell* shell,
const std::vector<std::string>* args) {
tracing::TraceProviderRegistryPtr registry;
ConnectToService(shell, "mojo:tracing", GetProxy(&registry));
mojo::InterfaceHandle<tracing::TraceProvider> provider;
provider_impl_.Bind(GetProxy(&provider));
registry->RegisterTraceProvider(provider.Pass());
#ifdef NDEBUG
if (args) {
if (std::find(args->begin(), args->end(), "--early-tracing") != args->end())
provider_impl_.ForceEnableTracing();
}
#else
provider_impl_.ForceEnableTracing();
#endif
}
} // namespace mojo