| 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_EXPORTED_OBJECT_H_ | 5 #ifndef DBUS_EXPORTED_OBJECT_H_ |
| 6 #define DBUS_EXPORTED_OBJECT_H_ | 6 #define DBUS_EXPORTED_OBJECT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <map> | 10 #include <map> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include <dbus/dbus.h> | 13 #include <dbus/dbus.h> |
| 14 | 14 |
| 15 #include "base/callback.h" | 15 #include "base/callback.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "base/synchronization/waitable_event.h" | 17 #include "base/synchronization/waitable_event.h" |
| 18 #include "base/threading/platform_thread.h" | 18 #include "base/threading/platform_thread.h" |
| 19 #include "base/time.h" |
| 19 | 20 |
| 20 class MessageLoop; | 21 class MessageLoop; |
| 21 | 22 |
| 22 namespace dbus { | 23 namespace dbus { |
| 23 | 24 |
| 24 class Bus; | 25 class Bus; |
| 25 class MethodCall; | 26 class MethodCall; |
| 26 class Response; | 27 class Response; |
| 27 class Signal; | 28 class Signal; |
| 28 | 29 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 MethodCallCallback method_call_callback, | 100 MethodCallCallback method_call_callback, |
| 100 OnExportedCallback exported_callback); | 101 OnExportedCallback exported_callback); |
| 101 | 102 |
| 102 // Called when the object is exported. | 103 // Called when the object is exported. |
| 103 void OnExported(OnExportedCallback on_exported_callback, | 104 void OnExported(OnExportedCallback on_exported_callback, |
| 104 const std::string& interface_name, | 105 const std::string& interface_name, |
| 105 const std::string& method_name, | 106 const std::string& method_name, |
| 106 bool success); | 107 bool success); |
| 107 | 108 |
| 108 // Helper function for SendSignal(). | 109 // Helper function for SendSignal(). |
| 109 void SendSignalInternal(void* signal_message); | 110 void SendSignalInternal(base::TimeTicks start_time, |
| 111 void* signal_message); |
| 110 | 112 |
| 111 // Registers this object to the bus. | 113 // Registers this object to the bus. |
| 112 // Returns true on success, or the object is already registered. | 114 // Returns true on success, or the object is already registered. |
| 113 // | 115 // |
| 114 // BLOCKING CALL. | 116 // BLOCKING CALL. |
| 115 bool Register(); | 117 bool Register(); |
| 116 | 118 |
| 117 // Handles the incoming request messages and dispatches to the exported | 119 // Handles the incoming request messages and dispatches to the exported |
| 118 // methods. | 120 // methods. |
| 119 DBusHandlerResult HandleMessage(DBusConnection* connection, | 121 DBusHandlerResult HandleMessage(DBusConnection* connection, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 144 | 146 |
| 145 // The method table where keys are absolute method names (i.e. interface | 147 // The method table where keys are absolute method names (i.e. interface |
| 146 // name + method name), and values are the corresponding callbacks. | 148 // name + method name), and values are the corresponding callbacks. |
| 147 typedef std::map<std::string, MethodCallCallback> MethodTable; | 149 typedef std::map<std::string, MethodCallCallback> MethodTable; |
| 148 MethodTable method_table_; | 150 MethodTable method_table_; |
| 149 }; | 151 }; |
| 150 | 152 |
| 151 } // namespace dbus | 153 } // namespace dbus |
| 152 | 154 |
| 153 #endif // DBUS_EXPORTED_OBJECT_H_ | 155 #endif // DBUS_EXPORTED_OBJECT_H_ |
| OLD | NEW |