Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(515)

Side by Side Diff: services/tracing/main.cc

Issue 853943005: Make tracing work on Android (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Address reviewer comments Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « services/tracing/BUILD.gn ('k') | services/tracing/trace_data_sink.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "mojo/application/application_runner_chromium.h" 6 #include "mojo/application/application_runner_chromium.h"
7 #include "mojo/common/weak_binding_set.h" 7 #include "mojo/common/weak_binding_set.h"
8 #include "mojo/public/c/system/main.h" 8 #include "mojo/public/c/system/main.h"
9 #include "mojo/public/cpp/application/application_delegate.h" 9 #include "mojo/public/cpp/application/application_delegate.h"
10 #include "mojo/public/cpp/application/application_impl.h" 10 #include "mojo/public/cpp/application/application_impl.h"
(...skipping 26 matching lines...) Expand all
37 coordinator_bindings_.AddBinding(this, request.Pass()); 37 coordinator_bindings_.AddBinding(this, request.Pass());
38 } 38 }
39 39
40 // mojo::InterfaceFactory<TraceDataCollector> implementation. 40 // mojo::InterfaceFactory<TraceDataCollector> implementation.
41 void Create(mojo::ApplicationConnection* connection, 41 void Create(mojo::ApplicationConnection* connection,
42 mojo::InterfaceRequest<TraceDataCollector> request) override { 42 mojo::InterfaceRequest<TraceDataCollector> request) override {
43 collector_bindings_.AddBinding(this, request.Pass()); 43 collector_bindings_.AddBinding(this, request.Pass());
44 } 44 }
45 45
46 // tracing::TraceCoordinator implementation. 46 // tracing::TraceCoordinator implementation.
47 void Start(const mojo::String& base_name, 47 void Start(mojo::ScopedDataPipeProducerHandle stream,
48 const mojo::String& categories) override { 48 const mojo::String& categories) override {
49 base::FilePath base_name_path = 49 sink_.reset(new TraceDataSink(stream.Pass()));
50 base::FilePath::FromUTF8Unsafe(base_name.To<std::string>());
51 sink_.reset(new TraceDataSink(base_name_path));
52 collector_bindings_.ForAllBindings([categories]( 50 collector_bindings_.ForAllBindings([categories](
53 TraceController* controller) { controller->StartTracing(categories); }); 51 TraceController* controller) { controller->StartTracing(categories); });
54 } 52 }
55 void StopAndFlush() override { 53 void StopAndFlush() override {
56 collector_bindings_.ForAllBindings( 54 collector_bindings_.ForAllBindings(
57 [](TraceController* controller) { controller->StopTracing(); }); 55 [](TraceController* controller) { controller->StopTracing(); });
58 56
59 // TODO: We really should keep track of how many connections we have here 57 // TODO: We really should keep track of how many connections we have here
60 // and flush + reset the sink after we receive a EndTracing or a detect a 58 // and flush + reset the sink after we receive a EndTracing or a detect a
61 // pipe closure on all pipes. 59 // pipe closure on all pipes.
(...skipping 17 matching lines...) Expand all
79 77
80 DISALLOW_COPY_AND_ASSIGN(TracingApp); 78 DISALLOW_COPY_AND_ASSIGN(TracingApp);
81 }; 79 };
82 80
83 } // namespace tracing 81 } // namespace tracing
84 82
85 MojoResult MojoMain(MojoHandle shell_handle) { 83 MojoResult MojoMain(MojoHandle shell_handle) {
86 mojo::ApplicationRunnerChromium runner(new tracing::TracingApp); 84 mojo::ApplicationRunnerChromium runner(new tracing::TracingApp);
87 return runner.Run(shell_handle); 85 return runner.Run(shell_handle);
88 } 86 }
OLDNEW
« no previous file with comments | « services/tracing/BUILD.gn ('k') | services/tracing/trace_data_sink.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698