diff options
author | ygorshenin@chromium.org <ygorshenin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-12 15:35:03 +0000 |
---|---|---|
committer | ygorshenin@chromium.org <ygorshenin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-12 15:35:03 +0000 |
commit | 395a03967310f3a869c6d2e486cdd73677e7ab69 (patch) | |
tree | f5de9386234f42f039169cc2c62118d0b668bd80 /chromeos | |
parent | 283794fa145a785af7dc74020ff66cdc1552239a (diff) | |
download | chromium_src-395a03967310f3a869c6d2e486cdd73677e7ab69.zip chromium_src-395a03967310f3a869c6d2e486cdd73677e7ab69.tar.gz chromium_src-395a03967310f3a869c6d2e486cdd73677e7ab69.tar.bz2 |
Added "Store Debug Logs" functionality. Logs from /var/log are gzipped
and stored on the fileshelf.
BUG=chromium-os:25700
TEST=
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=131963
Review URL: http://codereview.chromium.org/9965072
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131988 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos')
-rw-r--r-- | chromeos/dbus/debug_daemon_client.cc | 31 | ||||
-rw-r--r-- | chromeos/dbus/debug_daemon_client.h | 10 | ||||
-rw-r--r-- | chromeos/dbus/mock_debug_daemon_client.h | 2 |
3 files changed, 43 insertions, 0 deletions
diff --git a/chromeos/dbus/debug_daemon_client.cc b/chromeos/dbus/debug_daemon_client.cc index bc8e06d..ea0a0fa 100644 --- a/chromeos/dbus/debug_daemon_client.cc +++ b/chromeos/dbus/debug_daemon_client.cc @@ -150,6 +150,23 @@ class DebugDaemonClientImpl : public DebugDaemonClient { virtual ~DebugDaemonClientImpl() {} // DebugDaemonClient override. + virtual void GetDebugLogs(base::PlatformFile file, + const GetDebugLogsCallback& callback) OVERRIDE { + dbus::MethodCall method_call( + debugd::kDebugdInterface, + debugd::kGetDebugLogs); + dbus::MessageWriter writer(&method_call); + dbus::FileDescriptor fd(file); // explicit temp for C++ 98 + writer.AppendFileDescriptor(fd); + + debugdaemon_proxy_->CallMethod( + &method_call, + dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, + base::Bind(&DebugDaemonClientImpl::OnGetDebugLogs, + weak_ptr_factory_.GetWeakPtr(), + callback)); + } + virtual void StartSystemTracing() OVERRIDE { dbus::MethodCall method_call( debugd::kDebugdInterface, @@ -209,6 +226,16 @@ class DebugDaemonClientImpl : public DebugDaemonClient { } private: + void OnGetDebugLogs(const GetDebugLogsCallback& callback, + dbus::Response* response) { + if (!response) { + LOG(ERROR) << "Failed to get debug logs"; + callback.Run(false); + return; + } + callback.Run(true); + } + // Called when a response for StartSystemTracing() is received. void OnStartSystemTracing(dbus::Response* response) { if (!response) { @@ -244,6 +271,10 @@ class DebugDaemonClientImpl : public DebugDaemonClient { // which does nothing. class DebugDaemonClientStubImpl : public DebugDaemonClient { // DebugDaemonClient overrides. + virtual void GetDebugLogs(base::PlatformFile file, + const GetDebugLogsCallback& callback) OVERRIDE { + callback.Run(false); + } virtual void StartSystemTracing() OVERRIDE {} virtual bool RequestStopSystemTracing(const StopSystemTracingCallback& callback) OVERRIDE { diff --git a/chromeos/dbus/debug_daemon_client.h b/chromeos/dbus/debug_daemon_client.h index 38e4015..cc91a94 100644 --- a/chromeos/dbus/debug_daemon_client.h +++ b/chromeos/dbus/debug_daemon_client.h @@ -6,6 +6,7 @@ #define CHROMEOS_DBUS_DEBUG_DAEMON_CLIENT_H_ #include "base/callback.h" +#include "base/platform_file.h" #include "base/memory/ref_counted_memory.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_client_implementation_type.h" @@ -21,6 +22,15 @@ class CHROMEOS_EXPORT DebugDaemonClient { public: virtual ~DebugDaemonClient(); + // Called once GetDebugLogs() is complete. Takes one parameter: + // - succeeded: was the logs stored successfully. + typedef base::Callback<void(bool succeeded)> GetDebugLogsCallback; + + // Requests to store debug logs into |file| and calls |callback| + // when completed. Debug logs will be stored in the .tgz format. + virtual void GetDebugLogs(base::PlatformFile file, + const GetDebugLogsCallback& callback) = 0; + // Requests to start system/kernel tracing. virtual void StartSystemTracing() = 0; diff --git a/chromeos/dbus/mock_debug_daemon_client.h b/chromeos/dbus/mock_debug_daemon_client.h index 05f553f..f55b98f6 100644 --- a/chromeos/dbus/mock_debug_daemon_client.h +++ b/chromeos/dbus/mock_debug_daemon_client.h @@ -15,6 +15,8 @@ class MockDebugDaemonClient : public DebugDaemonClient { MockDebugDaemonClient(); virtual ~MockDebugDaemonClient(); + MOCK_METHOD2(GetDebugLogs, void(base::PlatformFile, + const GetDebugLogsCallback&)); MOCK_METHOD1(RequestStopSystemTracing, bool(const StopSystemTracingCallback&)); MOCK_METHOD0(StartSystemTracing, void()); |