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

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: Rebase + update comment 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
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..4a7957ac7601c4ccfdbe3526c3c6c74a0547f02e 100644
--- a/chromeos/network/shill_property_handler.cc
+++ b/chromeos/network/shill_property_handler.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/format_macros.h"
+#include "base/json/json_writer.h"
#include "base/stl_util.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
@@ -22,8 +23,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 +159,7 @@ void ShillPropertyHandler::SetTechnologyEnabled(
technology,
base::Bind(&base::DoNothing),
base::Bind(&network_handler::ShillErrorCallbackFunction,
- kLogModule, technology, error_callback));
+ technology, error_callback));
}
}
@@ -169,15 +168,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 +202,15 @@ 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;
+ std::string vstr;
+ base::JSONWriter::Write(&value, &vstr);
+ if (!vstr.empty())
pneubeck (no reviews) 2013/05/16 08:21:07 same here.
stevenjb 2013/05/16 17:09:53 ditto
+ detail += " = " + vstr;
+ 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 +230,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 +253,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 +326,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 +336,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 +345,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 +359,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 +374,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 +392,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(

Powered by Google App Engine
This is Rietveld 408576698