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

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

Issue 26536002: chrome://crashes: add a link on CrOS for triggering crash uploading (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: delete excess newline Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « chromeos/dbus/debug_daemon_client.h ('k') | chromeos/dbus/fake_debug_daemon_client.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 (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 <unistd.h> 8 #include <unistd.h>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 dbus::MethodCall method_call( 306 dbus::MethodCall method_call(
307 debugd::kDebugdInterface, 307 debugd::kDebugdInterface,
308 debugd::kSystraceStart); 308 debugd::kSystraceStart);
309 dbus::MessageWriter writer(&method_call); 309 dbus::MessageWriter writer(&method_call);
310 writer.AppendString("all"); // TODO(sleffler) parameterize category list 310 writer.AppendString("all"); // TODO(sleffler) parameterize category list
311 311
312 DVLOG(1) << "Requesting a systrace start"; 312 DVLOG(1) << "Requesting a systrace start";
313 debugdaemon_proxy_->CallMethod( 313 debugdaemon_proxy_->CallMethod(
314 &method_call, 314 &method_call,
315 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 315 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
316 base::Bind(&DebugDaemonClientImpl::OnStartSystemTracing, 316 base::Bind(&DebugDaemonClientImpl::OnStartMethod,
317 weak_ptr_factory_.GetWeakPtr())); 317 weak_ptr_factory_.GetWeakPtr()));
318 } 318 }
319 319
320 virtual bool RequestStopSystemTracing(const StopSystemTracingCallback& 320 virtual bool RequestStopSystemTracing(const StopSystemTracingCallback&
321 callback) OVERRIDE { 321 callback) OVERRIDE {
322 if (pipe_reader_ != NULL) { 322 if (pipe_reader_ != NULL) {
323 LOG(ERROR) << "Busy doing StopSystemTracing"; 323 LOG(ERROR) << "Busy doing StopSystemTracing";
324 return false; 324 return false;
325 } 325 }
326 326
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 393
394 // Call the function. 394 // Call the function.
395 debugdaemon_proxy_->CallMethod( 395 debugdaemon_proxy_->CallMethod(
396 &method_call, 396 &method_call,
397 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 397 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
398 base::Bind(&DebugDaemonClientImpl::OnTestICMP, 398 base::Bind(&DebugDaemonClientImpl::OnTestICMP,
399 weak_ptr_factory_.GetWeakPtr(), 399 weak_ptr_factory_.GetWeakPtr(),
400 callback)); 400 callback));
401 } 401 }
402 402
403 virtual void UploadCrashes() OVERRIDE {
404 dbus::MethodCall method_call(debugd::kDebugdInterface,
405 debugd::kUploadCrashes);
406 debugdaemon_proxy_->CallMethod(
407 &method_call,
408 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
409 base::Bind(&DebugDaemonClientImpl::OnStartMethod,
410 weak_ptr_factory_.GetWeakPtr()));
411 }
412
403 protected: 413 protected:
404 virtual void Init(dbus::Bus* bus) OVERRIDE { 414 virtual void Init(dbus::Bus* bus) OVERRIDE {
405 debugdaemon_proxy_ = 415 debugdaemon_proxy_ =
406 bus->GetObjectProxy(debugd::kDebugdServiceName, 416 bus->GetObjectProxy(debugd::kDebugdServiceName,
407 dbus::ObjectPath(debugd::kDebugdServicePath)); 417 dbus::ObjectPath(debugd::kDebugdServicePath));
408 } 418 }
409 419
410 private: 420 private:
411 // Called to check descriptor validity on a thread where i/o is permitted. 421 // Called to check descriptor validity on a thread where i/o is permitted.
412 static void CheckValidity(dbus::FileDescriptor* file_descriptor) { 422 static void CheckValidity(dbus::FileDescriptor* file_descriptor) {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 logs[key] = value; 556 logs[key] = value;
547 } 557 }
548 callback.Run(!sub_reader.HasMoreData() && !broken, logs); 558 callback.Run(!sub_reader.HasMoreData() && !broken, logs);
549 } 559 }
550 560
551 void OnGetUserLogFiles(const GetLogsCallback& callback, 561 void OnGetUserLogFiles(const GetLogsCallback& callback,
552 dbus::Response* response) { 562 dbus::Response* response) {
553 return OnGetAllLogs(callback, response); 563 return OnGetAllLogs(callback, response);
554 } 564 }
555 565
556 // Called when a response for StartSystemTracing() is received. 566 // Called when a response for a simple start is received.
557 void OnStartSystemTracing(dbus::Response* response) { 567 void OnStartMethod(dbus::Response* response) {
558 if (!response) { 568 if (!response) {
559 LOG(ERROR) << "Failed to request systrace start"; 569 LOG(ERROR) << "Failed to request start";
560 return; 570 return;
561 } 571 }
562 } 572 }
563 573
564 // Called when a CheckValidity response is received. 574 // Called when a CheckValidity response is received.
565 void OnCheckValidityRequestStopSystem( 575 void OnCheckValidityRequestStopSystem(
566 dbus::FileDescriptor* file_descriptor, 576 dbus::FileDescriptor* file_descriptor,
567 const StopSystemTracingCallback& callback) { 577 const StopSystemTracingCallback& callback) {
568 // Issue the dbus request to stop system tracing 578 // Issue the dbus request to stop system tracing
569 dbus::MethodCall method_call( 579 dbus::MethodCall method_call(
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 DebugDaemonClient::EmptyStopSystemTracingCallback() { 639 DebugDaemonClient::EmptyStopSystemTracingCallback() {
630 return base::Bind(&EmptyStopSystemTracingCallbackBody); 640 return base::Bind(&EmptyStopSystemTracingCallbackBody);
631 } 641 }
632 642
633 // static 643 // static
634 DebugDaemonClient* DebugDaemonClient::Create() { 644 DebugDaemonClient* DebugDaemonClient::Create() {
635 return new DebugDaemonClientImpl(); 645 return new DebugDaemonClientImpl();
636 } 646 }
637 647
638 } // namespace chromeos 648 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/debug_daemon_client.h ('k') | chromeos/dbus/fake_debug_daemon_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698