Commit 35fdb442 authored by Abhishek Bhardwaj's avatar Abhishek Bhardwaj Committed by Commit Bot

Clang format network related files

This change clang formats a subset of network related source files.

BUG=891143
TEST=Compile.

Change-Id: I131d132dbcd36200310a8c785eab067795e20576
Reviewed-on: https://chromium-review.googlesource.com/c/1252334
Commit-Queue: Abhishek Bhardwaj <abhishekbh@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595904}
parent 88a928b2
......@@ -39,8 +39,8 @@ const char kFailedMessage[] = "Failed";
void ErrorFunction(const std::string& device_path,
const std::string& error_name,
const std::string& error_message) {
LOG(ERROR) << "Shill Error for: " << device_path
<< ": " << error_name << " : " << error_message;
LOG(ERROR) << "Shill Error for: " << device_path << ": " << error_name
<< " : " << error_message;
}
void PostError(const std::string& error,
......@@ -391,8 +391,10 @@ ShillDeviceClient::TestInterface* FakeShillDeviceClient::GetTestInterface() {
void FakeShillDeviceClient::AddDevice(const std::string& device_path,
const std::string& type,
const std::string& name) {
DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()->
AddDevice(device_path);
DBusThreadManager::Get()
->GetShillManagerClient()
->GetTestInterface()
->AddDevice(device_path);
base::Value* properties = GetDeviceProperties(device_path);
properties->SetKey(shill::kTypeProperty, base::Value(type));
......@@ -407,15 +409,19 @@ void FakeShillDeviceClient::AddDevice(const std::string& device_path,
}
void FakeShillDeviceClient::RemoveDevice(const std::string& device_path) {
DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()->
RemoveDevice(device_path);
DBusThreadManager::Get()
->GetShillManagerClient()
->GetTestInterface()
->RemoveDevice(device_path);
stub_devices_.RemoveWithoutPathExpansion(device_path, NULL);
}
void FakeShillDeviceClient::ClearDevices() {
DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()->
ClearDevices();
DBusThreadManager::Get()
->GetShillManagerClient()
->GetTestInterface()
->ClearDevices();
stub_devices_.Clear();
}
......@@ -424,8 +430,8 @@ void FakeShillDeviceClient::SetDeviceProperty(const std::string& device_path,
const std::string& name,
const base::Value& value,
bool notify_changed) {
VLOG(1) << "SetDeviceProperty: " << device_path
<< ": " << name << " = " << value;
VLOG(1) << "SetDeviceProperty: " << device_path << ": " << name << " = "
<< value;
SetPropertyInternal(dbus::ObjectPath(device_path), name, value,
base::DoNothing(),
base::Bind(&ErrorFunction, device_path), notify_changed);
......@@ -433,14 +439,14 @@ void FakeShillDeviceClient::SetDeviceProperty(const std::string& device_path,
std::string FakeShillDeviceClient::GetDevicePathForType(
const std::string& type) {
for (base::DictionaryValue::Iterator iter(stub_devices_);
!iter.IsAtEnd(); iter.Advance()) {
for (base::DictionaryValue::Iterator iter(stub_devices_); !iter.IsAtEnd();
iter.Advance()) {
const base::DictionaryValue* properties = NULL;
if (!iter.value().GetAsDictionary(&properties))
continue;
std::string prop_type;
if (!properties->GetStringWithoutPathExpansion(
shill::kTypeProperty, &prop_type) ||
if (!properties->GetStringWithoutPathExpansion(shill::kTypeProperty,
&prop_type) ||
prop_type != type)
continue;
return iter.key();
......@@ -611,8 +617,8 @@ void FakeShillDeviceClient::PassStubDeviceProperties(
const dbus::ObjectPath& device_path,
const DictionaryValueCallback& callback) const {
const base::DictionaryValue* device_properties = NULL;
if (!stub_devices_.GetDictionaryWithoutPathExpansion(
device_path.value(), &device_properties)) {
if (!stub_devices_.GetDictionaryWithoutPathExpansion(device_path.value(),
&device_properties)) {
base::DictionaryValue empty_dictionary;
callback.Run(DBUS_METHOD_CALL_FAILURE, empty_dictionary);
return;
......@@ -638,8 +644,7 @@ void FakeShillDeviceClient::NotifyObserversPropertyChanged(
}
base::Value* value = NULL;
if (!dict->GetWithoutPathExpansion(property, &value)) {
LOG(ERROR) << "Notify for unknown property: "
<< path << " : " << property;
LOG(ERROR) << "Notify for unknown property: " << path << " : " << property;
return;
}
for (auto& observer : GetObserverList(device_path))
......
......@@ -78,11 +78,10 @@ class CHROMEOS_EXPORT FakeShillDeviceClient
const std::string& peer,
const StringCallback& callback,
const ErrorCallback& error_callback) override;
void AddWakeOnPacketConnection(
const dbus::ObjectPath& device_path,
const net::IPEndPoint& ip_endpoint,
const base::Closure& callback,
const ErrorCallback& error_callback) override;
void AddWakeOnPacketConnection(const dbus::ObjectPath& device_path,
const net::IPEndPoint& ip_endpoint,
const base::Closure& callback,
const ErrorCallback& error_callback) override;
void RemoveWakeOnPacketConnection(
const dbus::ObjectPath& device_path,
const net::IPEndPoint& ip_endpoint,
......@@ -165,7 +164,7 @@ class CHROMEOS_EXPORT FakeShillDeviceClient
std::string tdls_state_;
// Wake on packet connections for each device.
std::map<dbus::ObjectPath, std::set<net::IPEndPoint> >
std::map<dbus::ObjectPath, std::set<net::IPEndPoint>>
wake_on_packet_connections_;
// Current SIM PIN per device path.
......
......@@ -27,13 +27,11 @@ namespace {
// The ShillDeviceClient implementation.
class ShillDeviceClientImpl : public ShillDeviceClient {
public:
ShillDeviceClientImpl()
: bus_(NULL) {
}
ShillDeviceClientImpl() : bus_(NULL) {}
~ShillDeviceClientImpl() override {
for (HelperMap::iterator iter = helpers_.begin();
iter != helpers_.end(); ++iter) {
for (HelperMap::iterator iter = helpers_.begin(); iter != helpers_.end();
++iter) {
// This *should* never happen, yet we're getting crash reports that
// seem to imply that it does happen sometimes. Adding CHECKs here
// so we can determine more accurately where the problem lies.
......@@ -75,9 +73,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
dbus::MessageWriter writer(&method_call);
writer.AppendString(name);
ShillClientHelper::AppendValueDataAsVariant(&writer, value);
GetHelper(device_path)->CallVoidMethodWithErrorCallback(&method_call,
callback,
error_callback);
GetHelper(device_path)
->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback);
}
void ClearProperty(const dbus::ObjectPath& device_path,
......@@ -100,8 +98,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
dbus::MessageWriter writer(&method_call);
writer.AppendString(pin);
writer.AppendBool(require);
GetHelper(device_path)->CallVoidMethodWithErrorCallback(
&method_call, callback, error_callback);
GetHelper(device_path)
->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback);
}
void EnterPin(const dbus::ObjectPath& device_path,
......@@ -112,8 +111,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
shill::kEnterPinFunction);
dbus::MessageWriter writer(&method_call);
writer.AppendString(pin);
GetHelper(device_path)->CallVoidMethodWithErrorCallback(
&method_call, callback, error_callback);
GetHelper(device_path)
->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback);
}
void UnblockPin(const dbus::ObjectPath& device_path,
......@@ -126,8 +126,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
dbus::MessageWriter writer(&method_call);
writer.AppendString(puk);
writer.AppendString(pin);
GetHelper(device_path)->CallVoidMethodWithErrorCallback(
&method_call, callback, error_callback);
GetHelper(device_path)
->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback);
}
void ChangePin(const dbus::ObjectPath& device_path,
......@@ -140,8 +141,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
dbus::MessageWriter writer(&method_call);
writer.AppendString(old_pin);
writer.AppendString(new_pin);
GetHelper(device_path)->CallVoidMethodWithErrorCallback(
&method_call, callback, error_callback);
GetHelper(device_path)
->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback);
}
void Register(const dbus::ObjectPath& device_path,
......@@ -152,8 +154,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
shill::kRegisterFunction);
dbus::MessageWriter writer(&method_call);
writer.AppendString(network_id);
GetHelper(device_path)->CallVoidMethodWithErrorCallback(
&method_call, callback, error_callback);
GetHelper(device_path)
->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback);
}
void SetCarrier(const dbus::ObjectPath& device_path,
......@@ -164,8 +167,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
shill::kSetCarrierFunction);
dbus::MessageWriter writer(&method_call);
writer.AppendString(carrier);
GetHelper(device_path)->CallVoidMethodWithErrorCallback(
&method_call, callback, error_callback);
GetHelper(device_path)
->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback);
}
void Reset(const dbus::ObjectPath& device_path,
......@@ -173,8 +177,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
const ErrorCallback& error_callback) override {
dbus::MethodCall method_call(shill::kFlimflamDeviceInterface,
shill::kResetFunction);
GetHelper(device_path)->CallVoidMethodWithErrorCallback(
&method_call, callback, error_callback);
GetHelper(device_path)
->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback);
}
void PerformTDLSOperation(const dbus::ObjectPath& device_path,
......@@ -187,15 +192,15 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
dbus::MessageWriter writer(&method_call);
writer.AppendString(operation);
writer.AppendString(peer);
GetHelper(device_path)->CallStringMethodWithErrorCallback(
&method_call, callback, error_callback);
GetHelper(device_path)
->CallStringMethodWithErrorCallback(&method_call, callback,
error_callback);
}
void AddWakeOnPacketConnection(
const dbus::ObjectPath& device_path,
const net::IPEndPoint& ip_endpoint,
const base::Closure& callback,
const ErrorCallback& error_callback) override {
void AddWakeOnPacketConnection(const dbus::ObjectPath& device_path,
const net::IPEndPoint& ip_endpoint,
const base::Closure& callback,
const ErrorCallback& error_callback) override {
if (ip_endpoint.address().empty()) {
LOG(ERROR) << "AddWakeOnPacketConnection: null address";
return;
......@@ -204,9 +209,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
shill::kAddWakeOnPacketConnectionFunction);
dbus::MessageWriter writer(&method_call);
writer.AppendString(ip_endpoint.ToStringWithoutPort());
GetHelper(device_path)->CallVoidMethodWithErrorCallback(&method_call,
callback,
error_callback);
GetHelper(device_path)
->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback);
}
void RemoveWakeOnPacketConnection(
......@@ -222,9 +227,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
shill::kRemoveWakeOnPacketConnectionFunction);
dbus::MessageWriter writer(&method_call);
writer.AppendString(ip_endpoint.ToStringWithoutPort());
GetHelper(device_path)->CallVoidMethodWithErrorCallback(&method_call,
callback,
error_callback);
GetHelper(device_path)
->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback);
}
void RemoveAllWakeOnPacketConnections(
......@@ -234,9 +239,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
dbus::MethodCall method_call(
shill::kFlimflamDeviceInterface,
shill::kRemoveAllWakeOnPacketConnectionsFunction);
GetHelper(device_path)->CallVoidMethodWithErrorCallback(&method_call,
callback,
error_callback);
GetHelper(device_path)
->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback);
}
TestInterface* GetTestInterface() override { return NULL; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment