| Index: mojo/common/tracing_impl.cc
|
| diff --git a/mojo/common/tracing_impl.cc b/mojo/common/tracing_impl.cc
|
| index bfafcba1839aa87d35efb3b2eea82e73065e1284..c10b6126c2201e88d035b029909bf0e4ae26e52d 100644
|
| --- a/mojo/common/tracing_impl.cc
|
| +++ b/mojo/common/tracing_impl.cc
|
| @@ -5,57 +5,27 @@
|
| #include "mojo/common/tracing_impl.h"
|
|
|
| #include "base/debug/trace_event.h"
|
| +#include "mojo/common/trace_controller_impl.h"
|
| #include "mojo/public/cpp/application/application_connection.h"
|
| #include "mojo/public/cpp/application/application_impl.h"
|
|
|
| namespace mojo {
|
|
|
| -// static
|
| -void TracingImpl::Create(ApplicationImpl* app) {
|
| - new TracingImpl(app);
|
| -}
|
| -
|
| -// static
|
| -void TracingImpl::Create(tracing::TraceDataCollectorPtr ptr) {
|
| - new TracingImpl(ptr.Pass());
|
| -}
|
| -
|
| -TracingImpl::TracingImpl(ApplicationImpl* app) : binding_(this) {
|
| - ApplicationConnection* connection = app->ConnectToApplication("mojo:tracing");
|
| - tracing::TraceDataCollectorPtr trace_data_collector_ptr;
|
| - connection->ConnectToService(&trace_data_collector_ptr);
|
| - binding_.Bind(trace_data_collector_ptr.PassMessagePipe());
|
| -}
|
| -
|
| -TracingImpl::TracingImpl(tracing::TraceDataCollectorPtr ptr)
|
| - : binding_(this, ptr.PassMessagePipe()) {
|
| +TracingImpl::TracingImpl() {
|
| }
|
|
|
| TracingImpl::~TracingImpl() {
|
| }
|
|
|
| -void TracingImpl::StartTracing(const String& categories) {
|
| - std::string categories_str = categories.To<std::string>();
|
| - base::debug::TraceLog::GetInstance()->SetEnabled(
|
| - base::debug::CategoryFilter(categories_str),
|
| - base::debug::TraceLog::RECORDING_MODE,
|
| - base::debug::TraceOptions(base::debug::RECORD_UNTIL_FULL));
|
| -}
|
| -
|
| -void TracingImpl::StopTracing() {
|
| - base::debug::TraceLog::GetInstance()->SetDisabled();
|
| -
|
| - base::debug::TraceLog::GetInstance()->Flush(
|
| - base::Bind(&TracingImpl::SendChunk, base::Unretained(this)));
|
| +void TracingImpl::Initialize(ApplicationImpl* app) {
|
| + ApplicationConnection* connection = app->ConnectToApplication("mojo:tracing");
|
| + connection->AddService(this);
|
| }
|
|
|
| -void TracingImpl::SendChunk(
|
| - const scoped_refptr<base::RefCountedString>& events_str,
|
| - bool has_more_events) {
|
| - binding_.client()->DataCollected(mojo::String(events_str->data()));
|
| - if (!has_more_events) {
|
| - binding_.client()->EndTracing();
|
| - }
|
| +void TracingImpl::Create(ApplicationConnection* connection,
|
| + InterfaceRequest<tracing::TraceController> request) {
|
| + auto impl = new TraceControllerImpl;
|
| + impl->Bind(request.Pass());
|
| }
|
|
|
| } // namespace mojo
|
|
|