| 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.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| (...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 this)); | 868 this)); |
| 869 } | 869 } |
| 870 | 870 |
| 871 void Bus::OnConnectionDisconnected(DBusConnection* connection) { | 871 void Bus::OnConnectionDisconnected(DBusConnection* connection) { |
| 872 AssertOnDBusThread(); | 872 AssertOnDBusThread(); |
| 873 | 873 |
| 874 if (!connection) | 874 if (!connection) |
| 875 return; | 875 return; |
| 876 DCHECK(!dbus_connection_get_is_connected(connection)); | 876 DCHECK(!dbus_connection_get_is_connected(connection)); |
| 877 | 877 |
| 878 if (shutdown_completed_) | |
| 879 return; // Do nothing if the shutdown is already completed. | |
| 880 | |
| 881 // Unexpected disconnection, maybe the peer closes the connection. | |
| 882 DCHECK_EQ(connection, connection_); | |
| 883 ShutdownAndBlock(); | 878 ShutdownAndBlock(); |
| 884 } | 879 } |
| 885 | 880 |
| 886 dbus_bool_t Bus::OnAddWatchThunk(DBusWatch* raw_watch, void* data) { | 881 dbus_bool_t Bus::OnAddWatchThunk(DBusWatch* raw_watch, void* data) { |
| 887 Bus* self = static_cast<Bus*>(data); | 882 Bus* self = static_cast<Bus*>(data); |
| 888 return self->OnAddWatch(raw_watch); | 883 return self->OnAddWatch(raw_watch); |
| 889 } | 884 } |
| 890 | 885 |
| 891 void Bus::OnRemoveWatchThunk(DBusWatch* raw_watch, void* data) { | 886 void Bus::OnRemoveWatchThunk(DBusWatch* raw_watch, void* data) { |
| 892 Bus* self = static_cast<Bus*>(data); | 887 Bus* self = static_cast<Bus*>(data); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 kDisconnectedSignal)) { | 924 kDisconnectedSignal)) { |
| 930 Bus* self = static_cast<Bus*>(data); | 925 Bus* self = static_cast<Bus*>(data); |
| 931 self->AssertOnDBusThread(); | 926 self->AssertOnDBusThread(); |
| 932 self->OnConnectionDisconnected(connection); | 927 self->OnConnectionDisconnected(connection); |
| 933 return DBUS_HANDLER_RESULT_HANDLED; | 928 return DBUS_HANDLER_RESULT_HANDLED; |
| 934 } | 929 } |
| 935 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; | 930 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; |
| 936 } | 931 } |
| 937 | 932 |
| 938 } // namespace dbus | 933 } // namespace dbus |
| OLD | NEW |