Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(729)

Side by Side Diff: dbus/bus.h

Issue 12224139: Supporting callback for Disconnected signal. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressing comments Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | dbus/bus.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 194
195 // Creates a Bus object. The actual connection will be established when 195 // Creates a Bus object. The actual connection will be established when
196 // Connect() is called. 196 // Connect() is called.
197 explicit Bus(const Options& options); 197 explicit Bus(const Options& options);
198 198
199 // Called when an ownership request is complete. 199 // Called when an ownership request is complete.
200 // Parameters: 200 // Parameters:
201 // - the requested service name. 201 // - the requested service name.
202 // - whether ownership has been obtained or not. 202 // - whether ownership has been obtained or not.
203 typedef base::Callback<void (const std::string&, bool)> OnOwnershipCallback; 203 typedef base::Callback<void (const std::string&, bool)> OnOwnershipCallback;
204
205 // Registers a callback function which is called when the connection with
206 // dbus-daemon is closed. This is also called when the connection is closed
207 // by ShutdownAndBlock. |closure| can be null callback.
208 void SetDisconnectedCallback(const base::Closure& closure);
satorux1 2013/02/14 02:30:41 What about adding the closure parameter to CloseCo
Seigo Nonaka 2013/02/14 03:33:52 I think your suggestion doesn't help my original m
209
204 // TODO(satorux): Remove the service name parameter as the caller of 210 // TODO(satorux): Remove the service name parameter as the caller of
205 // RequestOwnership() knows the service name. 211 // RequestOwnership() knows the service name.
206 212
207 // Gets the object proxy for the given service name and the object path. 213 // Gets the object proxy for the given service name and the object path.
208 // The caller must not delete the returned object. 214 // The caller must not delete the returned object.
209 // 215 //
210 // Returns an existing object proxy if the bus object already owns the 216 // Returns an existing object proxy if the bus object already owns the
211 // object proxy for the given service name and the object path. 217 // object proxy for the given service name and the object path.
212 // Never returns NULL. 218 // Never returns NULL.
213 // 219 //
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 // The public functions below are not intended to be used in client 328 // The public functions below are not intended to be used in client
323 // code. These are used to implement ObjectProxy and ExportedObject. 329 // code. These are used to implement ObjectProxy and ExportedObject.
324 // 330 //
325 331
326 // Connects the bus to the dbus-daemon. 332 // Connects the bus to the dbus-daemon.
327 // Returns true on success, or the bus is already connected. 333 // Returns true on success, or the bus is already connected.
328 // 334 //
329 // BLOCKING CALL. 335 // BLOCKING CALL.
330 virtual bool Connect(); 336 virtual bool Connect();
331 337
338 // Disconnects the bus from the dbus-daemon.
339 // No operation if the bus type is not a private bus or the bus is already
340 // disconnected.
341 //
342 // BLOCKING CALL.
343 virtual void CloseConnection();
344
332 // Requests the ownership of the service name given by |service_name|. 345 // Requests the ownership of the service name given by |service_name|.
333 // See also RequestOwnershipAndBlock(). 346 // See also RequestOwnershipAndBlock().
334 // 347 //
335 // |on_ownership_callback| is called when the service name is obtained 348 // |on_ownership_callback| is called when the service name is obtained
336 // or failed to be obtained, in the origin thread. 349 // or failed to be obtained, in the origin thread.
337 // 350 //
338 // Must be called in the origin thread. 351 // Must be called in the origin thread.
339 virtual void RequestOwnership(const std::string& service_name, 352 virtual void RequestOwnership(const std::string& service_name,
340 OnOwnershipCallback on_ownership_callback); 353 OnOwnershipCallback on_ownership_callback);
341 354
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 607
595 bool async_operations_set_up_; 608 bool async_operations_set_up_;
596 bool shutdown_completed_; 609 bool shutdown_completed_;
597 610
598 // Counters to make sure that OnAddWatch()/OnRemoveWatch() and 611 // Counters to make sure that OnAddWatch()/OnRemoveWatch() and
599 // OnAddTimeout()/OnRemoveTimeou() are balanced. 612 // OnAddTimeout()/OnRemoveTimeou() are balanced.
600 int num_pending_watches_; 613 int num_pending_watches_;
601 int num_pending_timeouts_; 614 int num_pending_timeouts_;
602 615
603 std::string address_; 616 std::string address_;
617 base::Closure on_disconnected_closure_;
604 618
605 DISALLOW_COPY_AND_ASSIGN(Bus); 619 DISALLOW_COPY_AND_ASSIGN(Bus);
606 }; 620 };
607 621
608 } // namespace dbus 622 } // namespace dbus
609 623
610 #endif // DBUS_BUS_H_ 624 #endif // DBUS_BUS_H_
OLDNEW
« no previous file with comments | « no previous file | dbus/bus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698