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

Unified Diff: chromeos/dbus/power_manager_client.cc

Issue 773703002: Generalize network_event_log -> device_event_log (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/dbus/dbus_thread_manager.cc ('k') | chromeos/device_event_log.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/power_manager_client.cc
diff --git a/chromeos/dbus/power_manager_client.cc b/chromeos/dbus/power_manager_client.cc
index 52b69098515d806dfeecc48642ffbb1daa0a3990..b11e59b5b08a9e3f68346bd65e74ed0fbf6df4ff 100644
--- a/chromeos/dbus/power_manager_client.cc
+++ b/chromeos/dbus/power_manager_client.cc
@@ -27,6 +27,7 @@
#include "chromeos/dbus/power_manager/policy.pb.h"
#include "chromeos/dbus/power_manager/power_supply_properties.pb.h"
#include "chromeos/dbus/power_manager/suspend.pb.h"
+#include "chromeos/device_event_log.h"
#include "dbus/bus.h"
#include "dbus/message.h"
#include "dbus/object_path.h"
@@ -90,6 +91,7 @@ class PowerManagerClientImpl : public PowerManagerClient {
}
virtual void DecreaseScreenBrightness(bool allow_off) override {
+ POWER_LOG(USER) << "DecreaseScreenBrightness, allow_off: " << allow_off;
dbus::MethodCall method_call(
power_manager::kPowerManagerInterface,
power_manager::kDecreaseScreenBrightnessMethod);
@@ -102,22 +104,27 @@ class PowerManagerClientImpl : public PowerManagerClient {
}
virtual void IncreaseScreenBrightness() override {
+ POWER_LOG(USER) << "IncreaseScreenBrightness";
SimpleMethodCallToPowerManager(
power_manager::kIncreaseScreenBrightnessMethod);
}
virtual void DecreaseKeyboardBrightness() override {
+ POWER_LOG(USER) << "DecreaseKeyboardBrightness";
SimpleMethodCallToPowerManager(
power_manager::kDecreaseKeyboardBrightnessMethod);
}
virtual void IncreaseKeyboardBrightness() override {
+ POWER_LOG(USER) << "IncreaseKeyboardBrightness";
SimpleMethodCallToPowerManager(
power_manager::kIncreaseKeyboardBrightnessMethod);
}
virtual void SetScreenBrightnessPercent(double percent,
bool gradual) override {
+ POWER_LOG(USER) << "SetScreenBrightnessPercent: " << percent
Daniel Erat 2014/12/03 15:07:20 this might be spammy enough that we don't want to
stevenjb 2014/12/05 20:14:06 Yeah, this is spammy, I'll remove it. It turns out
+ << " gradual: " << gradual;
dbus::MethodCall method_call(
power_manager::kPowerManagerInterface,
power_manager::kSetScreenBrightnessPercentMethod);
@@ -146,6 +153,7 @@ class PowerManagerClientImpl : public PowerManagerClient {
}
virtual void RequestStatusUpdate() override {
+ POWER_LOG(USER) << "RequestStatusUpdate";
dbus::MethodCall method_call(
power_manager::kPowerManagerInterface,
power_manager::kGetPowerSupplyPropertiesMethod);
@@ -157,14 +165,17 @@ class PowerManagerClientImpl : public PowerManagerClient {
}
virtual void RequestSuspend() override {
+ POWER_LOG(USER) << "RequestSuspend";
SimpleMethodCallToPowerManager(power_manager::kRequestSuspendMethod);
}
virtual void RequestRestart() override {
+ POWER_LOG(USER) << "RequestRestart";
SimpleMethodCallToPowerManager(power_manager::kRequestRestartMethod);
}
virtual void RequestShutdown() override {
+ POWER_LOG(USER) << "RequestShutdown";
SimpleMethodCallToPowerManager(power_manager::kRequestShutdownMethod);
}
@@ -197,12 +208,13 @@ class PowerManagerClientImpl : public PowerManagerClient {
virtual void SetPolicy(
const power_manager::PowerManagementPolicy& policy) override {
+ POWER_LOG(USER) << "SetPolicy";
dbus::MethodCall method_call(
power_manager::kPowerManagerInterface,
power_manager::kSetPolicyMethod);
dbus::MessageWriter writer(&method_call);
if (!writer.AppendProtoAsArrayOfBytes(policy)) {
- LOG(ERROR) << "Error calling " << power_manager::kSetPolicyMethod;
+ POWER_LOG(ERROR) << "Error calling " << power_manager::kSetPolicyMethod;
return;
}
power_manager_proxy_->CallMethod(
@@ -212,6 +224,7 @@ class PowerManagerClientImpl : public PowerManagerClient {
}
virtual void SetIsProjecting(bool is_projecting) override {
+ POWER_LOG(USER) << "SetIsProjecting";
dbus::MethodCall method_call(
power_manager::kPowerManagerInterface,
power_manager::kSetIsProjectingMethod);
@@ -339,8 +352,8 @@ class PowerManagerClientImpl : public PowerManagerClient {
void SignalConnected(const std::string& interface_name,
const std::string& signal_name,
bool success) {
- LOG_IF(WARNING, !success) << "Failed to connect to signal "
- << signal_name << ".";
+ if (!success)
+ POWER_LOG(ERROR) << "Failed to connect to signal " << signal_name << ".";
}
// Makes a method call to power manager with no arguments and no response.
@@ -355,15 +368,15 @@ class PowerManagerClientImpl : public PowerManagerClient {
void NameOwnerChangedReceived(const std::string& old_owner,
const std::string& new_owner) {
- VLOG(1) << "Power manager restarted (old owner was "
- << (old_owner.empty() ? "[none]" : old_owner.c_str())
- << ", new owner is "
- << (new_owner.empty() ? "[none]" : new_owner.c_str()) << ")";
+ POWER_LOG(EVENT) << "Power manager restarted. Old owner: "
+ << (old_owner.empty() ? "[none]" : old_owner.c_str())
+ << " New owner: "
+ << (new_owner.empty() ? "[none]" : new_owner.c_str());
suspend_is_pending_ = false;
pending_suspend_id_ = -1;
suspending_from_dark_resume_ = false;
if (!new_owner.empty()) {
- VLOG(1) << "Sending initial state to power manager";
+ POWER_LOG(EVENT) << "Sending initial state to power manager";
RegisterSuspendDelays();
SetIsProjecting(last_is_projecting_);
FOR_EACH_OBSERVER(Observer, observers_, PowerManagerRestarted());
@@ -376,12 +389,12 @@ class PowerManagerClientImpl : public PowerManagerClient {
bool user_initiated = 0;
if (!(reader.PopInt32(&brightness_level) &&
reader.PopBool(&user_initiated))) {
- LOG(ERROR) << "Brightness changed signal had incorrect parameters: "
- << signal->ToString();
+ POWER_LOG(ERROR) << "Brightness changed signal had incorrect parameters: "
+ << signal->ToString();
return;
}
- VLOG(1) << "Brightness changed to " << brightness_level
- << ": user initiated " << user_initiated;
+ POWER_LOG(DEBUG) << "Brightness changed to " << brightness_level
+ << ": user initiated " << user_initiated;
FOR_EACH_OBSERVER(Observer, observers_,
BrightnessChanged(brightness_level, user_initiated));
}
@@ -390,8 +403,9 @@ class PowerManagerClientImpl : public PowerManagerClient {
dbus::MessageReader reader(signal);
power_manager::PeripheralBatteryStatus protobuf_status;
if (!reader.PopArrayOfBytesAsProto(&protobuf_status)) {
- LOG(ERROR) << "Unable to decode protocol buffer from "
- << power_manager::kPeripheralBatteryStatusSignal << " signal";
+ POWER_LOG(ERROR) << "Unable to decode protocol buffer from "
+ << power_manager::kPeripheralBatteryStatusSignal
+ << " signal";
return;
}
@@ -399,29 +413,29 @@ class PowerManagerClientImpl : public PowerManagerClient {
std::string name = protobuf_status.name();
int level = protobuf_status.has_level() ? protobuf_status.level() : -1;
- VLOG(1) << "Device battery status received " << level
- << " for " << name << " at " << path;
+ POWER_LOG(DEBUG) << "Device battery status received " << level << " for "
+ << name << " at " << path;
FOR_EACH_OBSERVER(Observer, observers_,
PeripheralBatteryStatusReceived(path, name, level));
}
void PowerSupplyPollReceived(dbus::Signal* signal) {
- VLOG(1) << "Received power supply poll signal.";
+ POWER_LOG(DEBUG) << "Received power supply poll signal.";
dbus::MessageReader reader(signal);
power_manager::PowerSupplyProperties protobuf;
if (reader.PopArrayOfBytesAsProto(&protobuf)) {
HandlePowerSupplyProperties(protobuf);
} else {
- LOG(ERROR) << "Unable to decode "
- << power_manager::kPowerSupplyPollSignal << "signal";
+ POWER_LOG(ERROR) << "Unable to decode "
+ << power_manager::kPowerSupplyPollSignal << " signal";
}
}
void OnGetPowerSupplyPropertiesMethod(dbus::Response* response) {
if (!response) {
- LOG(ERROR) << "Error calling "
- << power_manager::kGetPowerSupplyPropertiesMethod;
+ POWER_LOG(ERROR) << "Error calling "
+ << power_manager::kGetPowerSupplyPropertiesMethod;
return;
}
@@ -430,9 +444,9 @@ class PowerManagerClientImpl : public PowerManagerClient {
if (reader.PopArrayOfBytesAsProto(&protobuf)) {
HandlePowerSupplyProperties(protobuf);
} else {
- LOG(ERROR) << "Unable to decode "
- << power_manager::kGetPowerSupplyPropertiesMethod
- << " response";
+ POWER_LOG(ERROR) << "Unable to decode "
+ << power_manager::kGetPowerSupplyPropertiesMethod
+ << " response";
}
}
@@ -440,15 +454,15 @@ class PowerManagerClientImpl : public PowerManagerClient {
const GetScreenBrightnessPercentCallback& callback,
dbus::Response* response) {
if (!response) {
- LOG(ERROR) << "Error calling "
- << power_manager::kGetScreenBrightnessPercentMethod;
+ POWER_LOG(ERROR) << "Error calling "
+ << power_manager::kGetScreenBrightnessPercentMethod;
return;
}
dbus::MessageReader reader(response);
double percent = 0.0;
if (!reader.PopDouble(&percent))
- LOG(ERROR) << "Error reading response from powerd: "
- << response->ToString();
+ POWER_LOG(ERROR) << "Error reading response from powerd: "
+ << response->ToString();
callback.Run(percent);
}
@@ -464,25 +478,26 @@ class PowerManagerClientImpl : public PowerManagerClient {
const std::string& method_name,
dbus::Response* response) {
if (!response) {
- LOG(ERROR) << "Error calling " << method_name;
+ POWER_LOG(ERROR) << "Error calling " << method_name;
return;
}
dbus::MessageReader reader(response);
power_manager::RegisterSuspendDelayReply protobuf;
if (!reader.PopArrayOfBytesAsProto(&protobuf)) {
- LOG(ERROR) << "Unable to parse reply from " << method_name;
+ POWER_LOG(ERROR) << "Unable to parse reply from " << method_name;
return;
}
if (dark_suspend) {
dark_suspend_delay_id_ = protobuf.delay_id();
has_dark_suspend_delay_id_ = true;
- VLOG(1) << "Registered dark suspend delay " << dark_suspend_delay_id_;
+ POWER_LOG(EVENT) << "Registered dark suspend delay "
+ << dark_suspend_delay_id_;
} else {
suspend_delay_id_ = protobuf.delay_id();
has_suspend_delay_id_ = true;
- VLOG(1) << "Registered suspend delay " << suspend_delay_id_;
+ POWER_LOG(EVENT) << "Registered suspend delay " << suspend_delay_id_;
}
}
@@ -490,29 +505,31 @@ class PowerManagerClientImpl : public PowerManagerClient {
std::string signal_name = signal->GetMember();
if ((in_dark_resume && !has_dark_suspend_delay_id_) ||
(!in_dark_resume && !has_suspend_delay_id_)) {
- LOG(ERROR) << "Received unrequested " << signal_name << " signal";
+ POWER_LOG(ERROR) << "Received unrequested " << signal_name << " signal";
return;
}
dbus::MessageReader reader(signal);
power_manager::SuspendImminent proto;
if (!reader.PopArrayOfBytesAsProto(&proto)) {
- LOG(ERROR) << "Unable to decode protocol buffer from " << signal_name
- << " signal";
+ POWER_LOG(ERROR) << "Unable to decode protocol buffer from "
+ << signal_name << " signal";
return;
}
- VLOG(1) << "Got " << signal_name << " signal announcing suspend attempt "
- << proto.suspend_id();
+ POWER_LOG(EVENT) << "Got " << signal_name
+ << " signal announcing suspend attempt "
+ << proto.suspend_id();
// If a previous suspend is pending from the same state we are currently in
// (fully powered on or in dark resume), then something's gone a little
// wonky.
- if (suspend_is_pending_ &&
- suspending_from_dark_resume_ == in_dark_resume) {
- LOG(WARNING) << "Got " << signal_name << " signal about pending suspend "
- << "attempt " << proto.suspend_id() << " while still "
- << "waiting on attempt " << pending_suspend_id_;
+ if (suspend_is_pending_ && suspending_from_dark_resume_ == in_dark_resume) {
+ POWER_LOG(ERROR) << "Got " << signal_name
+ << " signal about pending suspend attempt "
+ << proto.suspend_id()
+ << " while still waiting on attempt "
+ << pending_suspend_id_;
}
pending_suspend_id_ = proto.suspend_id();
@@ -531,16 +548,17 @@ class PowerManagerClientImpl : public PowerManagerClient {
dbus::MessageReader reader(signal);
power_manager::SuspendDone proto;
if (!reader.PopArrayOfBytesAsProto(&proto)) {
- LOG(ERROR) << "Unable to decode protocol buffer from "
- << power_manager::kSuspendDoneSignal << " signal";
+ POWER_LOG(ERROR) << "Unable to decode protocol buffer from "
+ << power_manager::kSuspendDoneSignal << " signal";
return;
}
const base::TimeDelta duration =
base::TimeDelta::FromInternalValue(proto.suspend_duration());
- VLOG(1) << "Got " << power_manager::kSuspendDoneSignal << " signal:"
- << " suspend_id=" << proto.suspend_id()
- << " duration=" << duration.InSeconds() << " sec";
+ POWER_LOG(EVENT) << "Got " << power_manager::kSuspendDoneSignal
+ << " signal:"
+ << " suspend_id=" << proto.suspend_id()
+ << " duration=" << duration.InSeconds() << " sec";
if (render_process_manager_delegate_)
render_process_manager_delegate_->SuspendDone();
@@ -554,8 +572,8 @@ class PowerManagerClientImpl : public PowerManagerClient {
dbus::MessageReader reader(signal);
power_manager::IdleActionImminent proto;
if (!reader.PopArrayOfBytesAsProto(&proto)) {
- LOG(ERROR) << "Unable to decode protocol buffer from "
- << power_manager::kIdleActionImminentSignal << " signal";
+ POWER_LOG(ERROR) << "Unable to decode protocol buffer from "
+ << power_manager::kIdleActionImminentSignal << " signal";
return;
}
FOR_EACH_OBSERVER(Observer, observers_,
@@ -571,15 +589,16 @@ class PowerManagerClientImpl : public PowerManagerClient {
dbus::MessageReader reader(signal);
power_manager::InputEvent proto;
if (!reader.PopArrayOfBytesAsProto(&proto)) {
- LOG(ERROR) << "Unable to decode protocol buffer from "
- << power_manager::kInputEventSignal << " signal";
+ POWER_LOG(ERROR) << "Unable to decode protocol buffer from "
+ << power_manager::kInputEventSignal << " signal";
return;
}
base::TimeTicks timestamp =
base::TimeTicks::FromInternalValue(proto.timestamp());
- VLOG(1) << "Got " << power_manager::kInputEventSignal << " signal:"
- << " type=" << proto.type() << " timestamp=" << proto.timestamp();
+ POWER_LOG(EVENT) << "Got " << power_manager::kInputEventSignal << " signal:"
Daniel Erat 2014/12/03 15:07:20 USER might make more sense here since this corresp
stevenjb 2014/12/05 20:14:06 Done.
+ << " type=" << proto.type()
+ << " timestamp=" << proto.timestamp();
switch (proto.type()) {
case power_manager::InputEvent_Type_POWER_BUTTON_DOWN:
case power_manager::InputEvent_Type_POWER_BUTTON_UP: {
@@ -622,7 +641,7 @@ class PowerManagerClientImpl : public PowerManagerClient {
dbus::MessageWriter writer(&method_call);
if (!writer.AppendProtoAsArrayOfBytes(protobuf_request)) {
- LOG(ERROR) << "Error constructing message for " << method_name;
+ POWER_LOG(ERROR) << "Error constructing message for " << method_name;
return;
}
@@ -697,8 +716,8 @@ class PowerManagerClientImpl : public PowerManagerClient {
power_manager::kPowerManagerInterface, method_name);
dbus::MessageWriter writer(&method_call);
- VLOG(1) << "Announcing readiness of suspend delay " << delay_id
- << " for suspend attempt " << pending_suspend_id_;
+ POWER_LOG(EVENT) << "Announcing readiness of suspend delay " << delay_id
+ << " for suspend attempt " << pending_suspend_id_;
power_manager::SuspendReadinessInfo protobuf_request;
protobuf_request.set_delay_id(delay_id);
protobuf_request.set_suspend_id(pending_suspend_id_);
@@ -707,7 +726,7 @@ class PowerManagerClientImpl : public PowerManagerClient {
suspend_is_pending_ = false;
if (!writer.AppendProtoAsArrayOfBytes(protobuf_request)) {
- LOG(ERROR) << "Error constructing message for " << method_name;
+ POWER_LOG(ERROR) << "Error constructing message for " << method_name;
return;
}
power_manager_proxy_->CallMethod(
@@ -807,39 +826,41 @@ class PowerManagerClientStubImpl : public PowerManagerClient {
}
virtual void DecreaseScreenBrightness(bool allow_off) override {
- VLOG(1) << "Requested to descrease screen brightness";
+ POWER_LOG(USER) << "Requested to descrease screen brightness";
SetBrightness(brightness_ - 5.0, true);
}
virtual void IncreaseScreenBrightness() override {
- VLOG(1) << "Requested to increase screen brightness";
+ POWER_LOG(USER) << "Requested to increase screen brightness";
SetBrightness(brightness_ + 5.0, true);
}
virtual void SetScreenBrightnessPercent(double percent,
bool gradual) override {
- VLOG(1) << "Requested to set screen brightness to " << percent << "% "
- << (gradual ? "gradually" : "instantaneously");
+ POWER_LOG(USER) << "Requested to set screen brightness to " << percent
+ << "% " << (gradual ? "gradually" : "instantaneously");
SetBrightness(percent, false);
}
virtual void GetScreenBrightnessPercent(
const GetScreenBrightnessPercentCallback& callback) override {
+ POWER_LOG(USER) << "Requested to get screen brightness";
callback.Run(brightness_);
}
virtual void DecreaseKeyboardBrightness() override {
- VLOG(1) << "Requested to descrease keyboard brightness";
+ POWER_LOG(USER) << "Requested to descrease keyboard brightness";
}
virtual void IncreaseKeyboardBrightness() override {
- VLOG(1) << "Requested to increase keyboard brightness";
+ POWER_LOG(USER) << "Requested to increase keyboard brightness";
}
virtual void RequestStatusUpdate() override {
- base::MessageLoop::current()->PostTask(FROM_HERE,
- base::Bind(&PowerManagerClientStubImpl::UpdateStatus,
- weak_ptr_factory_.GetWeakPtr()));
+ POWER_LOG(USER) << "Requested status update";
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE, base::Bind(&PowerManagerClientStubImpl::UpdateStatus,
+ weak_ptr_factory_.GetWeakPtr()));
}
virtual void RequestSuspend() override {}
« no previous file with comments | « chromeos/dbus/dbus_thread_manager.cc ('k') | chromeos/device_event_log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698