diff options
author | David Robillard <d@drobilla.net> | 2011-04-20 03:30:03 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-04-20 03:30:03 +0000 |
commit | 1119a2c71a5f6b4e23ac0a19784705002ca9cefd (patch) | |
tree | 14f1a7f2b270185defc9e99ddf03e108b6767c8b /src/engine/events/DisconnectAll.cpp | |
parent | 7042795c8138f03124539f0efc892fe45eb2979f (diff) | |
download | ingen-1119a2c71a5f6b4e23ac0a19784705002ca9cefd.tar.gz ingen-1119a2c71a5f6b4e23ac0a19784705002ca9cefd.tar.bz2 ingen-1119a2c71a5f6b4e23ac0a19784705002ca9cefd.zip |
Move disconnect_all to CommonInterface and implement in clients.
Factor out process thread implementation of Disconnect into Disconnect::Impl.
Implement DisconnectAll in terms of DisconnectImpl rather than abusing Disconnect.
Dramatically reduce notification communication overhead of DisconnectAll.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3179 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/events/DisconnectAll.cpp')
-rw-r--r-- | src/engine/events/DisconnectAll.cpp | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/engine/events/DisconnectAll.cpp b/src/engine/events/DisconnectAll.cpp index c49cd9d7..a79969d3 100644 --- a/src/engine/events/DisconnectAll.cpp +++ b/src/engine/events/DisconnectAll.cpp @@ -69,19 +69,21 @@ DisconnectAll::DisconnectAll(Engine& engine, PatchImpl* parent, GraphObjectImpl* DisconnectAll::~DisconnectAll() { - for (Raul::List<Disconnect*>::iterator i = _disconnect_events.begin(); i != _disconnect_events.end(); ++i) + for (Raul::List<Disconnect::Impl*>::iterator i = _disconnect_events.begin(); + i != _disconnect_events.end(); ++i) delete (*i); } void DisconnectAll::remove_connection(ConnectionImpl* c) { - const bool reconnect_input = !_deleting || (c->dst_port()->parent_node() != _node); - Disconnect* ev = new Disconnect(_engine, SharedPtr<Request>(), _time, - c->src_port(), c->dst_port(), reconnect_input); - ev->pre_process(); - _disconnect_events.push_back(new Raul::List<Disconnect*>::Node(ev)); - c->pending_disconnection(true); + + _disconnect_events.push_back( + new Raul::List<Disconnect::Impl*>::Node( + new Disconnect::Impl(_engine, + _parent, + dynamic_cast<OutputPort*>(c->src_port()), + dynamic_cast<InputPort*>(c->dst_port())))); } void @@ -151,9 +153,11 @@ DisconnectAll::execute(ProcessContext& context) QueuedEvent::execute(context); if (_error == NO_ERROR) { - for (Raul::List<Disconnect*>::iterator i = _disconnect_events.begin(); - i != _disconnect_events.end(); ++i) - (*i)->execute(context); + for (Raul::List<Disconnect::Impl*>::iterator i = _disconnect_events.begin(); + i != _disconnect_events.end(); ++i) { + (*i)->execute(context, + !_deleting || ((*i)->dst_port()->parent_node() != _node)); + } } _engine.maid()->push(_parent->compiled_patch()); @@ -166,9 +170,7 @@ DisconnectAll::post_process() if (_error == NO_ERROR) { if (_request) _request->respond_ok(); - for (Raul::List<Disconnect*>::iterator i = _disconnect_events.begin(); - i != _disconnect_events.end(); ++i) - (*i)->post_process(); + _engine.broadcaster()->disconnect_all(_parent_path, _path); } else { if (_request) { boost::format fmt("Unable to disconnect %1% (%2%)"); |