OLD | NEW |
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/bus.h" | 5 #include "dbus/bus.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 << error.name() << ": " << error.message(); | 605 << error.name() << ": " << error.message(); |
606 return false; | 606 return false; |
607 } | 607 } |
608 // Store the match rule, so that we can remove this in Detach(). | 608 // Store the match rule, so that we can remove this in Detach(). |
609 match_rules_.insert(match_rule); | 609 match_rules_.insert(match_rule); |
610 return true; | 610 return true; |
611 } | 611 } |
612 | 612 |
613 void ObjectProxy::UpdateNameOwnerAndBlock() { | 613 void ObjectProxy::UpdateNameOwnerAndBlock() { |
614 bus_->AssertOnDBusThread(); | 614 bus_->AssertOnDBusThread(); |
| 615 // Errors should be suppressed here, as the service may not be yet running |
| 616 // when connecting to signals of the service, which is just fine. |
| 617 // The ObjectProxy will be notified when the service is launched via |
| 618 // NameOwnerChanged signal. See also comments in ConnectToSignalInternal(). |
615 service_name_owner_ = | 619 service_name_owner_ = |
616 bus_->GetServiceOwnerAndBlock(service_name_, Bus::REPORT_ERRORS); | 620 bus_->GetServiceOwnerAndBlock(service_name_, Bus::SUPPRESS_ERRORS); |
617 } | 621 } |
618 | 622 |
619 DBusHandlerResult ObjectProxy::HandleNameOwnerChanged( | 623 DBusHandlerResult ObjectProxy::HandleNameOwnerChanged( |
620 scoped_ptr<Signal> signal) { | 624 scoped_ptr<Signal> signal) { |
621 DCHECK(signal); | 625 DCHECK(signal); |
622 bus_->AssertOnDBusThread(); | 626 bus_->AssertOnDBusThread(); |
623 | 627 |
624 // Confirm the validity of the NameOwnerChanged signal. | 628 // Confirm the validity of the NameOwnerChanged signal. |
625 if (signal->GetMember() == kNameOwnerChangedMember && | 629 if (signal->GetMember() == kNameOwnerChangedMember && |
626 signal->GetInterface() == kDBusSystemObjectInterface && | 630 signal->GetInterface() == kDBusSystemObjectInterface && |
(...skipping 19 matching lines...) Expand all Loading... |
646 } | 650 } |
647 } | 651 } |
648 } | 652 } |
649 | 653 |
650 // Always return unhandled to let other object proxies handle the same | 654 // Always return unhandled to let other object proxies handle the same |
651 // signal. | 655 // signal. |
652 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; | 656 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; |
653 } | 657 } |
654 | 658 |
655 } // namespace dbus | 659 } // namespace dbus |
OLD | NEW |