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

Side by Side Diff: chromeos/dbus/shill_ipconfig_client.cc

Issue 11367048: This is the first pass at making GetIPConfigs asynchronous. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 1 month 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
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 "chromeos/dbus/shill_ipconfig_client.h" 5 #include "chromeos/dbus/shill_ipconfig_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 } 232 }
233 233
234 virtual bool CallRemoveAndBlock( 234 virtual bool CallRemoveAndBlock(
235 const dbus::ObjectPath& ipconfig_path) OVERRIDE { 235 const dbus::ObjectPath& ipconfig_path) OVERRIDE {
236 return true; 236 return true;
237 } 237 }
238 238
239 private: 239 private:
240 // Runs callback with |properties_|. 240 // Runs callback with |properties_|.
241 void PassProperties(const DictionaryValueCallback& callback) const { 241 void PassProperties(const DictionaryValueCallback& callback) const {
242 callback.Run(DBUS_METHOD_CALL_SUCCESS, properties_); 242 scoped_ptr<base::DictionaryValue> properties_copy(properties_.DeepCopy());
243 callback.Run(DBUS_METHOD_CALL_SUCCESS, properties_copy.Pass());
243 } 244 }
244 245
245 base::DictionaryValue properties_; 246 base::DictionaryValue properties_;
246 247
247 // Note: This should remain the last member so it'll be destroyed and 248 // Note: This should remain the last member so it'll be destroyed and
248 // invalidate its weak pointers before any other members are destroyed. 249 // invalidate its weak pointers before any other members are destroyed.
249 base::WeakPtrFactory<ShillIPConfigClientStubImpl> weak_ptr_factory_; 250 base::WeakPtrFactory<ShillIPConfigClientStubImpl> weak_ptr_factory_;
250 251
251 DISALLOW_COPY_AND_ASSIGN(ShillIPConfigClientStubImpl); 252 DISALLOW_COPY_AND_ASSIGN(ShillIPConfigClientStubImpl);
252 }; 253 };
253 254
254 } // namespace 255 } // namespace
255 256
256 ShillIPConfigClient::ShillIPConfigClient() {} 257 ShillIPConfigClient::ShillIPConfigClient() {}
257 258
258 ShillIPConfigClient::~ShillIPConfigClient() {} 259 ShillIPConfigClient::~ShillIPConfigClient() {}
259 260
260 // static 261 // static
261 ShillIPConfigClient* ShillIPConfigClient::Create( 262 ShillIPConfigClient* ShillIPConfigClient::Create(
262 DBusClientImplementationType type, 263 DBusClientImplementationType type,
263 dbus::Bus* bus) { 264 dbus::Bus* bus) {
264 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) 265 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION)
265 return new ShillIPConfigClientImpl(bus); 266 return new ShillIPConfigClientImpl(bus);
266 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); 267 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type);
267 return new ShillIPConfigClientStubImpl(); 268 return new ShillIPConfigClientStubImpl();
268 } 269 }
269 270
270 } // namespace chromeos 271 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698