aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
authorAlex Vakulenko <avakulenko@google.com>2016-03-28 15:41:49 -0700
committerAlex Vakulenko <avakulenko@google.com>2016-03-29 15:05:55 +0000
commit38a2aef3d483ef9bd73989a0a25a636a7d03cad9 (patch)
treee334ff22c7d5bb72653a3ee97918658b5f030361 /src/commands
parentbf79a9eb710d8c9df6ab3e5e305ff6c881a19ab2 (diff)
downloadlibweave-38a2aef3d483ef9bd73989a0a25a636a7d03cad9.tar.gz
libweave: Remove release() calls on scoped_ptr
Now that scoped_ptr is just a type alias to std::unique_ptr, there is no need to do release()/aquire semantics to convert between scoped_ptr and unique_ptr. Also, replaced base::Value::DeepCopy with the safer smart-pointer-enabled base::Value::CreateDeepCopy. Change-Id: I6b7ed78b3fae6d42a68b7d73ae4d9d5eebf48922 Reviewed-on: https://weave-review.googlesource.com/3067 Reviewed-by: Robert Ginda <rginda@google.com>
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/cloud_command_proxy.cc4
-rw-r--r--src/commands/command_instance.cc16
2 files changed, 10 insertions, 10 deletions
diff --git a/src/commands/cloud_command_proxy.cc b/src/commands/cloud_command_proxy.cc
index f8f8d1f..c12e833 100644
--- a/src/commands/cloud_command_proxy.cc
+++ b/src/commands/cloud_command_proxy.cc
@@ -35,8 +35,8 @@ void CloudCommandProxy::OnErrorChanged() {
std::unique_ptr<base::DictionaryValue> patch{new base::DictionaryValue};
patch->Set(commands::attributes::kCommand_Error,
command_instance_->GetError()
- ? ErrorInfoToJson(*command_instance_->GetError()).release()
- : base::Value::CreateNullValue().release());
+ ? ErrorInfoToJson(*command_instance_->GetError())
+ : base::Value::CreateNullValue());
QueueCommandUpdate(std::move(patch));
}
diff --git a/src/commands/command_instance.cc b/src/commands/command_instance.cc
index dfc3fbd..1e7e16f 100644
--- a/src/commands/command_instance.cc
+++ b/src/commands/command_instance.cc
@@ -156,7 +156,7 @@ std::unique_ptr<base::DictionaryValue> GetCommandParameters(
"Property '%s' must be a JSON object",
commands::attributes::kCommand_Parameters);
}
- params.reset(params_dict->DeepCopy());
+ params = params_dict->CreateDeepCopy();
} else {
// "parameters" are not specified. Assume empty param list.
params.reset(new base::DictionaryValue);
@@ -221,14 +221,14 @@ std::unique_ptr<base::DictionaryValue> CommandInstance::ToJson() const {
json->SetString(commands::attributes::kCommand_Id, id_);
json->SetString(commands::attributes::kCommand_Name, name_);
json->SetString(commands::attributes::kCommand_Component, component_);
- json->Set(commands::attributes::kCommand_Parameters, parameters_.DeepCopy());
- json->Set(commands::attributes::kCommand_Progress, progress_.DeepCopy());
- json->Set(commands::attributes::kCommand_Results, results_.DeepCopy());
+ json->Set(commands::attributes::kCommand_Parameters,
+ parameters_.CreateDeepCopy());
+ json->Set(commands::attributes::kCommand_Progress,
+ progress_.CreateDeepCopy());
+ json->Set(commands::attributes::kCommand_Results, results_.CreateDeepCopy());
json->SetString(commands::attributes::kCommand_State, EnumToString(state_));
- if (error_) {
- json->Set(commands::attributes::kCommand_Error,
- ErrorInfoToJson(*error_).release());
- }
+ if (error_)
+ json->Set(commands::attributes::kCommand_Error, ErrorInfoToJson(*error_));
return json;
}