summaryrefslogtreecommitdiffstats
path: root/chromeos
diff options
context:
space:
mode:
authorrharrison@chromium.org <rharrison@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-04 17:04:25 +0000
committerrharrison@chromium.org <rharrison@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-04 17:04:25 +0000
commit2ba0633ae603293498cfd0dadb1b3972f70b7cc2 (patch)
tree2454ce70d095cceb1561c3554c3fa2a30cc74ef8 /chromeos
parentdffb92aab1905420136cdc6d9dba07f8e0eeeb73 (diff)
downloadchromium_src-2ba0633ae603293498cfd0dadb1b3972f70b7cc2.zip
chromium_src-2ba0633ae603293498cfd0dadb1b3972f70b7cc2.tar.gz
chromium_src-2ba0633ae603293498cfd0dadb1b3972f70b7cc2.tar.bz2
Add in UMA metrics for ScreenLock requests
We are interested in knowing information about how often d-bus messages fail when trying to lock the screen. This CL adds in a new metric, LockScreen.RequestScreenLock, to track if sending a lock screen request succeeded or failed. It also refactors the sending of this message to have two distinct handling methods, so that future work with this code will be simplier. This should give us detailed information about on what versions and rates we are seeing this issue. It is not possible to get this information using a few test images, like we have been using so far. BUG=chromium-os:31346 TEST=Built Chrome with CL. Built ChromeOS image using CL. Ran image to confirm that no regressions had been introduced. Ran image and locked screen. Checked histogram populated. Review URL: https://chromiumcodereview.appspot.com/10447123 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140308 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos')
-rw-r--r--chromeos/dbus/power_manager_client.cc27
1 files changed, 26 insertions, 1 deletions
diff --git a/chromeos/dbus/power_manager_client.cc b/chromeos/dbus/power_manager_client.cc
index f25fb2d..be2440a 100644
--- a/chromeos/dbus/power_manager_client.cc
+++ b/chromeos/dbus/power_manager_client.cc
@@ -10,6 +10,7 @@
#include "base/callback.h"
#include "base/format_macros.h"
#include "base/memory/scoped_ptr.h"
+#include "base/metrics/histogram.h"
#include "base/observer_list.h"
#include "base/stringprintf.h"
#include "base/time.h"
@@ -264,7 +265,15 @@ class PowerManagerClientImpl : public PowerManagerClient {
}
virtual void NotifyScreenLockRequested() OVERRIDE {
- SimpleMethodCallToPowerManager(power_manager::kRequestLockScreenMethod);
+ dbus::MethodCall method_call(power_manager::kPowerManagerInterface,
+ power_manager::kRequestLockScreenMethod);
+ power_manager_proxy_->CallMethodWithErrorCallback(
+ &method_call,
+ dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ base::Bind(&PowerManagerClientImpl::OnScreenLockRequested,
+ weak_ptr_factory_.GetWeakPtr()),
+ base::Bind(&PowerManagerClientImpl::OnScreenLockRequestedError,
+ weak_ptr_factory_.GetWeakPtr()));
}
virtual void NotifyScreenLockCompleted() OVERRIDE {
@@ -445,6 +454,22 @@ class PowerManagerClientImpl : public PowerManagerClient {
callback.Run(request_id);
}
+ void OnScreenLockRequested(dbus::Response* response) {
+ UMA_HISTOGRAM_BOOLEAN("LockScreen.RequestLockScreen", true);
+ }
+
+ void OnScreenLockRequestedError(dbus::ErrorResponse* error_response) {
+ if (error_response) {
+ dbus::MessageReader reader(error_response);
+ std::string error_message;
+ reader.PopString(&error_message);
+ LOG(ERROR) << "Failed to call ScreenLockRequested: "
+ << error_response->GetErrorName()
+ << ": " << error_message;
+ }
+ UMA_HISTOGRAM_BOOLEAN("LockScreen.RequestLockScreen", false);
+ }
+
void OnGetScreenBrightnessPercent(
const GetScreenBrightnessPercentCallback& callback,
dbus::Response* response) {