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 CHROMEOS_DBUS_SHILL_CLIENT_HELPER_H_ | 5 #ifndef CHROMEOS_DBUS_SHILL_CLIENT_HELPER_H_ |
6 #define CHROMEOS_DBUS_SHILL_CLIENT_HELPER_H_ | 6 #define CHROMEOS_DBUS_SHILL_CLIENT_HELPER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 typedef base::Callback<void(const base::ListValue& result)> ListValueCallback; | 59 typedef base::Callback<void(const base::ListValue& result)> ListValueCallback; |
60 | 60 |
61 // A callback to handle errors for method call. | 61 // A callback to handle errors for method call. |
62 typedef base::Callback<void(const std::string& error_name, | 62 typedef base::Callback<void(const std::string& error_name, |
63 const std::string& error_message)> ErrorCallback; | 63 const std::string& error_message)> ErrorCallback; |
64 | 64 |
65 ShillClientHelper(dbus::Bus* bus, dbus::ObjectProxy* proxy); | 65 ShillClientHelper(dbus::Bus* bus, dbus::ObjectProxy* proxy); |
66 | 66 |
67 virtual ~ShillClientHelper(); | 67 virtual ~ShillClientHelper(); |
68 | 68 |
69 // Returns whether there is an observed registered for the PropertyChange or | |
70 // not. | |
stevenjb
2013/02/06 01:05:53
nit: // Returns true if there is a PropertyChanged
deymo
2013/02/06 05:44:45
Done.
| |
71 bool IsObserved() const; | |
72 | |
73 // Returns true if the are method calls waiting for a response. In addition, | |
74 // if this function is called from within the return callback and there are | |
75 // not *other* calls waiting for a response, this function returns false. | |
stevenjb
2013/02/06 01:05:53
// Returns true if there are method calls waiting
deymo
2013/02/06 05:44:45
Done.
| |
76 bool IsWaitingResponse() const; | |
77 | |
69 // Adds an |observer| of the PropertyChanged signal. | 78 // Adds an |observer| of the PropertyChanged signal. |
70 void AddPropertyChangedObserver(ShillPropertyChangedObserver* observer); | 79 void AddPropertyChangedObserver(ShillPropertyChangedObserver* observer); |
71 | 80 |
72 // Removes an |observer| of the PropertyChanged signal. | 81 // Removes an |observer| of the PropertyChanged signal. |
73 void RemovePropertyChangedObserver(ShillPropertyChangedObserver* observer); | 82 void RemovePropertyChangedObserver(ShillPropertyChangedObserver* observer); |
74 | 83 |
75 // Starts monitoring PropertyChanged signal. | 84 // Starts monitoring PropertyChanged signal. |
76 void MonitorPropertyChanged(const std::string& interface_name); | 85 void MonitorPropertyChanged(const std::string& interface_name); |
77 | 86 |
78 // Calls a method without results. | 87 // Calls a method without results. |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
173 // Handles errors for method calls. | 182 // Handles errors for method calls. |
174 void OnError(const ErrorCallback& error_callback, | 183 void OnError(const ErrorCallback& error_callback, |
175 dbus::ErrorResponse* response); | 184 dbus::ErrorResponse* response); |
176 | 185 |
177 // TODO(hashimoto): Remove this when we no longer need to make blocking calls. | 186 // TODO(hashimoto): Remove this when we no longer need to make blocking calls. |
178 BlockingMethodCaller blocking_method_caller_; | 187 BlockingMethodCaller blocking_method_caller_; |
179 dbus::ObjectProxy* proxy_; | 188 dbus::ObjectProxy* proxy_; |
180 PropertyChangedHandler property_changed_handler_; | 189 PropertyChangedHandler property_changed_handler_; |
181 ObserverList<ShillPropertyChangedObserver, true /* check_empty */> | 190 ObserverList<ShillPropertyChangedObserver, true /* check_empty */> |
182 observer_list_; | 191 observer_list_; |
192 int ongoing_calls; | |
stevenjb
2013/02/06 01:05:53
Missing trailing _
Also, maybe use pending_calls_
deymo
2013/02/06 05:44:45
More than "pending_calls" is pending "returns". Th
stevenjb
2013/02/06 17:10:20
nit: Hm, 'unreturned' works, but sounds a bit awkw
| |
183 | 193 |
184 // Note: This should remain the last member so it'll be destroyed and | 194 // Note: This should remain the last member so it'll be destroyed and |
185 // invalidate its weak pointers before any other members are destroyed. | 195 // invalidate its weak pointers before any other members are destroyed. |
186 base::WeakPtrFactory<ShillClientHelper> weak_ptr_factory_; | 196 base::WeakPtrFactory<ShillClientHelper> weak_ptr_factory_; |
187 | 197 |
188 DISALLOW_COPY_AND_ASSIGN(ShillClientHelper); | 198 DISALLOW_COPY_AND_ASSIGN(ShillClientHelper); |
189 }; | 199 }; |
190 | 200 |
191 } // namespace chromeos | 201 } // namespace chromeos |
192 | 202 |
193 #endif // CHROMEOS_DBUS_SHILL_CLIENT_HELPER_H_ | 203 #endif // CHROMEOS_DBUS_SHILL_CLIENT_HELPER_H_ |
OLD | NEW |