OLD | NEW |
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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/profiler.h" | 8 #include "base/debug/profiler.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 Respond(connection_id, "Starting trace (type 'trace' to stop tracing)\n"); | 171 Respond(connection_id, "Starting trace (type 'trace' to stop tracing)\n"); |
172 } | 172 } |
173 | 173 |
174 void OnTraceAvailable(int connection_id, std::string trace) { | 174 void OnTraceAvailable(int connection_id, std::string trace) { |
175 trace_collector_.reset(); | 175 trace_collector_.reset(); |
176 Respond(connection_id, trace); | 176 Respond(connection_id, trace); |
177 } | 177 } |
178 | 178 |
179 void StartProfiling(int connection_id) { | 179 void StartProfiling(int connection_id) { |
180 base::debug::StartProfiling("sky_viewer.pprof"); | 180 base::debug::StartProfiling("sky_viewer.pprof"); |
181 Respond(connection_id, "Starting profiling (type 'stop_profiling' to stop"); | 181 Respond(connection_id, "Starting profiling (stop with 'stop_profiling')"); |
182 } | 182 } |
183 | 183 |
184 void StopProfiling(int connection_id) { | 184 void StopProfiling(int connection_id) { |
185 base::debug::StopProfiling(); | 185 base::debug::StopProfiling(); |
186 Respond(connection_id, "Stopped profiling"); | 186 Respond(connection_id, "Stopped profiling"); |
187 } | 187 } |
188 | 188 |
189 bool is_tracing_; | 189 bool is_tracing_; |
190 DebuggerPtr debugger_; | 190 DebuggerPtr debugger_; |
191 tracing::TraceCoordinatorPtr tracing_; | 191 tracing::TraceCoordinatorPtr tracing_; |
192 std::string url_; | 192 std::string url_; |
193 base::WeakPtrFactory<Prompt> weak_ptr_factory_; | 193 base::WeakPtrFactory<Prompt> weak_ptr_factory_; |
194 scoped_ptr<net::HttpServer> web_server_; | 194 scoped_ptr<net::HttpServer> web_server_; |
195 uint32_t command_port_; | 195 uint32_t command_port_; |
196 | 196 |
197 scoped_ptr<TraceCollector> trace_collector_; | 197 scoped_ptr<TraceCollector> trace_collector_; |
198 | 198 |
199 DISALLOW_COPY_AND_ASSIGN(Prompt); | 199 DISALLOW_COPY_AND_ASSIGN(Prompt); |
200 }; | 200 }; |
201 | 201 |
202 } // namespace debugger | 202 } // namespace debugger |
203 } // namespace sky | 203 } // namespace sky |
204 | 204 |
205 MojoResult MojoMain(MojoHandle shell_handle) { | 205 MojoResult MojoMain(MojoHandle shell_handle) { |
206 mojo::ApplicationRunnerChromium runner(new sky::debugger::Prompt); | 206 mojo::ApplicationRunnerChromium runner(new sky::debugger::Prompt); |
207 runner.set_message_loop_type(base::MessageLoop::TYPE_IO); | 207 runner.set_message_loop_type(base::MessageLoop::TYPE_IO); |
208 return runner.Run(shell_handle); | 208 return runner.Run(shell_handle); |
209 } | 209 } |
OLD | NEW |