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

Side by Side Diff: dbus/property.cc

Issue 1867253002: Convert //dbus from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: IWYU fixes in //device Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « dbus/object_proxy_unittest.cc ('k') | dbus/property_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "dbus/property.h" 5 #include "dbus/property.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 callback.Run(response); 134 callback.Run(response);
135 } 135 }
136 136
137 bool PropertySet::GetAndBlock(PropertyBase* property) { 137 bool PropertySet::GetAndBlock(PropertyBase* property) {
138 MethodCall method_call(kPropertiesInterface, kPropertiesGet); 138 MethodCall method_call(kPropertiesInterface, kPropertiesGet);
139 MessageWriter writer(&method_call); 139 MessageWriter writer(&method_call);
140 writer.AppendString(interface()); 140 writer.AppendString(interface());
141 writer.AppendString(property->name()); 141 writer.AppendString(property->name());
142 142
143 DCHECK(object_proxy_); 143 DCHECK(object_proxy_);
144 scoped_ptr<dbus::Response> response( 144 std::unique_ptr<dbus::Response> response(object_proxy_->CallMethodAndBlock(
145 object_proxy_->CallMethodAndBlock(&method_call, 145 &method_call, ObjectProxy::TIMEOUT_USE_DEFAULT));
146 ObjectProxy::TIMEOUT_USE_DEFAULT));
147 146
148 if (!response.get()) { 147 if (!response.get()) {
149 LOG(WARNING) << property->name() << ": GetAndBlock: failed."; 148 LOG(WARNING) << property->name() << ": GetAndBlock: failed.";
150 return false; 149 return false;
151 } 150 }
152 151
153 MessageReader reader(response.get()); 152 MessageReader reader(response.get());
154 if (property->PopValueFromReader(&reader)) { 153 if (property->PopValueFromReader(&reader)) {
155 property->set_valid(true); 154 property->set_valid(true);
156 NotifyPropertyChanged(property->name()); 155 NotifyPropertyChanged(property->name());
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 } 204 }
206 205
207 bool PropertySet::SetAndBlock(PropertyBase* property) { 206 bool PropertySet::SetAndBlock(PropertyBase* property) {
208 MethodCall method_call(kPropertiesInterface, kPropertiesSet); 207 MethodCall method_call(kPropertiesInterface, kPropertiesSet);
209 MessageWriter writer(&method_call); 208 MessageWriter writer(&method_call);
210 writer.AppendString(interface()); 209 writer.AppendString(interface());
211 writer.AppendString(property->name()); 210 writer.AppendString(property->name());
212 property->AppendSetValueToWriter(&writer); 211 property->AppendSetValueToWriter(&writer);
213 212
214 DCHECK(object_proxy_); 213 DCHECK(object_proxy_);
215 scoped_ptr<dbus::Response> response( 214 std::unique_ptr<dbus::Response> response(object_proxy_->CallMethodAndBlock(
216 object_proxy_->CallMethodAndBlock(&method_call, 215 &method_call, ObjectProxy::TIMEOUT_USE_DEFAULT));
217 ObjectProxy::TIMEOUT_USE_DEFAULT));
218 if (response.get()) 216 if (response.get())
219 return true; 217 return true;
220 return false; 218 return false;
221 } 219 }
222 220
223 void PropertySet::OnSet(PropertyBase* property, 221 void PropertySet::OnSet(PropertyBase* property,
224 SetCallback callback, 222 SetCallback callback,
225 Response* response) { 223 Response* response) {
226 LOG_IF(WARNING, !response) << property->name() << ": Set: failed."; 224 LOG_IF(WARNING, !response) << property->name() << ": Set: failed.";
227 if (!callback.is_null()) 225 if (!callback.is_null())
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 template class Property<double>; 670 template class Property<double>;
673 template class Property<std::string>; 671 template class Property<std::string>;
674 template class Property<ObjectPath>; 672 template class Property<ObjectPath>;
675 template class Property<std::vector<std::string> >; 673 template class Property<std::vector<std::string> >;
676 template class Property<std::vector<ObjectPath> >; 674 template class Property<std::vector<ObjectPath> >;
677 template class Property<std::vector<uint8_t>>; 675 template class Property<std::vector<uint8_t>>;
678 template class Property<std::map<std::string, std::string>>; 676 template class Property<std::map<std::string, std::string>>;
679 template class Property<std::vector<std::pair<std::vector<uint8_t>, uint16_t>>>; 677 template class Property<std::vector<std::pair<std::vector<uint8_t>, uint16_t>>>;
680 678
681 } // namespace dbus 679 } // namespace dbus
OLDNEW
« no previous file with comments | « dbus/object_proxy_unittest.cc ('k') | dbus/property_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698