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

Side by Side Diff: src/object.cpp

Issue 6250197: Allow explicit object registration. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/dbus-cplusplus.git@master
Patch Set: Created 9 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
« include/dbus-c++/object.h ('K') | « include/dbus-c++/object.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * 2 *
3 * D-Bus++ - C++ bindings for D-Bus 3 * D-Bus++ - C++ bindings for D-Bus
4 * 4 *
5 * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> 5 * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
6 * 6 *
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 if (!dbus_connection_register_object_path(conn()._pvt->conn, path().c_st r(), &_vtable, this)) 166 if (!dbus_connection_register_object_path(conn()._pvt->conn, path().c_st r(), &_vtable, this))
167 { 167 {
168 throw ErrorNoMemory("unable to register object path"); 168 throw ErrorNoMemory("unable to register object path");
169 } 169 }
170 170
171 _adaptor_table[path()] = this; 171 _adaptor_table[path()] = this;
172 } 172 }
173 173
174 void ObjectAdaptor::unregister_obj() 174 void ObjectAdaptor::unregister_obj()
175 { 175 {
176 if (!is_registered())
177 return;
178
176 _adaptor_table.erase(path()); 179 _adaptor_table.erase(path());
177 180
178 debug_log("unregistering local object %s", path().c_str()); 181 debug_log("unregistering local object %s", path().c_str());
179 182
180 dbus_connection_unregister_object_path(conn()._pvt->conn, path().c_str() ); 183 dbus_connection_unregister_object_path(conn()._pvt->conn, path().c_str() );
181 } 184 }
182 185
186 bool ObjectAdaptor::is_registered()
187 {
188 return _adaptor_table.find(path()) != _adaptor_table.end();
189 }
190
183 void ObjectAdaptor::_emit_signal(SignalMessage &sig) 191 void ObjectAdaptor::_emit_signal(SignalMessage &sig)
184 { 192 {
185 sig.path(path().c_str()); 193 sig.path(path().c_str());
186 194
187 conn().send(sig); 195 conn().send(sig);
188 } 196 }
189 197
190 struct ReturnLaterError 198 struct ReturnLaterError
191 { 199 {
192 const Tag *tag; 200 const Tag *tag;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 InterfaceProxyTable::const_iterator ii = _interfaces.begin(); 322 InterfaceProxyTable::const_iterator ii = _interfaces.begin();
315 while (ii != _interfaces.end()) 323 while (ii != _interfaces.end())
316 { 324 {
317 std::string im = "type='signal',interface='"+ii->first+"',path=' "+path()+"'"; 325 std::string im = "type='signal',interface='"+ii->first+"',path=' "+path()+"'";
318 conn().remove_match(im.c_str()); 326 conn().remove_match(im.c_str());
319 ++ii; 327 ++ii;
320 } 328 }
321 conn().remove_filter(_filtered); 329 conn().remove_filter(_filtered);
322 } 330 }
323 331
332 bool ObjectProxy::is_registered()
333 {
334 return true;
335 }
336
324 Message ObjectProxy::_invoke_method(CallMessage &call) 337 Message ObjectProxy::_invoke_method(CallMessage &call)
325 { 338 {
326 if (call.path() == NULL) 339 if (call.path() == NULL)
327 call.path(path().c_str()); 340 call.path(path().c_str());
328 341
329 if (call.destination() == NULL) 342 if (call.destination() == NULL)
330 call.destination(service().c_str()); 343 call.destination(service().c_str());
331 344
332 return conn().send_blocking(call); 345 return conn().send_blocking(call);
333 } 346 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 { 381 {
369 return false; 382 return false;
370 } 383 }
371 } 384 }
372 default: 385 default:
373 { 386 {
374 return false; 387 return false;
375 } 388 }
376 } 389 }
377 } 390 }
OLDNEW
« include/dbus-c++/object.h ('K') | « include/dbus-c++/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698