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 #ifndef DBUS_BUS_H_ | 5 #ifndef DBUS_BUS_H_ |
6 #define DBUS_BUS_H_ | 6 #define DBUS_BUS_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
434 virtual void AssertOnOriginThread(); | 434 virtual void AssertOnOriginThread(); |
435 | 435 |
436 // Check whether the current thread is on the D-Bus thread. If not, | 436 // Check whether the current thread is on the D-Bus thread. If not, |
437 // DCHECK will fail. If the D-Bus thread is not supplied, it calls | 437 // DCHECK will fail. If the D-Bus thread is not supplied, it calls |
438 // AssertOnOriginThread(). | 438 // AssertOnOriginThread(). |
439 virtual void AssertOnDBusThread(); | 439 virtual void AssertOnDBusThread(); |
440 | 440 |
441 // Returns true if the bus is connected to D-Bus. | 441 // Returns true if the bus is connected to D-Bus. |
442 bool is_connected() { return connection_ != NULL; } | 442 bool is_connected() { return connection_ != NULL; } |
443 | 443 |
444 // Processes the all incoming data to the connection, if any. | |
445 // | |
446 // BLOCKING CALL. | |
447 void ProcessAllIncomingDataIfAny(); | |
satorux1
2012/10/25 08:56:23
No need to expose, right?
Haruki Sato
2012/10/26 05:03:24
Done.
Thanks.
| |
448 | |
444 protected: | 449 protected: |
445 // This is protected, so we can define sub classes. | 450 // This is protected, so we can define sub classes. |
446 virtual ~Bus(); | 451 virtual ~Bus(); |
447 | 452 |
448 private: | 453 private: |
449 friend class base::RefCountedThreadSafe<Bus>; | 454 friend class base::RefCountedThreadSafe<Bus>; |
450 | 455 |
451 // Helper function used for UnregisterExportedObject(). | 456 // Helper function used for UnregisterExportedObject(). |
452 void UnregisterExportedObjectInternal( | 457 void UnregisterExportedObjectInternal( |
453 scoped_refptr<dbus::ExportedObject> exported_object); | 458 scoped_refptr<dbus::ExportedObject> exported_object); |
454 | 459 |
455 // Helper function used for ShutdownOnDBusThreadAndBlock(). | 460 // Helper function used for ShutdownOnDBusThreadAndBlock(). |
456 void ShutdownOnDBusThreadAndBlockInternal(); | 461 void ShutdownOnDBusThreadAndBlockInternal(); |
457 | 462 |
458 // Helper function used for RequestOwnership(). | 463 // Helper function used for RequestOwnership(). |
459 void RequestOwnershipInternal(const std::string& service_name, | 464 void RequestOwnershipInternal(const std::string& service_name, |
460 OnOwnershipCallback on_ownership_callback); | 465 OnOwnershipCallback on_ownership_callback); |
461 | 466 |
462 // Called when the ownership request is completed. | 467 // Called when the ownership request is completed. |
463 void OnOwnership(OnOwnershipCallback on_ownership_callback, | 468 void OnOwnership(OnOwnershipCallback on_ownership_callback, |
464 const std::string& service_name, | 469 const std::string& service_name, |
465 bool success); | 470 bool success); |
466 | 471 |
467 // Processes the all incoming data to the connection, if any. | |
468 // | |
469 // BLOCKING CALL. | |
470 void ProcessAllIncomingDataIfAny(); | |
471 | |
472 // Called when a watch object is added. Used to start monitoring the | 472 // Called when a watch object is added. Used to start monitoring the |
473 // file descriptor used for D-Bus communication. | 473 // file descriptor used for D-Bus communication. |
474 dbus_bool_t OnAddWatch(DBusWatch* raw_watch); | 474 dbus_bool_t OnAddWatch(DBusWatch* raw_watch); |
475 | 475 |
476 // Called when a watch object is removed. | 476 // Called when a watch object is removed. |
477 void OnRemoveWatch(DBusWatch* raw_watch); | 477 void OnRemoveWatch(DBusWatch* raw_watch); |
478 | 478 |
479 // Called when the "enabled" status of |raw_watch| is toggled. | 479 // Called when the "enabled" status of |raw_watch| is toggled. |
480 void OnToggleWatch(DBusWatch* raw_watch); | 480 void OnToggleWatch(DBusWatch* raw_watch); |
481 | 481 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
546 int num_pending_timeouts_; | 546 int num_pending_timeouts_; |
547 | 547 |
548 std::string address_; | 548 std::string address_; |
549 | 549 |
550 DISALLOW_COPY_AND_ASSIGN(Bus); | 550 DISALLOW_COPY_AND_ASSIGN(Bus); |
551 }; | 551 }; |
552 | 552 |
553 } // namespace dbus | 553 } // namespace dbus |
554 | 554 |
555 #endif // DBUS_BUS_H_ | 555 #endif // DBUS_BUS_H_ |
OLD | NEW |