[ekiga] Opal: Moved initialisation into the PProcess.
- From: Damien Sandras <dsandras src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga] Opal: Moved initialisation into the PProcess.
- Date: Thu, 22 Jan 2015 08:00:19 +0000 (UTC)
commit 3679acb9746d84166e8ee569c3d1f9dae555b68f
Author: Damien Sandras <dsandras seconix com>
Date: Tue Jan 20 21:03:52 2015 +0100
Opal: Moved initialisation into the PProcess.
That way, our OPAL code is self-contained. Memory management
should/could be easier to understand as everything is supposed to go
away when the PProcess is itself going away.
lib/engine/components/opal/opal-account.cpp | 8 +++---
lib/engine/components/opal/opal-account.h | 4 +-
lib/engine/components/opal/opal-bank.cpp | 4 +-
lib/engine/components/opal/opal-bank.h | 4 +-
lib/engine/components/opal/opal-call-manager.cpp | 1 -
lib/engine/components/opal/opal-main.cpp | 12 +---------
lib/engine/components/opal/opal-process.cpp | 26 ++++++++++++++++++++-
lib/engine/components/opal/opal-process.h | 13 ++++++++++-
8 files changed, 47 insertions(+), 25 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-account.cpp b/lib/engine/components/opal/opal-account.cpp
index 9eca306..35775bd 100644
--- a/lib/engine/components/opal/opal-account.cpp
+++ b/lib/engine/components/opal/opal-account.cpp
@@ -147,7 +147,7 @@ Opal::Account::Account (Opal::Bank & _bank,
boost::shared_ptr<Ekiga::NotificationCore> _notification_core,
boost::shared_ptr<Ekiga::PersonalDetails> _personal_details,
boost::shared_ptr<Ekiga::AudioOutputCore> _audiooutput_core,
- CallManager& _call_manager,
+ boost::shared_ptr<Opal::CallManager> _call_manager,
boost::function0<std::list<std::string> > _existing_groups,
xmlNodePtr _node):
existing_groups(_existing_groups),
@@ -234,8 +234,8 @@ Opal::Account::Account (Opal::Bank & _bank,
}
/* We will directly use the OPAL SIP and H.323 EndPoints */
- sip_endpoint = (Opal::Sip::EndPoint*) call_manager.FindEndPoint ("sip");
- h323_endpoint = (Opal::H323::EndPoint*) call_manager.FindEndPoint ("h323");
+ sip_endpoint = (Opal::Sip::EndPoint*) call_manager->FindEndPoint ("sip");
+ h323_endpoint = (Opal::H323::EndPoint*) call_manager->FindEndPoint ("h323");
}
@@ -915,7 +915,7 @@ Opal::Account::handle_registration_event (Ekiga::Account::RegistrationState stat
failed_registration_already_notified = false;
PURL url = PString (get_transaction_aor (get_aor ()));
- presentity = call_manager.AddPresentity (url);
+ presentity = call_manager->AddPresentity (url);
if (presentity) {
presentity->SetPresenceChangeNotifier (PCREATE_PresenceChangeNotifier (OnPresenceChange));
diff --git a/lib/engine/components/opal/opal-account.h b/lib/engine/components/opal/opal-account.h
index ecbb01c..a8584c6 100644
--- a/lib/engine/components/opal/opal-account.h
+++ b/lib/engine/components/opal/opal-account.h
@@ -92,7 +92,7 @@ public:
boost::shared_ptr<Ekiga::NotificationCore> _notification_core,
boost::shared_ptr<Ekiga::PersonalDetails> _personal_details,
boost::shared_ptr<Ekiga::AudioOutputCore> _audiooutput_core,
- CallManager& _call_manager,
+ boost::shared_ptr<Opal::CallManager> _call_manager,
boost::function0<std::list<std::string> > _existing_groups,
xmlNodePtr node_);
@@ -248,7 +248,7 @@ private:
boost::weak_ptr<Ekiga::PersonalDetails> personal_details;
boost::weak_ptr<Ekiga::AudioOutputCore> audiooutput_core;
- CallManager& call_manager;
+ boost::shared_ptr<Opal::CallManager> call_manager;
};
typedef boost::shared_ptr<Account> AccountPtr;
diff --git a/lib/engine/components/opal/opal-bank.cpp b/lib/engine/components/opal/opal-bank.cpp
index 6d9b53f..a1fc869 100644
--- a/lib/engine/components/opal/opal-bank.cpp
+++ b/lib/engine/components/opal/opal-bank.cpp
@@ -52,7 +52,7 @@
Opal::Bank::Bank (Ekiga::ServiceCore& core,
- Opal::CallManager& _call_manager):
+ boost::shared_ptr<Opal::CallManager> _call_manager):
call_manager(_call_manager),
presence_core(core.get<Ekiga::PresenceCore> ("presence-core")),
notification_core(core.get<Ekiga::NotificationCore> ("notification-core")),
@@ -120,7 +120,7 @@ Opal::Bank::Bank (Ekiga::ServiceCore& core,
//sip_endpoint.mwi_event.connect (boost::bind(&Opal::Bank::on_mwi_event, this, _1, _2));
// Enable accounts when the manager is ready
- call_manager.ready.connect (boost::bind (&Opal::Bank::set_ready, this));
+ call_manager->ready.connect (boost::bind (&Opal::Bank::set_ready, this));
}
diff --git a/lib/engine/components/opal/opal-bank.h b/lib/engine/components/opal/opal-bank.h
index e2a07f7..fef9902 100644
--- a/lib/engine/components/opal/opal-bank.h
+++ b/lib/engine/components/opal/opal-bank.h
@@ -62,7 +62,7 @@ namespace Opal
public:
Bank (Ekiga::ServiceCore& _core,
- Opal::CallManager& _call_manager);
+ boost::shared_ptr<Opal::CallManager> _call_manager);
~Bank ();
@@ -106,7 +106,7 @@ private:
void set_ready ();
bool is_ready;
- CallManager& call_manager;
+ boost::shared_ptr<Opal::CallManager> call_manager;
boost::weak_ptr<Ekiga::PresenceCore> presence_core;
boost::shared_ptr<Ekiga::NotificationCore> notification_core;
diff --git a/lib/engine/components/opal/opal-call-manager.cpp
b/lib/engine/components/opal/opal-call-manager.cpp
index 7b4115c..66e953b 100644
--- a/lib/engine/components/opal/opal-call-manager.cpp
+++ b/lib/engine/components/opal/opal-call-manager.cpp
@@ -226,7 +226,6 @@ CallManager::CallManager (Ekiga::ServiceCore& core)
CallManager::~CallManager ()
{
- std::cout << "CallManager exit " << std::endl << std::flush;
if (stun_thread)
stun_thread->WaitForTermination ();
ClearAllCalls (OpalConnection::EndedByLocalUser, true);
diff --git a/lib/engine/components/opal/opal-main.cpp b/lib/engine/components/opal/opal-main.cpp
index 4360fe3..d136d39 100644
--- a/lib/engine/components/opal/opal-main.cpp
+++ b/lib/engine/components/opal/opal-main.cpp
@@ -94,19 +94,9 @@ struct OPALSpark: public Ekiga::Spark
&& audiooutput_core && videooutput_core && personal_details
&& !account_store) {
+ GnomeMeeting::Process ()->Start (core);
hook_ekiga_plugins_to_opal (core);
- boost::shared_ptr<CallManager> call_manager (new CallManager (core));
-
- boost::shared_ptr<Bank> bank (new Bank (core, *call_manager.get ()));
- account_core->add_bank (bank);
- presence_core->add_cluster (bank);
- core.add (bank);
- call_manager->setup ();
- presence_core->add_presence_publisher (bank);
-
- call_core->add_manager (call_manager);
-
result = true;
}
diff --git a/lib/engine/components/opal/opal-process.cpp b/lib/engine/components/opal/opal-process.cpp
index dfc0e1b..43f74a8 100644
--- a/lib/engine/components/opal/opal-process.cpp
+++ b/lib/engine/components/opal/opal-process.cpp
@@ -43,8 +43,9 @@
#include "runtime.h"
-#define new PNEW
-
+#include "call-core.h"
+#include "account-core.h"
+#include "presence-core.h"
GnomeMeeting *GnomeMeeting::GM = 0;
@@ -56,6 +57,9 @@ GnomeMeeting::GnomeMeeting ()
GM = this;
}
+GnomeMeeting::~GnomeMeeting ()
+{
+}
GnomeMeeting *
GnomeMeeting::Process ()
@@ -67,3 +71,21 @@ GnomeMeeting::Process ()
void GnomeMeeting::Main ()
{
}
+
+
+void GnomeMeeting::Start (Ekiga::ServiceCore& core)
+{
+ boost::shared_ptr<Ekiga::CallCore> call_core = core.get<Ekiga::CallCore> ("call-core");
+ boost::shared_ptr<Ekiga::PresenceCore> presence_core = core.get<Ekiga::PresenceCore> ("presence-core");
+ boost::shared_ptr<Ekiga::AccountCore> account_core = core.get<Ekiga::AccountCore> ("account-core");
+
+ call_manager = boost::shared_ptr<Opal::CallManager> (new Opal::CallManager (core));
+ bank = boost::shared_ptr<Opal::Bank> (new Opal::Bank (core, call_manager));
+ account_core->add_bank (bank);
+ presence_core->add_cluster (bank);
+ core.add (bank);
+ call_manager->setup ();
+ presence_core->add_presence_publisher (bank);
+
+ call_core->add_manager (call_manager);
+}
diff --git a/lib/engine/components/opal/opal-process.h b/lib/engine/components/opal/opal-process.h
index 231ed8f..cf7535d 100644
--- a/lib/engine/components/opal/opal-process.h
+++ b/lib/engine/components/opal/opal-process.h
@@ -43,6 +43,10 @@
#include <ptlib.h>
#include <ptlib/pprocess.h>
+#include "services.h"
+#include "opal-call-manager.h"
+#include "opal-bank.h"
+
/**
* COMMON NOTICE: The Application must be initialized with Init after its
* creation.
@@ -50,6 +54,9 @@
class GnomeMeeting : public PProcess
{
PCLASSINFO(GnomeMeeting, PProcess);
+ class CallManager;
+ class Bank;
+
public:
@@ -59,15 +66,19 @@ class GnomeMeeting : public PProcess
* PRE : /
*/
GnomeMeeting ();
+ ~GnomeMeeting ();
- /* Needed for PProcess */
void Main();
+ void Start (Ekiga::ServiceCore& core);
+
static GnomeMeeting *Process ();
private:
static GnomeMeeting *GM;
+ boost::shared_ptr<Opal::CallManager> call_manager;
+ boost::shared_ptr<Opal::Bank> bank;
};
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]