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

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

Issue 2561963002: base: Remove the string logging from CHECK(). (Closed)
Patch Set: checkstring: rebase Created 4 years 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_device_client.h" 5 #include "chromeos/dbus/shill_device_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 18 matching lines...) Expand all
29 : bus_(NULL) { 29 : bus_(NULL) {
30 } 30 }
31 31
32 ~ShillDeviceClientImpl() override { 32 ~ShillDeviceClientImpl() override {
33 for (HelperMap::iterator iter = helpers_.begin(); 33 for (HelperMap::iterator iter = helpers_.begin();
34 iter != helpers_.end(); ++iter) { 34 iter != helpers_.end(); ++iter) {
35 // This *should* never happen, yet we're getting crash reports that 35 // This *should* never happen, yet we're getting crash reports that
36 // seem to imply that it does happen sometimes. Adding CHECKs here 36 // seem to imply that it does happen sometimes. Adding CHECKs here
37 // so we can determine more accurately where the problem lies. 37 // so we can determine more accurately where the problem lies.
38 // See: http://crbug.com/170541 38 // See: http://crbug.com/170541
39 CHECK(iter->second) << "NULL Helper found in helper list."; 39 // NULL Helper found in helper list.
40 CHECK(iter->second);
40 delete iter->second; 41 delete iter->second;
41 } 42 }
42 helpers_.clear(); 43 helpers_.clear();
43 } 44 }
44 45
45 /////////////////////////////////////// 46 ///////////////////////////////////////
46 // ShillDeviceClient overrides. 47 // ShillDeviceClient overrides.
47 void AddPropertyChangedObserver( 48 void AddPropertyChangedObserver(
48 const dbus::ObjectPath& device_path, 49 const dbus::ObjectPath& device_path,
49 ShillPropertyChangedObserver* observer) override { 50 ShillPropertyChangedObserver* observer) override {
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 protected: 260 protected:
260 void Init(dbus::Bus* bus) override { bus_ = bus; } 261 void Init(dbus::Bus* bus) override { bus_ = bus; }
261 262
262 private: 263 private:
263 typedef std::map<std::string, ShillClientHelper*> HelperMap; 264 typedef std::map<std::string, ShillClientHelper*> HelperMap;
264 265
265 // Returns the corresponding ShillClientHelper for the profile. 266 // Returns the corresponding ShillClientHelper for the profile.
266 ShillClientHelper* GetHelper(const dbus::ObjectPath& device_path) { 267 ShillClientHelper* GetHelper(const dbus::ObjectPath& device_path) {
267 HelperMap::iterator it = helpers_.find(device_path.value()); 268 HelperMap::iterator it = helpers_.find(device_path.value());
268 if (it != helpers_.end()) { 269 if (it != helpers_.end()) {
269 CHECK(it->second) << "Found a NULL helper in the list."; 270 // Found a NULL helper in the list.
271 CHECK(it->second);
270 return it->second; 272 return it->second;
271 } 273 }
272 274
273 // There is no helper for the profile, create it. 275 // There is no helper for the profile, create it.
274 dbus::ObjectProxy* object_proxy = 276 dbus::ObjectProxy* object_proxy =
275 bus_->GetObjectProxy(shill::kFlimflamServiceName, device_path); 277 bus_->GetObjectProxy(shill::kFlimflamServiceName, device_path);
276 ShillClientHelper* helper = new ShillClientHelper(object_proxy); 278 ShillClientHelper* helper = new ShillClientHelper(object_proxy);
277 CHECK(helper) << "Unable to create Shill client helper."; 279 // Unable to create Shill client helper.
280 CHECK(helper);
278 helper->MonitorPropertyChanged(shill::kFlimflamDeviceInterface); 281 helper->MonitorPropertyChanged(shill::kFlimflamDeviceInterface);
279 helpers_.insert(HelperMap::value_type(device_path.value(), helper)); 282 helpers_.insert(HelperMap::value_type(device_path.value(), helper));
280 return helper; 283 return helper;
281 } 284 }
282 285
283 dbus::Bus* bus_; 286 dbus::Bus* bus_;
284 HelperMap helpers_; 287 HelperMap helpers_;
285 288
286 DISALLOW_COPY_AND_ASSIGN(ShillDeviceClientImpl); 289 DISALLOW_COPY_AND_ASSIGN(ShillDeviceClientImpl);
287 }; 290 };
288 291
289 } // namespace 292 } // namespace
290 293
291 ShillDeviceClient::ShillDeviceClient() {} 294 ShillDeviceClient::ShillDeviceClient() {}
292 295
293 ShillDeviceClient::~ShillDeviceClient() {} 296 ShillDeviceClient::~ShillDeviceClient() {}
294 297
295 // static 298 // static
296 ShillDeviceClient* ShillDeviceClient::Create() { 299 ShillDeviceClient* ShillDeviceClient::Create() {
297 return new ShillDeviceClientImpl(); 300 return new ShillDeviceClientImpl();
298 } 301 }
299 302
300 } // namespace chromeos 303 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698