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

Unified Diff: chromeos/network/shill_property_handler.cc

Issue 14876021: Re-factor network_event_log (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address final nits Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/network/shill_property_handler.h ('k') | chromeos/network/shill_property_handler_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/network/shill_property_handler.cc
diff --git a/chromeos/network/shill_property_handler.cc b/chromeos/network/shill_property_handler.cc
index 968b9bc7941f2859b13c4c295b4a30d6ab08f0da..81d9221faceb1fb881630098d646a853d0f3f7d8 100644
--- a/chromeos/network/shill_property_handler.cc
+++ b/chromeos/network/shill_property_handler.cc
@@ -22,8 +22,6 @@
namespace {
-const char kLogModule[] = "ShillPropertyHandler";
-
// Limit the number of services or devices we observe. Since they are listed in
// priority order, it should be reasonable to ignore services past this.
const size_t kMaxObserved = 100;
@@ -160,7 +158,7 @@ void ShillPropertyHandler::SetTechnologyEnabled(
technology,
base::Bind(&base::DoNothing),
base::Bind(&network_handler::ShillErrorCallbackFunction,
- kLogModule, technology, error_callback));
+ technology, error_callback));
}
}
@@ -169,15 +167,15 @@ void ShillPropertyHandler::RequestScan() const {
"",
base::Bind(&base::DoNothing),
base::Bind(&network_handler::ShillErrorCallbackFunction,
- kLogModule, "", network_handler::ErrorCallback()));
+ "", network_handler::ErrorCallback()));
}
void ShillPropertyHandler::ConnectToBestServices() const {
- network_event_log::AddEntry(kLogModule, "ConnectToBestServices", "");
+ NET_LOG_EVENT("ConnectToBestServices", "");
shill_manager_->ConnectToBestServices(
base::Bind(&base::DoNothing),
base::Bind(&network_handler::ShillErrorCallbackFunction,
- kLogModule, "", network_handler::ErrorCallback()));
+ "", network_handler::ErrorCallback()));
}
void ShillPropertyHandler::RequestProperties(ManagedState::ManagedType type,
@@ -203,8 +201,12 @@ void ShillPropertyHandler::RequestProperties(ManagedState::ManagedType type,
void ShillPropertyHandler::OnPropertyChanged(const std::string& key,
const base::Value& value) {
- if (ManagerPropertyChanged(key, value))
- listener_->ManagerPropertyChanged();
+ if (ManagerPropertyChanged(key, value)) {
+ std::string detail = key;
+ detail += " = " + network_event_log::ValueAsString(value);
+ NET_LOG_DEBUG("ManagerPropertyChanged", detail);
+ listener_->NotifyManagerPropertyChanged();
+ }
// If the service or device list changed and there are no pending
// updates, signal the state list changed callback.
if ((key == flimflam::kServicesProperty) &&
@@ -224,9 +226,11 @@ void ShillPropertyHandler::ManagerPropertiesCallback(
DBusMethodCallStatus call_status,
const base::DictionaryValue& properties) {
if (call_status != DBUS_METHOD_CALL_SUCCESS) {
- LOG(ERROR) << "Failed to get Manager properties:" << call_status;
+ NET_LOG_ERROR("ManagerPropertiesCallback",
+ base::StringPrintf("Failed: %d", call_status));
return;
}
+ NET_LOG_EVENT("ManagerPropertiesCallback", "Success");
bool notify = false;
bool update_service_list = false;
for (base::DictionaryValue::Iterator iter(properties);
@@ -245,7 +249,7 @@ void ShillPropertyHandler::ManagerPropertiesCallback(
notify |= ManagerPropertyChanged(flimflam::kServicesProperty, *value);
}
if (notify)
- listener_->ManagerPropertyChanged();
+ listener_->NotifyManagerPropertyChanged();
// If there are no pending updates, signal the state list changed callbacks.
if (pending_updates_[ManagedState::MANAGED_TYPE_NETWORK].size() == 0)
listener_->ManagedStateListChanged(ManagedState::MANAGED_TYPE_NETWORK);
@@ -318,7 +322,7 @@ void ShillPropertyHandler::UpdateObserved(ManagedState::ManagedType type,
new_observed[path] = new ShillPropertyObserver(
type, path, base::Bind(
&ShillPropertyHandler::PropertyChangedCallback, AsWeakPtr()));
- network_event_log::AddEntry(kLogModule, "StartObserving", path);
+ NET_LOG_DEBUG("StartObserving", path);
}
observer_map.erase(path);
// Limit the number of observed services.
@@ -328,7 +332,7 @@ void ShillPropertyHandler::UpdateObserved(ManagedState::ManagedType type,
// Delete network service observers still in observer_map.
for (ShillPropertyObserverMap::iterator iter = observer_map.begin();
iter != observer_map.end(); ++iter) {
- network_event_log::AddEntry(kLogModule, "StopObserving", iter->first);
+ NET_LOG_DEBUG("StopObserving", iter->first);
delete iter->second;
}
observer_map.swap(new_observed);
@@ -337,9 +341,8 @@ void ShillPropertyHandler::UpdateObserved(ManagedState::ManagedType type,
void ShillPropertyHandler::UpdateAvailableTechnologies(
const base::ListValue& technologies) {
available_technologies_.clear();
- network_event_log::AddEntry(
- kLogModule, "AvailableTechnologiesChanged",
- base::StringPrintf("Size: %"PRIuS, technologies.GetSize()));
+ NET_LOG_EVENT("AvailableTechnologiesChanged",
+ base::StringPrintf("Size: %"PRIuS, technologies.GetSize()));
for (base::ListValue::const_iterator iter = technologies.begin();
iter != technologies.end(); ++iter) {
std::string technology;
@@ -352,9 +355,8 @@ void ShillPropertyHandler::UpdateAvailableTechnologies(
void ShillPropertyHandler::UpdateEnabledTechnologies(
const base::ListValue& technologies) {
enabled_technologies_.clear();
- network_event_log::AddEntry(
- kLogModule, "EnabledTechnologiesChanged",
- base::StringPrintf("Size: %"PRIuS, technologies.GetSize()));
+ NET_LOG_EVENT("EnabledTechnologiesChanged",
+ base::StringPrintf("Size: %"PRIuS, technologies.GetSize()));
for (base::ListValue::const_iterator iter = technologies.begin();
iter != technologies.end(); ++iter) {
std::string technology;
@@ -368,9 +370,8 @@ void ShillPropertyHandler::UpdateEnabledTechnologies(
void ShillPropertyHandler::UpdateUninitializedTechnologies(
const base::ListValue& technologies) {
uninitialized_technologies_.clear();
- network_event_log::AddEntry(
- kLogModule, "UninitializedTechnologiesChanged",
- base::StringPrintf("Size: %"PRIuS, technologies.GetSize()));
+ NET_LOG_EVENT("UninitializedTechnologiesChanged",
+ base::StringPrintf("Size: %"PRIuS, technologies.GetSize()));
for (base::ListValue::const_iterator iter = technologies.begin();
iter != technologies.end(); ++iter) {
std::string technology;
@@ -387,7 +388,7 @@ void ShillPropertyHandler::EnableTechnologyFailed(
const std::string& error_message) {
enabling_technologies_.erase(technology);
network_handler::ShillErrorCallbackFunction(
- kLogModule, technology, error_callback, error_name, error_message);
+ technology, error_callback, error_name, error_message);
}
void ShillPropertyHandler::GetPropertiesCallback(
« no previous file with comments | « chromeos/network/shill_property_handler.h ('k') | chromeos/network/shill_property_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698