Chromium Code Reviews| Index: mojo/common/tracing_impl.cc |
| diff --git a/mojo/common/tracing_impl.cc b/mojo/common/tracing_impl.cc |
| index bfafcba1839aa87d35efb3b2eea82e73065e1284..9c4c27696be5f3b7b34def24ecbc982cff16a611 100644 |
| --- a/mojo/common/tracing_impl.cc |
| +++ b/mojo/common/tracing_impl.cc |
| @@ -5,57 +5,26 @@ |
| #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); |
|
viettrungluu
2015/02/02 21:22:44
As discussed in person and not applying to this CL
|
| } |
| -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) { |
| + new TraceControllerImpl(request.Pass()); |
| } |
| } // namespace mojo |