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

Side by Side Diff: chromeos/dbus/debug_daemon_client.cc

Issue 2081153002: No dbus::FileDescriptor in DebugDaemonClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test Created 4 years, 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chromeos/dbus/debug_daemon_client.h" 5 #include "chromeos/dbus/debug_daemon_client.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 21 matching lines...) Expand all
32 namespace chromeos { 32 namespace chromeos {
33 33
34 namespace { 34 namespace {
35 35
36 const char kCrOSTracingAgentName[] = "cros"; 36 const char kCrOSTracingAgentName[] = "cros";
37 const char kCrOSTraceLabel[] = "systemTraceEvents"; 37 const char kCrOSTraceLabel[] = "systemTraceEvents";
38 38
39 // Because the cheets logs are very huge, we set the D-Bus timeout to 2 minutes. 39 // Because the cheets logs are very huge, we set the D-Bus timeout to 2 minutes.
40 const int kBigLogsDBusTimeoutMS = 120 * 1000; 40 const int kBigLogsDBusTimeoutMS = 120 * 1000;
41 41
42 // The type of the callback to be invoked once the pipe reader has been
43 // initialized and a D-Bus file descriptor has been created for it.
44 using OnPipeReaderInitializedCallback =
45 base::Callback<void(dbus::ScopedFileDescriptor)>;
46
47 // Used in DebugDaemonClient::EmptyStopAgentTracingCallback(). 42 // Used in DebugDaemonClient::EmptyStopAgentTracingCallback().
48 void EmptyStopAgentTracingCallbackBody( 43 void EmptyStopAgentTracingCallbackBody(
49 const std::string& agent_name, 44 const std::string& agent_name,
50 const std::string& events_label, 45 const std::string& events_label,
51 const scoped_refptr<base::RefCountedString>& unused_result) {} 46 const scoped_refptr<base::RefCountedString>& unused_result) {}
52 47
53 // Creates a D-Bus file descriptor from a base::File.
54 dbus::ScopedFileDescriptor CreateFileDescriptorForPipeWriteEnd(
55 base::File pipe_write_end) {
56 if (!pipe_write_end.IsValid()) {
57 VLOG(1) << "Cannot create pipe reader";
58 // NB: continue anyway; toss the data
59 pipe_write_end.Initialize(base::FilePath(FILE_PATH_LITERAL("/dev/null")),
60 base::File::FLAG_OPEN | base::File::FLAG_WRITE);
61 // TODO(afakhry): If this fails AppendFileDescriptor will abort.
62 }
63 dbus::ScopedFileDescriptor file_descriptor(new dbus::FileDescriptor);
64 file_descriptor->PutValue(pipe_write_end.TakePlatformFile());
65 file_descriptor->CheckValidity();
66 return file_descriptor;
67 }
68
69 // A self-deleting object that wraps the pipe reader operations for reading the 48 // A self-deleting object that wraps the pipe reader operations for reading the
70 // big feedback logs. It will delete itself once the pipe stream has been 49 // big feedback logs. It will delete itself once the pipe stream has been
71 // terminated. Once the data has been completely read from the pipe, it invokes 50 // terminated. Once the data has been completely read from the pipe, it invokes
72 // the GetLogsCallback |callback| passing the deserialized logs data back to 51 // the GetLogsCallback |callback| passing the deserialized logs data back to
73 // the requester. 52 // the requester.
74 class PipeReaderWrapper : public base::SupportsWeakPtr<PipeReaderWrapper> { 53 class PipeReaderWrapper : public base::SupportsWeakPtr<PipeReaderWrapper> {
75 public: 54 public:
76 explicit PipeReaderWrapper(const DebugDaemonClient::GetLogsCallback& callback) 55 explicit PipeReaderWrapper(const DebugDaemonClient::GetLogsCallback& callback)
77 : task_runner_( 56 : task_runner_(
78 base::WorkerPool::GetTaskRunner(true /** tasks_are_slow */)), 57 base::WorkerPool::GetTaskRunner(true /** tasks_are_slow */)),
79 pipe_reader_(task_runner_, 58 pipe_reader_(task_runner_,
80 base::Bind(&PipeReaderWrapper::OnIOComplete, AsWeakPtr())), 59 base::Bind(&PipeReaderWrapper::OnIOComplete, AsWeakPtr())),
81 callback_(callback) {} 60 callback_(callback) {}
82 61
83 void Initialize(const OnPipeReaderInitializedCallback& on_initialized) { 62 base::File Initialize() { return pipe_reader_.StartIO(); }
84 base::File pipe_write_end = pipe_reader_.StartIO();
85 base::PostTaskAndReplyWithResult(
86 task_runner_.get(), FROM_HERE,
87 base::Bind(&CreateFileDescriptorForPipeWriteEnd,
88 base::Passed(&pipe_write_end)),
89 on_initialized);
90 }
91 63
92 void OnIOComplete() { 64 void OnIOComplete() {
93 std::string pipe_data; 65 std::string pipe_data;
94 pipe_reader_.GetData(&pipe_data); 66 pipe_reader_.GetData(&pipe_data);
95 JSONStringValueDeserializer json_reader(pipe_data); 67 JSONStringValueDeserializer json_reader(pipe_data);
96 68
97 std::map<std::string, std::string> data; 69 std::map<std::string, std::string> data;
98 const base::DictionaryValue* dictionary = nullptr; 70 const base::DictionaryValue* dictionary = nullptr;
99 std::unique_ptr<base::Value> logs_value = 71 std::unique_ptr<base::Value> logs_value =
100 json_reader.Deserialize(nullptr, nullptr); 72 json_reader.Deserialize(nullptr, nullptr);
(...skipping 29 matching lines...) Expand all
130 102
131 // The DebugDaemonClient implementation used in production. 103 // The DebugDaemonClient implementation used in production.
132 class DebugDaemonClientImpl : public DebugDaemonClient { 104 class DebugDaemonClientImpl : public DebugDaemonClient {
133 public: 105 public:
134 DebugDaemonClientImpl() : debugdaemon_proxy_(NULL), weak_ptr_factory_(this) {} 106 DebugDaemonClientImpl() : debugdaemon_proxy_(NULL), weak_ptr_factory_(this) {}
135 107
136 ~DebugDaemonClientImpl() override {} 108 ~DebugDaemonClientImpl() override {}
137 109
138 // DebugDaemonClient override. 110 // DebugDaemonClient override.
139 void DumpDebugLogs(bool is_compressed, 111 void DumpDebugLogs(bool is_compressed,
140 base::File file, 112 int file_descriptor,
141 scoped_refptr<base::TaskRunner> task_runner,
142 const GetDebugLogsCallback& callback) override { 113 const GetDebugLogsCallback& callback) override {
143 dbus::FileDescriptor* file_descriptor = new dbus::FileDescriptor; 114 // Issue the dbus request to get debug logs.
144 file_descriptor->PutValue(file.TakePlatformFile()); 115 dbus::MethodCall method_call(debugd::kDebugdInterface,
145 // Punt descriptor validity check to a worker thread; on return we'll 116 debugd::kDumpDebugLogs);
146 // issue the D-Bus request to stop tracing and collect results. 117 dbus::MessageWriter writer(&method_call);
147 task_runner->PostTaskAndReply( 118 writer.AppendBool(is_compressed);
148 FROM_HERE, 119 writer.AppendFileDescriptor(file_descriptor);
149 base::Bind(&dbus::FileDescriptor::CheckValidity, 120 debugdaemon_proxy_->CallMethod(
150 base::Unretained(file_descriptor)), 121 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
151 base::Bind(&DebugDaemonClientImpl::OnCheckValidityGetDebugLogs, 122 base::Bind(&DebugDaemonClientImpl::OnGetDebugLogs,
152 weak_ptr_factory_.GetWeakPtr(), 123 weak_ptr_factory_.GetWeakPtr(), callback));
153 is_compressed,
154 base::Owned(file_descriptor),
155 callback));
156 } 124 }
157 125
158 void SetDebugMode(const std::string& subsystem, 126 void SetDebugMode(const std::string& subsystem,
159 const SetDebugModeCallback& callback) override { 127 const SetDebugModeCallback& callback) override {
160 dbus::MethodCall method_call(debugd::kDebugdInterface, 128 dbus::MethodCall method_call(debugd::kDebugdInterface,
161 debugd::kSetDebugMode); 129 debugd::kSetDebugMode);
162 dbus::MessageWriter writer(&method_call); 130 dbus::MessageWriter writer(&method_call);
163 writer.AppendString(subsystem); 131 writer.AppendString(subsystem);
164 debugdaemon_proxy_->CallMethod( 132 debugdaemon_proxy_->CallMethod(
165 &method_call, 133 &method_call,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 debugdaemon_proxy_->CallMethod( 203 debugdaemon_proxy_->CallMethod(
236 &method_call, 204 &method_call,
237 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 205 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
238 base::Bind(&DebugDaemonClientImpl::OnGetNetworkInterfaces, 206 base::Bind(&DebugDaemonClientImpl::OnGetNetworkInterfaces,
239 weak_ptr_factory_.GetWeakPtr(), 207 weak_ptr_factory_.GetWeakPtr(),
240 callback)); 208 callback));
241 } 209 }
242 210
243 void GetPerfOutput(base::TimeDelta duration, 211 void GetPerfOutput(base::TimeDelta duration,
244 const std::vector<std::string>& perf_args, 212 const std::vector<std::string>& perf_args,
245 dbus::ScopedFileDescriptor file_descriptor, 213 int file_descriptor,
246 const DBusMethodErrorCallback& error_callback) override { 214 const DBusMethodErrorCallback& error_callback) override {
247 DCHECK(file_descriptor); 215 DCHECK(file_descriptor);
248 dbus::MethodCall method_call(debugd::kDebugdInterface, 216 dbus::MethodCall method_call(debugd::kDebugdInterface,
249 debugd::kGetPerfOutputFd); 217 debugd::kGetPerfOutputFd);
250 dbus::MessageWriter writer(&method_call); 218 dbus::MessageWriter writer(&method_call);
251 writer.AppendUint32(duration.InSeconds()); 219 writer.AppendUint32(duration.InSeconds());
252 writer.AppendArrayOfStrings(perf_args); 220 writer.AppendArrayOfStrings(perf_args);
253 writer.AppendFileDescriptor(*file_descriptor); 221 writer.AppendFileDescriptor(file_descriptor);
254 222
255 debugdaemon_proxy_->CallMethodWithErrorCallback( 223 debugdaemon_proxy_->CallMethodWithErrorCallback(
256 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 224 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
257 dbus::ObjectProxy::EmptyResponseCallback(), 225 dbus::ObjectProxy::EmptyResponseCallback(),
258 base::Bind(&DebugDaemonClientImpl::OnDBusMethodError, 226 base::Bind(&DebugDaemonClientImpl::OnDBusMethodError,
259 weak_ptr_factory_.GetWeakPtr(), error_callback)); 227 weak_ptr_factory_.GetWeakPtr(), error_callback));
260 } 228 }
261 229
262 void GetScrubbedLogs(const GetLogsCallback& callback) override { 230 void GetScrubbedLogs(const GetLogsCallback& callback) override {
263 dbus::MethodCall method_call(debugd::kDebugdInterface, 231 dbus::MethodCall method_call(debugd::kDebugdInterface,
264 debugd::kGetFeedbackLogs); 232 debugd::kGetFeedbackLogs);
265 debugdaemon_proxy_->CallMethod( 233 debugdaemon_proxy_->CallMethod(
266 &method_call, 234 &method_call,
267 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 235 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
268 base::Bind(&DebugDaemonClientImpl::OnGetAllLogs, 236 base::Bind(&DebugDaemonClientImpl::OnGetAllLogs,
269 weak_ptr_factory_.GetWeakPtr(), 237 weak_ptr_factory_.GetWeakPtr(),
270 callback)); 238 callback));
271 } 239 }
272 240
273 void GetScrubbedBigLogs(const GetLogsCallback& callback) override { 241 void GetScrubbedBigLogs(const GetLogsCallback& callback) override {
274 // The PipeReaderWrapper is a self-deleting object; we don't have to worry 242 // The PipeReaderWrapper is a self-deleting object; we don't have to worry
275 // about ownership or lifetime. We need to create a new one for each Big 243 // about ownership or lifetime. We need to create a new one for each Big
276 // Logs requests in order to queue these requests. One request can take a 244 // Logs requests in order to queue these requests. One request can take a
277 // long time to be processed and a new request should never be ignored nor 245 // long time to be processed and a new request should never be ignored nor
278 // cancels the on-going one. 246 // cancels the on-going one.
279 PipeReaderWrapper* pipe_reader = new PipeReaderWrapper(callback); 247 PipeReaderWrapper* pipe_reader = new PipeReaderWrapper(callback);
280 pipe_reader->Initialize( 248 base::File pipe_write_end = pipe_reader->Initialize();
281 base::Bind(&DebugDaemonClientImpl::OnBigLogsPipeReaderReady, 249
250 dbus::MethodCall method_call(debugd::kDebugdInterface,
251 debugd::kGetBigFeedbackLogs);
252 dbus::MessageWriter writer(&method_call);
253 writer.AppendFileDescriptor(pipe_write_end.GetPlatformFile());
254
255 DVLOG(1) << "Requesting big feedback logs";
256 debugdaemon_proxy_->CallMethod(
257 &method_call, kBigLogsDBusTimeoutMS,
258 base::Bind(&DebugDaemonClientImpl::OnBigFeedbackLogsResponse,
282 weak_ptr_factory_.GetWeakPtr(), pipe_reader->AsWeakPtr())); 259 weak_ptr_factory_.GetWeakPtr(), pipe_reader->AsWeakPtr()));
283 } 260 }
284 261
285 void GetAllLogs(const GetLogsCallback& callback) override { 262 void GetAllLogs(const GetLogsCallback& callback) override {
286 dbus::MethodCall method_call(debugd::kDebugdInterface, 263 dbus::MethodCall method_call(debugd::kDebugdInterface,
287 debugd::kGetAllLogs); 264 debugd::kGetAllLogs);
288 debugdaemon_proxy_->CallMethod( 265 debugdaemon_proxy_->CallMethod(
289 &method_call, 266 &method_call,
290 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 267 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
291 base::Bind(&DebugDaemonClientImpl::OnGetAllLogs, 268 base::Bind(&DebugDaemonClientImpl::OnGetAllLogs,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 LOG(ERROR) << "Busy doing StopSystemTracing"; 312 LOG(ERROR) << "Busy doing StopSystemTracing";
336 return; 313 return;
337 } 314 }
338 315
339 pipe_reader_.reset( 316 pipe_reader_.reset(
340 new PipeReaderForString(stop_agent_tracing_task_runner_, 317 new PipeReaderForString(stop_agent_tracing_task_runner_,
341 base::Bind(&DebugDaemonClientImpl::OnIOComplete, 318 base::Bind(&DebugDaemonClientImpl::OnIOComplete,
342 weak_ptr_factory_.GetWeakPtr()))); 319 weak_ptr_factory_.GetWeakPtr())));
343 320
344 base::File pipe_write_end = pipe_reader_->StartIO(); 321 base::File pipe_write_end = pipe_reader_->StartIO();
345 // Create dbus::FileDescriptor on the worker thread; on return we'll 322 DCHECK(pipe_write_end.IsValid());
346 // issue the D-Bus request to stop tracing and collect results. 323 // Issue the dbus request to stop system tracing
347 base::PostTaskAndReplyWithResult( 324 dbus::MethodCall method_call(debugd::kDebugdInterface,
348 stop_agent_tracing_task_runner_.get(), FROM_HERE, 325 debugd::kSystraceStop);
349 base::Bind(&CreateFileDescriptorForPipeWriteEnd, 326 dbus::MessageWriter writer(&method_call);
350 base::Passed(&pipe_write_end)), 327 writer.AppendFileDescriptor(pipe_write_end.GetPlatformFile());
351 base::Bind( 328
352 &DebugDaemonClientImpl::OnCreateFileDescriptorRequestStopSystem, 329 callback_ = callback;
353 weak_ptr_factory_.GetWeakPtr(), callback)); 330
331 DVLOG(1) << "Requesting a systrace stop";
332 debugdaemon_proxy_->CallMethod(
333 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
334 base::Bind(&DebugDaemonClientImpl::OnStopAgentTracing,
335 weak_ptr_factory_.GetWeakPtr()));
354 } 336 }
355 337
356 void SetStopAgentTracingTaskRunner( 338 void SetStopAgentTracingTaskRunner(
357 scoped_refptr<base::TaskRunner> task_runner) override { 339 scoped_refptr<base::TaskRunner> task_runner) override {
358 stop_agent_tracing_task_runner_ = task_runner; 340 stop_agent_tracing_task_runner_ = task_runner;
359 } 341 }
360 342
361 void TestICMP(const std::string& ip_address, 343 void TestICMP(const std::string& ip_address,
362 const TestICMPCallback& callback) override { 344 const TestICMPCallback& callback) override {
363 dbus::MethodCall method_call(debugd::kDebugdInterface, 345 dbus::MethodCall method_call(debugd::kDebugdInterface,
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 } 443 }
462 444
463 protected: 445 protected:
464 void Init(dbus::Bus* bus) override { 446 void Init(dbus::Bus* bus) override {
465 debugdaemon_proxy_ = 447 debugdaemon_proxy_ =
466 bus->GetObjectProxy(debugd::kDebugdServiceName, 448 bus->GetObjectProxy(debugd::kDebugdServiceName,
467 dbus::ObjectPath(debugd::kDebugdServicePath)); 449 dbus::ObjectPath(debugd::kDebugdServicePath));
468 } 450 }
469 451
470 private: 452 private:
471 // Called when a CheckValidity response is received.
472 void OnCheckValidityGetDebugLogs(bool is_compressed,
473 dbus::FileDescriptor* file_descriptor,
474 const GetDebugLogsCallback& callback) {
475 // Issue the dbus request to get debug logs.
476 dbus::MethodCall method_call(debugd::kDebugdInterface,
477 debugd::kDumpDebugLogs);
478 dbus::MessageWriter writer(&method_call);
479 writer.AppendBool(is_compressed);
480 writer.AppendFileDescriptor(*file_descriptor);
481
482 debugdaemon_proxy_->CallMethod(
483 &method_call,
484 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
485 base::Bind(&DebugDaemonClientImpl::OnGetDebugLogs,
486 weak_ptr_factory_.GetWeakPtr(),
487 callback));
488 }
489
490 // Called when a response for GetDebugLogs() is received. 453 // Called when a response for GetDebugLogs() is received.
491 void OnGetDebugLogs(const GetDebugLogsCallback& callback, 454 void OnGetDebugLogs(const GetDebugLogsCallback& callback,
492 dbus::Response* response) { 455 dbus::Response* response) {
493 if (!response) { 456 if (!response) {
494 LOG(ERROR) << "Failed to get debug logs"; 457 LOG(ERROR) << "Failed to get debug logs";
495 callback.Run(false); 458 callback.Run(false);
496 return; 459 return;
497 } 460 }
498 callback.Run(true); 461 callback.Run(true);
499 } 462 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 logs[key] = value; 545 logs[key] = value;
583 } 546 }
584 callback.Run(!sub_reader.HasMoreData() && !broken, logs); 547 callback.Run(!sub_reader.HasMoreData() && !broken, logs);
585 } 548 }
586 549
587 void OnGetUserLogFiles(const GetLogsCallback& callback, 550 void OnGetUserLogFiles(const GetLogsCallback& callback,
588 dbus::Response* response) { 551 dbus::Response* response) {
589 return OnGetAllLogs(callback, response); 552 return OnGetAllLogs(callback, response);
590 } 553 }
591 554
592 void OnBigLogsPipeReaderReady(base::WeakPtr<PipeReaderWrapper> pipe_reader,
593 dbus::ScopedFileDescriptor file_descriptor) {
594 DCHECK(file_descriptor);
595
596 dbus::MethodCall method_call(debugd::kDebugdInterface,
597 debugd::kGetBigFeedbackLogs);
598 dbus::MessageWriter writer(&method_call);
599 writer.AppendFileDescriptor(*file_descriptor);
600
601 DVLOG(1) << "Requesting big feedback logs";
602 debugdaemon_proxy_->CallMethod(
603 &method_call, kBigLogsDBusTimeoutMS,
604 base::Bind(&DebugDaemonClientImpl::OnBigFeedbackLogsResponse,
605 weak_ptr_factory_.GetWeakPtr(), pipe_reader));
606 }
607
608 void OnBigFeedbackLogsResponse(base::WeakPtr<PipeReaderWrapper> pipe_reader, 555 void OnBigFeedbackLogsResponse(base::WeakPtr<PipeReaderWrapper> pipe_reader,
609 dbus::Response* response) { 556 dbus::Response* response) {
610 if (!response && pipe_reader.get()) { 557 if (!response && pipe_reader.get()) {
611 // We need to terminate the data stream if an error occurred while the 558 // We need to terminate the data stream if an error occurred while the
612 // pipe reader is still waiting on read. 559 // pipe reader is still waiting on read.
613 pipe_reader->TerminateStream(); 560 pipe_reader->TerminateStream();
614 } 561 }
615 } 562 }
616 563
617 // Called when a response for a simple start is received. 564 // Called when a response for a simple start is received.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 609
663 void OnRemoveRootfsVerification( 610 void OnRemoveRootfsVerification(
664 const EnableDebuggingCallback& callback, 611 const EnableDebuggingCallback& callback,
665 dbus::Response* response) { 612 dbus::Response* response) {
666 if (callback.is_null()) 613 if (callback.is_null())
667 return; 614 return;
668 615
669 callback.Run(response != NULL); 616 callback.Run(response != NULL);
670 } 617 }
671 618
672 // Called when a CheckValidity response is received.
673 void OnCreateFileDescriptorRequestStopSystem(
674 const StopAgentTracingCallback& callback,
675 dbus::ScopedFileDescriptor file_descriptor) {
676 DCHECK(file_descriptor);
677
678 // Issue the dbus request to stop system tracing
679 dbus::MethodCall method_call(
680 debugd::kDebugdInterface,
681 debugd::kSystraceStop);
682 dbus::MessageWriter writer(&method_call);
683 writer.AppendFileDescriptor(*file_descriptor);
684
685 callback_ = callback;
686
687 DVLOG(1) << "Requesting a systrace stop";
688 debugdaemon_proxy_->CallMethod(
689 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
690 base::Bind(&DebugDaemonClientImpl::OnStopAgentTracing,
691 weak_ptr_factory_.GetWeakPtr()));
692 }
693
694 // Called when a response for StopAgentTracing() is received. 619 // Called when a response for StopAgentTracing() is received.
695 void OnStopAgentTracing(dbus::Response* response) { 620 void OnStopAgentTracing(dbus::Response* response) {
696 if (!response) { 621 if (!response) {
697 LOG(ERROR) << "Failed to request systrace stop"; 622 LOG(ERROR) << "Failed to request systrace stop";
698 // If debugd crashes or completes I/O before this message is processed 623 // If debugd crashes or completes I/O before this message is processed
699 // then pipe_reader_ can be NULL, see OnIOComplete(). 624 // then pipe_reader_ can be NULL, see OnIOComplete().
700 if (pipe_reader_.get()) 625 if (pipe_reader_.get())
701 pipe_reader_->OnDataReady(-1); // terminate data stream 626 pipe_reader_->OnDataReady(-1); // terminate data stream
702 } 627 }
703 // NB: requester is signaled when i/o completes 628 // NB: requester is signaled when i/o completes
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 DebugDaemonClient::EmptyStopAgentTracingCallback() { 665 DebugDaemonClient::EmptyStopAgentTracingCallback() {
741 return base::Bind(&EmptyStopAgentTracingCallbackBody); 666 return base::Bind(&EmptyStopAgentTracingCallbackBody);
742 } 667 }
743 668
744 // static 669 // static
745 DebugDaemonClient* DebugDaemonClient::Create() { 670 DebugDaemonClient* DebugDaemonClient::Create() {
746 return new DebugDaemonClientImpl(); 671 return new DebugDaemonClientImpl();
747 } 672 }
748 673
749 } // namespace chromeos 674 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698