OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef DBUS_BUS_H_ | 5 #ifndef DBUS_BUS_H_ |
6 #define DBUS_BUS_H_ | 6 #define DBUS_BUS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 376 |
377 // Check whether the current thread is on the origin thread (the thread | 377 // Check whether the current thread is on the origin thread (the thread |
378 // that created the bus). If not, DCHECK will fail. | 378 // that created the bus). If not, DCHECK will fail. |
379 virtual void AssertOnOriginThread(); | 379 virtual void AssertOnOriginThread(); |
380 | 380 |
381 // Check whether the current thread is on the D-Bus thread. If not, | 381 // Check whether the current thread is on the D-Bus thread. If not, |
382 // DCHECK will fail. If the D-Bus thread is not supplied, it calls | 382 // DCHECK will fail. If the D-Bus thread is not supplied, it calls |
383 // AssertOnOriginThread(). | 383 // AssertOnOriginThread(). |
384 virtual void AssertOnDBusThread(); | 384 virtual void AssertOnDBusThread(); |
385 | 385 |
| 386 // Returns true if the bus is connected to D-Bus. |
| 387 bool is_connected() { return connection_ != NULL; } |
| 388 |
386 protected: | 389 protected: |
387 // This is protected, so we can define sub classes. | 390 // This is protected, so we can define sub classes. |
388 virtual ~Bus(); | 391 virtual ~Bus(); |
389 | 392 |
390 private: | 393 private: |
391 friend class base::RefCountedThreadSafe<Bus>; | 394 friend class base::RefCountedThreadSafe<Bus>; |
392 | 395 |
393 // Helper function used for ShutdownOnDBusThreadAndBlock(). | 396 // Helper function used for ShutdownOnDBusThreadAndBlock(). |
394 void ShutdownOnDBusThreadAndBlockInternal(); | 397 void ShutdownOnDBusThreadAndBlockInternal(); |
395 | 398 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 // OnAddTimeout()/OnRemoveTimeou() are balanced. | 474 // OnAddTimeout()/OnRemoveTimeou() are balanced. |
472 int num_pending_watches_; | 475 int num_pending_watches_; |
473 int num_pending_timeouts_; | 476 int num_pending_timeouts_; |
474 | 477 |
475 DISALLOW_COPY_AND_ASSIGN(Bus); | 478 DISALLOW_COPY_AND_ASSIGN(Bus); |
476 }; | 479 }; |
477 | 480 |
478 } // namespace dbus | 481 } // namespace dbus |
479 | 482 |
480 #endif // DBUS_BUS_H_ | 483 #endif // DBUS_BUS_H_ |
OLD | NEW |