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

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

Issue 12379062: Remove Debug restriction on Bluetooth log messages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase again (base files missing?) Created 7 years, 9 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 | Annotate | Revision Log
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/bluetooth_adapter_client.h" 5 #include "chromeos/dbus/bluetooth_adapter_client.h"
6 6
7 #include <map> 7 #include <map>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 62
63 // The BluetoothAdapterClient implementation used in production. 63 // The BluetoothAdapterClient implementation used in production.
64 class BluetoothAdapterClientImpl: public BluetoothAdapterClient, 64 class BluetoothAdapterClientImpl: public BluetoothAdapterClient,
65 private BluetoothManagerClient::Observer { 65 private BluetoothManagerClient::Observer {
66 public: 66 public:
67 explicit BluetoothAdapterClientImpl(dbus::Bus* bus, 67 explicit BluetoothAdapterClientImpl(dbus::Bus* bus,
68 BluetoothManagerClient* manager_client) 68 BluetoothManagerClient* manager_client)
69 : bus_(bus), 69 : bus_(bus),
70 weak_ptr_factory_(this) { 70 weak_ptr_factory_(this) {
71 DVLOG(1) << "Creating BluetoothAdapterClientImpl";
72
73 DCHECK(manager_client); 71 DCHECK(manager_client);
74 manager_client->AddObserver(this); 72 manager_client->AddObserver(this);
75 } 73 }
76 74
77 virtual ~BluetoothAdapterClientImpl() { 75 virtual ~BluetoothAdapterClientImpl() {
78 // Clean up Properties structures 76 // Clean up Properties structures
79 for (ObjectMap::iterator iter = object_map_.begin(); 77 for (ObjectMap::iterator iter = object_map_.begin();
80 iter != object_map_.end(); ++iter) { 78 iter != object_map_.end(); ++iter) {
81 Object object = iter->second; 79 Object object = iter->second;
82 Properties* properties = object.second; 80 Properties* properties = object.second;
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 DCHECK(signal); 432 DCHECK(signal);
435 dbus::MessageReader reader(signal); 433 dbus::MessageReader reader(signal);
436 dbus::ObjectPath device_path; 434 dbus::ObjectPath device_path;
437 if (!reader.PopObjectPath(&device_path)) { 435 if (!reader.PopObjectPath(&device_path)) {
438 LOG(WARNING) << object_path.value() 436 LOG(WARNING) << object_path.value()
439 << ": DeviceCreated signal has incorrect parameters: " 437 << ": DeviceCreated signal has incorrect parameters: "
440 << signal->ToString(); 438 << signal->ToString();
441 return; 439 return;
442 } 440 }
443 441
444 DVLOG(1) << object_path.value() << ": Device created: " 442 VLOG(1) << object_path.value() << ": Device created: "
445 << device_path.value(); 443 << device_path.value();
446 FOR_EACH_OBSERVER(BluetoothAdapterClient::Observer, observers_, 444 FOR_EACH_OBSERVER(BluetoothAdapterClient::Observer, observers_,
447 DeviceCreated(object_path, device_path)); 445 DeviceCreated(object_path, device_path));
448 } 446 }
449 447
450 // Called by dbus:: when the DeviceCreated signal is initially connected. 448 // Called by dbus:: when the DeviceCreated signal is initially connected.
451 void DeviceCreatedConnected(const dbus::ObjectPath& object_path, 449 void DeviceCreatedConnected(const dbus::ObjectPath& object_path,
452 const std::string& interface_name, 450 const std::string& interface_name,
453 const std::string& signal_name, 451 const std::string& signal_name,
454 bool success) { 452 bool success) {
455 LOG_IF(WARNING, !success) << object_path.value() 453 LOG_IF(WARNING, !success) << object_path.value()
456 << ": Failed to connect to DeviceCreated signal."; 454 << ": Failed to connect to DeviceCreated signal.";
457 } 455 }
458 456
459 // Called by dbus:: when a DeviceRemoved signal is received. 457 // Called by dbus:: when a DeviceRemoved signal is received.
460 void DeviceRemovedReceived(const dbus::ObjectPath& object_path, 458 void DeviceRemovedReceived(const dbus::ObjectPath& object_path,
461 dbus::Signal* signal) { 459 dbus::Signal* signal) {
462 DCHECK(signal); 460 DCHECK(signal);
463 dbus::MessageReader reader(signal); 461 dbus::MessageReader reader(signal);
464 dbus::ObjectPath device_path; 462 dbus::ObjectPath device_path;
465 if (!reader.PopObjectPath(&device_path)) { 463 if (!reader.PopObjectPath(&device_path)) {
466 LOG(WARNING) << object_path.value() 464 LOG(WARNING) << object_path.value()
467 << ": DeviceRemoved signal has incorrect parameters: " 465 << ": DeviceRemoved signal has incorrect parameters: "
468 << signal->ToString(); 466 << signal->ToString();
469 return; 467 return;
470 } 468 }
471 469
472 DVLOG(1) << object_path.value() << ": Device removed: " 470 VLOG(1) << object_path.value() << ": Device removed: "
473 << device_path.value(); 471 << device_path.value();
474 FOR_EACH_OBSERVER(BluetoothAdapterClient::Observer, observers_, 472 FOR_EACH_OBSERVER(BluetoothAdapterClient::Observer, observers_,
475 DeviceRemoved(object_path, device_path)); 473 DeviceRemoved(object_path, device_path));
476 } 474 }
477 475
478 // Called by dbus:: when the DeviceRemoved signal is initially connected. 476 // Called by dbus:: when the DeviceRemoved signal is initially connected.
479 void DeviceRemovedConnected(const dbus::ObjectPath& object_path, 477 void DeviceRemovedConnected(const dbus::ObjectPath& object_path,
480 const std::string& interface_name, 478 const std::string& interface_name,
481 const std::string& signal_name, 479 const std::string& signal_name,
482 bool success) { 480 bool success) {
483 LOG_IF(WARNING, !success) << object_path.value() 481 LOG_IF(WARNING, !success) << object_path.value()
(...skipping 18 matching lines...) Expand all
502 // Get() or Set() calls. 500 // Get() or Set() calls.
503 BluetoothDeviceClient::Properties device_properties( 501 BluetoothDeviceClient::Properties device_properties(
504 NULL, BluetoothDeviceClient::Properties::PropertyChangedCallback()); 502 NULL, BluetoothDeviceClient::Properties::PropertyChangedCallback());
505 if (!device_properties.UpdatePropertiesFromReader(&reader)) { 503 if (!device_properties.UpdatePropertiesFromReader(&reader)) {
506 LOG(WARNING) << object_path.value() 504 LOG(WARNING) << object_path.value()
507 << ": DeviceFound signal has incorrect parameters: " 505 << ": DeviceFound signal has incorrect parameters: "
508 << signal->ToString(); 506 << signal->ToString();
509 return; 507 return;
510 } 508 }
511 509
512 DVLOG(1) << object_path.value() << ": Device found: " << address; 510 VLOG(1) << object_path.value() << ": Device found: " << address;
513 FOR_EACH_OBSERVER(BluetoothAdapterClient::Observer, observers_, 511 FOR_EACH_OBSERVER(BluetoothAdapterClient::Observer, observers_,
514 DeviceFound(object_path, address, device_properties)); 512 DeviceFound(object_path, address, device_properties));
515 } 513 }
516 514
517 // Called by dbus:: when the DeviceFound signal is initially connected. 515 // Called by dbus:: when the DeviceFound signal is initially connected.
518 void DeviceFoundConnected(const dbus::ObjectPath& object_path, 516 void DeviceFoundConnected(const dbus::ObjectPath& object_path,
519 const std::string& interface_name, 517 const std::string& interface_name,
520 const std::string& signal_name, 518 const std::string& signal_name,
521 bool success) { 519 bool success) {
522 LOG_IF(WARNING, !success) << object_path.value() 520 LOG_IF(WARNING, !success) << object_path.value()
523 << ": Failed to connect to DeviceFound signal."; 521 << ": Failed to connect to DeviceFound signal.";
524 } 522 }
525 523
526 // Called by dbus:: when a DeviceDisappeared signal is received. 524 // Called by dbus:: when a DeviceDisappeared signal is received.
527 void DeviceDisappearedReceived(const dbus::ObjectPath& object_path, 525 void DeviceDisappearedReceived(const dbus::ObjectPath& object_path,
528 dbus::Signal* signal) { 526 dbus::Signal* signal) {
529 DCHECK(signal); 527 DCHECK(signal);
530 dbus::MessageReader reader(signal); 528 dbus::MessageReader reader(signal);
531 std::string address; 529 std::string address;
532 if (!reader.PopString(&address)) { 530 if (!reader.PopString(&address)) {
533 LOG(WARNING) << object_path.value() 531 LOG(WARNING) << object_path.value()
534 << ": DeviceDisappeared signal has incorrect parameters: " 532 << ": DeviceDisappeared signal has incorrect parameters: "
535 << signal->ToString(); 533 << signal->ToString();
536 return; 534 return;
537 } 535 }
538 536
539 DVLOG(1) << object_path.value() << ": Device disappeared: " << address; 537 VLOG(1) << object_path.value() << ": Device disappeared: " << address;
540 FOR_EACH_OBSERVER(BluetoothAdapterClient::Observer, observers_, 538 FOR_EACH_OBSERVER(BluetoothAdapterClient::Observer, observers_,
541 DeviceDisappeared(object_path, address)); 539 DeviceDisappeared(object_path, address));
542 } 540 }
543 541
544 // Called by dbus:: when the DeviceDisappeared signal is initially connected. 542 // Called by dbus:: when the DeviceDisappeared signal is initially connected.
545 void DeviceDisappearedConnected(const dbus::ObjectPath& object_path, 543 void DeviceDisappearedConnected(const dbus::ObjectPath& object_path,
546 const std::string& interface_name, 544 const std::string& interface_name,
547 const std::string& signal_name, 545 const std::string& signal_name,
548 bool success) { 546 bool success) {
549 LOG_IF(WARNING, !success) 547 LOG_IF(WARNING, !success)
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 DBusClientImplementationType type, 922 DBusClientImplementationType type,
925 dbus::Bus* bus, 923 dbus::Bus* bus,
926 BluetoothManagerClient* manager_client) { 924 BluetoothManagerClient* manager_client) {
927 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) 925 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION)
928 return new BluetoothAdapterClientImpl(bus, manager_client); 926 return new BluetoothAdapterClientImpl(bus, manager_client);
929 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); 927 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type);
930 return new BluetoothAdapterClientStubImpl(); 928 return new BluetoothAdapterClientStubImpl();
931 } 929 }
932 930
933 } // namespace chromeos 931 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698