summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/system_logs
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/chromeos/system_logs')
-rw-r--r--chrome/browser/chromeos/system_logs/dbus_log_source.cc32
-rw-r--r--chrome/browser/chromeos/system_logs/dbus_log_source.h27
-rw-r--r--chrome/browser/chromeos/system_logs/system_logs_fetcher.cc7
3 files changed, 62 insertions, 4 deletions
diff --git a/chrome/browser/chromeos/system_logs/dbus_log_source.cc b/chrome/browser/chromeos/system_logs/dbus_log_source.cc
new file mode 100644
index 0000000..bed65eb
--- /dev/null
+++ b/chrome/browser/chromeos/system_logs/dbus_log_source.cc
@@ -0,0 +1,32 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/system_logs/dbus_log_source.h"
+
+#include "chrome/browser/chromeos/system_logs/system_logs_fetcher.h"
+#include "content/public/browser/browser_thread.h"
+#include "dbus/dbus_statistics.h"
+
+namespace chromeos {
+
+namespace {
+const char kDBusLogEntryShort[] = "dbus_summary";
+const char kDBusLogEntryLong[] = "dbus_details";
+}
+
+void DBusLogSource::Fetch(const SysLogsSourceCallback& callback) {
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+ DCHECK(!callback.is_null());
+
+ SystemLogsResponse response;
+ response[kDBusLogEntryShort] = dbus::statistics::GetAsString(
+ dbus::statistics::SHOW_INTERFACE,
+ dbus::statistics::FORMAT_ALL);
+ response[kDBusLogEntryLong] = dbus::statistics::GetAsString(
+ dbus::statistics::SHOW_METHOD,
+ dbus::statistics::FORMAT_TOTALS);
+ callback.Run(&response);
+}
+
+} // namespace chromeos
diff --git a/chrome/browser/chromeos/system_logs/dbus_log_source.h b/chrome/browser/chromeos/system_logs/dbus_log_source.h
new file mode 100644
index 0000000..810368d
--- /dev/null
+++ b/chrome/browser/chromeos/system_logs/dbus_log_source.h
@@ -0,0 +1,27 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_SYSTEM_LOGS_DBUS_LOG_SOURCE_H_
+#define CHROME_BROWSER_CHROMEOS_SYSTEM_LOGS_DBUS_LOG_SOURCE_H_
+
+#include "chrome/browser/chromeos/system_logs/system_logs_fetcher.h"
+
+namespace chromeos {
+
+// Fetches memory usage details.
+class DBusLogSource : public SystemLogsSource {
+ public:
+ DBusLogSource() {}
+ virtual ~DBusLogSource() {}
+
+ // SystemLogsSource override.
+ virtual void Fetch(const SysLogsSourceCallback& request) OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DBusLogSource);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_SYSTEM_LOGS_DBUS_LOG_SOURCE_H_
diff --git a/chrome/browser/chromeos/system_logs/system_logs_fetcher.cc b/chrome/browser/chromeos/system_logs/system_logs_fetcher.cc
index ea7fa9e..446278e 100644
--- a/chrome/browser/chromeos/system_logs/system_logs_fetcher.cc
+++ b/chrome/browser/chromeos/system_logs/system_logs_fetcher.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "chrome/browser/chromeos/system_logs/command_line_log_source.h"
+#include "chrome/browser/chromeos/system_logs/dbus_log_source.h"
#include "chrome/browser/chromeos/system_logs/debug_daemon_log_source.h"
#include "chrome/browser/chromeos/system_logs/lsb_release_log_source.h"
#include "chrome/browser/chromeos/system_logs/memory_details_log_source.h"
@@ -25,6 +26,7 @@ SystemLogsFetcher::SystemLogsFetcher()
// Chrome data sources.
data_sources_.push_back(new CommandLineLogSource());
+ data_sources_.push_back(new DBusLogSource());
data_sources_.push_back(new LsbReleaseLogSource());
data_sources_.push_back(new MemoryDetailsLogSource());
@@ -51,13 +53,11 @@ void SystemLogsFetcher::AddResponse(SystemLogsResponse* response) {
for (SystemLogsResponse::const_iterator it = response->begin();
it != response->end();
++it) {
- // It is false if the insert if there is already an element with the same
- // key.
+ // It is an error to insert an element with a pre-existing key.
bool ok = response_->insert(*it).second;
DCHECK(ok) << "Duplicate key found: " << it->first;
}
-
--num_pending_requests_;
if (num_pending_requests_ > 0)
return;
@@ -67,4 +67,3 @@ void SystemLogsFetcher::AddResponse(SystemLogsResponse* response) {
}
} // namespace chromeos
-