summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2015-12-23 15:00:34 +0100
committerJose <jose@zeroc.com>2015-12-23 15:00:34 +0100
commit3c63f0acf41df01688fea2fb5fb5cec4d5eb4710 (patch)
treec2a0a25ac956b4ce9a4edc8d37df1c24476e40fd /cpp/src
parentC++11 metrics fixes (diff)
downloadice-3c63f0acf41df01688fea2fb5fb5cec4d5eb4710.tar.bz2
ice-3c63f0acf41df01688fea2fb5fb5cec4d5eb4710.tar.xz
ice-3c63f0acf41df01688fea2fb5fb5cec4d5eb4710.zip
Fixes related to EnableSharedFromThis
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Glacier2Lib/SessionHelper.cpp25
-rw-r--r--cpp/src/Ice/ACM.h4
-rw-r--r--cpp/src/Ice/CollocatedRequestHandler.h2
-rw-r--r--cpp/src/Ice/CommunicatorI.h2
-rw-r--r--cpp/src/Ice/ConnectRequestHandler.h2
-rw-r--r--cpp/src/Ice/ConnectionFactory.h4
-rw-r--r--cpp/src/Ice/ConnectionI.h2
-rw-r--r--cpp/src/Ice/ConnectionRequestHandler.h2
-rw-r--r--cpp/src/Ice/EventHandler.h7
-rw-r--r--cpp/src/Ice/IPEndpointI.h2
-rw-r--r--cpp/src/Ice/LoggerAdminI.cpp2
-rw-r--r--cpp/src/Ice/ObjectAdapterFactory.h3
-rw-r--r--cpp/src/Ice/ObjectAdapterI.h2
-rw-r--r--cpp/src/Ice/OpaqueEndpointI.h2
-rw-r--r--cpp/src/Ice/RetryQueue.h2
-rw-r--r--cpp/src/Ice/WSEndpoint.h2
-rw-r--r--cpp/src/IceDiscovery/LookupI.cpp12
-rw-r--r--cpp/src/IceDiscovery/LookupI.h15
-rw-r--r--cpp/src/IceSSL/Certificate.cpp19
19 files changed, 46 insertions, 65 deletions
diff --git a/cpp/src/Glacier2Lib/SessionHelper.cpp b/cpp/src/Glacier2Lib/SessionHelper.cpp
index 7563520329b..541267fb51f 100644
--- a/cpp/src/Glacier2Lib/SessionHelper.cpp
+++ b/cpp/src/Glacier2Lib/SessionHelper.cpp
@@ -20,7 +20,7 @@ using namespace std;
namespace Glacier2
{
-class SessionThreadCallback : public ICE_ENABLE_SHARED_FROM_THIS(SessionThreadCallback)
+class SessionThreadCallback : public Ice::EnableSharedFromThis<SessionThreadCallback>
{
public:
@@ -82,10 +82,7 @@ private:
const Glacier2::SessionCallbackPtr _callback;
};
-class SessionHelperI : public Glacier2::SessionHelper
-#ifdef ICE_CPP11_MAPPING
- , public enable_shared_from_this<SessionHelperI>
-#endif
+class SessionHelperI : public Glacier2::SessionHelper, public Ice::EnableSharedFromThis<SessionHelperI>
{
public:
@@ -227,13 +224,13 @@ SessionHelperI::destroy()
// We destroy the communicator to trigger the immediate
// failure of the connection establishment.
//
- IceUtil::ThreadPtr destroyCommunicator = new DestroyCommunicator(ICE_SHARED_FROM_THIS);
+ IceUtil::ThreadPtr destroyCommunicator = new DestroyCommunicator(shared_from_this());
_threadCB = ICE_NULLPTR;
destroyCommunicator->start();
return;
}
- IceUtil::ThreadPtr destroyInternal = new DestroyInternal(ICE_SHARED_FROM_THIS, _threadCB, _callback);
+ IceUtil::ThreadPtr destroyInternal = new DestroyInternal(shared_from_this(), _threadCB, _callback);
_session = ICE_NULLPTR;
_connected = false;
@@ -666,13 +663,13 @@ SessionHelperI::connectImpl(const ConnectStrategyPtr& factory)
catch(const Ice::LocalException& ex)
{
_destroy = true;
- IceUtil::ThreadPtr thread = new DispatchCallThread(ICE_SHARED_FROM_THIS, new ConnectFailed(_callback, ICE_SHARED_FROM_THIS, ex), 0);
+ IceUtil::ThreadPtr thread = new DispatchCallThread(shared_from_this(), new ConnectFailed(_callback, shared_from_this(), ex), 0);
_threadCB->add(this, thread);
thread->start();
return;
}
- IceUtil::ThreadPtr thread = new ConnectThread(_callback, ICE_SHARED_FROM_THIS, factory, _communicator, _finder);
+ IceUtil::ThreadPtr thread = new ConnectThread(_callback, shared_from_this(), factory, _communicator, _finder);
_threadCB->add(this, thread);
thread->start();
}
@@ -795,7 +792,7 @@ SessionHelperI::connected(const Glacier2::RouterPrxPtr& router, const Glacier2::
Ice::ConnectionPtr connection = _router->ice_getCachedConnection();
assert(connection);
connection->setACM(acmTimeout, IceUtil::None, Ice::HeartbeatAlways);
- connection->setCallback(ICE_MAKE_SHARED(ConnectionCallbackI, ICE_SHARED_FROM_THIS));
+ connection->setCallback(ICE_MAKE_SHARED(ConnectionCallbackI, shared_from_this()));
}
}
}
@@ -806,11 +803,11 @@ SessionHelperI::connected(const Glacier2::RouterPrxPtr& router, const Glacier2::
// connected() is only called from the ConnectThread so it is ok to
// call destroyInternal here.
//
- destroyInternal(new Disconnected(ICE_SHARED_FROM_THIS, _callback));
+ destroyInternal(new Disconnected(shared_from_this(), _callback));
}
else
{
- dispatchCallback(new Connected(_callback, ICE_SHARED_FROM_THIS), conn);
+ dispatchCallback(new Connected(_callback, shared_from_this()), conn);
}
}
@@ -1119,7 +1116,7 @@ Glacier2::SessionFactoryHelper::connect()
{
IceUtil::Mutex::Lock sync(_mutex);
session = ICE_MAKE_SHARED(SessionHelperI,
- ICE_MAKE_SHARED(SessionThreadCallback, ICE_SHARED_FROM_THIS),
+ ICE_MAKE_SHARED(SessionThreadCallback, shared_from_this()),
_callback,
createInitData(),
getRouterFinderStr(),
@@ -1138,7 +1135,7 @@ Glacier2::SessionFactoryHelper::connect(const string& user, const string& passw
{
IceUtil::Mutex::Lock sync(_mutex);
session = ICE_MAKE_SHARED(SessionHelperI,
- ICE_MAKE_SHARED(SessionThreadCallback, ICE_SHARED_FROM_THIS),
+ ICE_MAKE_SHARED(SessionThreadCallback, shared_from_this()),
_callback,
createInitData(),
getRouterFinderStr(),
diff --git a/cpp/src/Ice/ACM.h b/cpp/src/Ice/ACM.h
index 9d8f151daac..0290a179ab8 100644
--- a/cpp/src/Ice/ACM.h
+++ b/cpp/src/Ice/ACM.h
@@ -51,7 +51,7 @@ public:
};
class FactoryACMMonitor : public ACMMonitor, public ::IceUtil::Mutex,
- public ICE_ENABLE_SHARED_FROM_THIS(FactoryACMMonitor)
+ public Ice::EnableSharedFromThis<FactoryACMMonitor>
{
public:
@@ -87,7 +87,7 @@ private:
};
class ConnectionACMMonitor : public ACMMonitor, public ::IceUtil::Mutex,
- public ICE_ENABLE_SHARED_FROM_THIS(ConnectionACMMonitor)
+ public Ice::EnableSharedFromThis<ConnectionACMMonitor>
{
public:
diff --git a/cpp/src/Ice/CollocatedRequestHandler.h b/cpp/src/Ice/CollocatedRequestHandler.h
index 87b5cb37966..c4baefb7b30 100644
--- a/cpp/src/Ice/CollocatedRequestHandler.h
+++ b/cpp/src/Ice/CollocatedRequestHandler.h
@@ -40,7 +40,7 @@ class OutgoingAsync;
class CollocatedRequestHandler : public RequestHandler,
public ResponseHandler,
private IceUtil::Monitor<IceUtil::Mutex>,
- public ICE_ENABLE_SHARED_FROM_THIS(CollocatedRequestHandler)
+ public Ice::EnableSharedFromThis<CollocatedRequestHandler>
{
public:
diff --git a/cpp/src/Ice/CommunicatorI.h b/cpp/src/Ice/CommunicatorI.h
index 173effb3beb..7db2f29d330 100644
--- a/cpp/src/Ice/CommunicatorI.h
+++ b/cpp/src/Ice/CommunicatorI.h
@@ -23,7 +23,7 @@ namespace Ice
class CommunicatorI;
ICE_DEFINE_PTR(CommunicatorIPtr, CommunicatorI);
-class CommunicatorI : public ICE_ENABLE_SHARED_FROM_THIS(CommunicatorI),
+class CommunicatorI : public EnableSharedFromThis<CommunicatorI>,
public Communicator
{
public:
diff --git a/cpp/src/Ice/ConnectRequestHandler.h b/cpp/src/Ice/ConnectRequestHandler.h
index e8d61faa379..1dd13dd5274 100644
--- a/cpp/src/Ice/ConnectRequestHandler.h
+++ b/cpp/src/Ice/ConnectRequestHandler.h
@@ -31,7 +31,7 @@ class ConnectRequestHandler : public RequestHandler,
public Reference::GetConnectionCallback,
public RouterInfo::AddProxyCallback,
public IceUtil::Monitor<IceUtil::Mutex>,
- public ICE_ENABLE_SHARED_FROM_THIS(ConnectRequestHandler)
+ public Ice::EnableSharedFromThis<ConnectRequestHandler>
{
public:
diff --git a/cpp/src/Ice/ConnectionFactory.h b/cpp/src/Ice/ConnectionFactory.h
index 2259a872d9d..ecf170aed68 100644
--- a/cpp/src/Ice/ConnectionFactory.h
+++ b/cpp/src/Ice/ConnectionFactory.h
@@ -89,7 +89,7 @@ private:
class ConnectCallback : public Ice::ConnectionI::StartCallback,
public IceInternal::EndpointI_connectors,
- public ICE_ENABLE_SHARED_FROM_THIS(IceInternal::OutgoingConnectionFactory::ConnectCallback)
+ public Ice::EnableSharedFromThis<IceInternal::OutgoingConnectionFactory::ConnectCallback>
{
public:
@@ -170,7 +170,7 @@ private:
class IncomingConnectionFactory : public EventHandler,
public Ice::ConnectionI::StartCallback,
public IceUtil::Monitor<IceUtil::Mutex>,
- public ICE_ENABLE_SHARED_FROM_THIS(IncomingConnectionFactory)
+ public Ice::EnableSharedFromThis<IncomingConnectionFactory>
{
public:
diff --git a/cpp/src/Ice/ConnectionI.h b/cpp/src/Ice/ConnectionI.h
index 75ec43765a7..e920b894a62 100644
--- a/cpp/src/Ice/ConnectionI.h
+++ b/cpp/src/Ice/ConnectionI.h
@@ -68,7 +68,7 @@ class ConnectionI : public Connection,
public IceInternal::ResponseHandler,
public IceInternal::CancellationHandler,
public IceUtil::Monitor<IceUtil::Mutex>,
- public ICE_ENABLE_SHARED_FROM_THIS(ConnectionI)
+ public EnableSharedFromThis<ConnectionI>
{
class Observer : public IceInternal::ObserverHelperT<Ice::Instrumentation::ConnectionObserver>
{
diff --git a/cpp/src/Ice/ConnectionRequestHandler.h b/cpp/src/Ice/ConnectionRequestHandler.h
index 3cfd5954d11..864facc6f91 100644
--- a/cpp/src/Ice/ConnectionRequestHandler.h
+++ b/cpp/src/Ice/ConnectionRequestHandler.h
@@ -19,7 +19,7 @@ namespace IceInternal
{
class ConnectionRequestHandler : public RequestHandler,
- public ICE_ENABLE_SHARED_FROM_THIS(ConnectionRequestHandler)
+ public Ice::EnableSharedFromThis<ConnectionRequestHandler>
{
public:
diff --git a/cpp/src/Ice/EventHandler.h b/cpp/src/Ice/EventHandler.h
index cb3f1f3299d..a11299d9326 100644
--- a/cpp/src/Ice/EventHandler.h
+++ b/cpp/src/Ice/EventHandler.h
@@ -21,7 +21,12 @@
namespace IceInternal
{
-class ICE_API EventHandler : virtual public ICE_LOCAL_OBJECT
+class ICE_API EventHandler :
+#ifdef ICE_CPP11_MAPPING
+ virtual public Ice::VirtualEnableSharedFromThisBase
+#else
+ virtual public Ice::LocalObject
+#endif
{
public:
diff --git a/cpp/src/Ice/IPEndpointI.h b/cpp/src/Ice/IPEndpointI.h
index d2f79a78051..8e5e033647f 100644
--- a/cpp/src/Ice/IPEndpointI.h
+++ b/cpp/src/Ice/IPEndpointI.h
@@ -43,7 +43,7 @@ private:
const EndpointIPtr _endpoint;
};
-class ICE_API IPEndpointI : public EndpointI, public ICE_ENABLE_SHARED_FROM_THIS(IPEndpointI)
+class ICE_API IPEndpointI : public EndpointI, public Ice::EnableSharedFromThis<IPEndpointI>
{
public:
diff --git a/cpp/src/Ice/LoggerAdminI.cpp b/cpp/src/Ice/LoggerAdminI.cpp
index 1ddee852655..de1e29429c9 100644
--- a/cpp/src/Ice/LoggerAdminI.cpp
+++ b/cpp/src/Ice/LoggerAdminI.cpp
@@ -138,7 +138,7 @@ public:
typedef IceUtil::Handle<Job> JobPtr;
-class LoggerAdminLoggerI : public ICE_ENABLE_SHARED_FROM_THIS(LoggerAdminLoggerI), public IceInternal::LoggerAdminLogger
+class LoggerAdminLoggerI : public Ice::EnableSharedFromThis<LoggerAdminLoggerI>, public IceInternal::LoggerAdminLogger
{
public:
diff --git a/cpp/src/Ice/ObjectAdapterFactory.h b/cpp/src/Ice/ObjectAdapterFactory.h
index d9e52a9a7bb..3277259f7f8 100644
--- a/cpp/src/Ice/ObjectAdapterFactory.h
+++ b/cpp/src/Ice/ObjectAdapterFactory.h
@@ -19,7 +19,8 @@
namespace IceInternal
{
-class ObjectAdapterFactory : public ICE_ENABLE_SHARED_FROM_THIS(ObjectAdapterFactory), public ::IceUtil::Monitor< ::IceUtil::RecMutex>
+class ObjectAdapterFactory : public Ice::EnableSharedFromThis<ObjectAdapterFactory>,
+ public ::IceUtil::Monitor< ::IceUtil::RecMutex>
{
public:
diff --git a/cpp/src/Ice/ObjectAdapterI.h b/cpp/src/Ice/ObjectAdapterI.h
index 5addbdfe846..3678276d147 100644
--- a/cpp/src/Ice/ObjectAdapterI.h
+++ b/cpp/src/Ice/ObjectAdapterI.h
@@ -38,7 +38,7 @@ namespace Ice
class ObjectAdapterI;
ICE_DEFINE_PTR(ObjectAdapterIPtr, ObjectAdapterI);
-class ObjectAdapterI : public ICE_ENABLE_SHARED_FROM_THIS(ObjectAdapterI),
+class ObjectAdapterI : public EnableSharedFromThis<ObjectAdapterI>,
public ObjectAdapter,
public IceUtil::Monitor<IceUtil::RecMutex>
{
diff --git a/cpp/src/Ice/OpaqueEndpointI.h b/cpp/src/Ice/OpaqueEndpointI.h
index 516e4dcfcf3..caa67476a8e 100644
--- a/cpp/src/Ice/OpaqueEndpointI.h
+++ b/cpp/src/Ice/OpaqueEndpointI.h
@@ -16,7 +16,7 @@
namespace IceInternal
{
-class OpaqueEndpointI : public EndpointI, public ICE_ENABLE_SHARED_FROM_THIS(OpaqueEndpointI)
+class OpaqueEndpointI : public EndpointI, public Ice::EnableSharedFromThis<OpaqueEndpointI>
{
public:
diff --git a/cpp/src/Ice/RetryQueue.h b/cpp/src/Ice/RetryQueue.h
index a7355c4f1b1..295bd1ce700 100644
--- a/cpp/src/Ice/RetryQueue.h
+++ b/cpp/src/Ice/RetryQueue.h
@@ -24,7 +24,7 @@ namespace IceInternal
class RetryTask : public IceUtil::TimerTask,
public CancellationHandler,
- public ICE_ENABLE_SHARED_FROM_THIS(RetryTask)
+ public Ice::EnableSharedFromThis<RetryTask>
{
public:
diff --git a/cpp/src/Ice/WSEndpoint.h b/cpp/src/Ice/WSEndpoint.h
index debb77644c7..6c11da77775 100644
--- a/cpp/src/Ice/WSEndpoint.h
+++ b/cpp/src/Ice/WSEndpoint.h
@@ -31,7 +31,7 @@ public:
virtual Ice::EndpointInfoPtr getWSInfo(const std::string&) const = 0;
};
-class WSEndpoint : public EndpointI, public ICE_ENABLE_SHARED_FROM_THIS(WSEndpoint)
+class WSEndpoint : public EndpointI, public Ice::EnableSharedFromThis<WSEndpoint>
{
public:
diff --git a/cpp/src/IceDiscovery/LookupI.cpp b/cpp/src/IceDiscovery/LookupI.cpp
index d7e9ef7b1fa..57e433b22b0 100644
--- a/cpp/src/IceDiscovery/LookupI.cpp
+++ b/cpp/src/IceDiscovery/LookupI.cpp
@@ -116,11 +116,7 @@ AdapterRequest::finished(const Ice::ObjectPrxPtr& proxy)
void
AdapterRequest::runTimerTask()
{
-#ifdef ICE_CPP11_MAPPING
- _lookup->adapterRequestTimedOut(dynamic_pointer_cast<AdapterRequest>(shared_from_this()));
-#else
- _lookup->adapterRequestTimedOut(this);
-#endif
+ _lookup->adapterRequestTimedOut(shared_from_this());
}
void
@@ -132,11 +128,7 @@ ObjectRequest::response(const Ice::ObjectPrxPtr& proxy)
void
ObjectRequest::runTimerTask()
{
-#ifdef ICE_CPP11_MAPPING
- _lookup->objectRequestTimedOut(dynamic_pointer_cast<ObjectRequest>(shared_from_this()));
-#else
- _lookup->objectRequestTimedOut(this);
-#endif
+ _lookup->objectRequestTimedOut(shared_from_this());
}
LookupI::LookupI(const LocatorRegistryIPtr& registry, const LookupPrxPtr& lookup, const Ice::PropertiesPtr& properties) :
diff --git a/cpp/src/IceDiscovery/LookupI.h b/cpp/src/IceDiscovery/LookupI.h
index 7e603ef8688..49350c52106 100644
--- a/cpp/src/IceDiscovery/LookupI.h
+++ b/cpp/src/IceDiscovery/LookupI.h
@@ -24,9 +24,7 @@ class LookupI;
#ifdef ICE_CPP11_MAPPING
-template<class T> class Request :
- public IceUtil::TimerTask,
- public std::enable_shared_from_this<Request<T>>
+template<class T> class Request : public IceUtil::TimerTask
{
public:
@@ -70,7 +68,7 @@ protected:
std::vector<std::function<void (const std::shared_ptr<::Ice::ObjectPrx>&)>> _callbacks;
};
-class ObjectRequest : public Request<Ice::Identity>
+class ObjectRequest : public Request<Ice::Identity>, public Ice::EnableSharedFromThis<ObjectRequest>
{
public:
@@ -87,7 +85,7 @@ private:
};
typedef std::shared_ptr<ObjectRequest> ObjectRequestPtr;
-class AdapterRequest : public Request<std::string>
+class AdapterRequest : public Request<std::string>, public Ice::EnableSharedFromThis<AdapterRequest>
{
public:
@@ -161,7 +159,8 @@ protected:
std::vector<CB> _callbacks;
};
-class ObjectRequest : public RequestT<Ice::Identity, Ice::AMD_Locator_findObjectByIdPtr>
+class ObjectRequest : public RequestT<Ice::Identity, Ice::AMD_Locator_findObjectByIdPtr>,
+ public Ice::EnableSharedFromThis<ObjectRequest>
{
public:
@@ -178,7 +177,7 @@ private:
};
typedef IceUtil::Handle<ObjectRequest> ObjectRequestPtr;
-class AdapterRequest : public RequestT<std::string, Ice::AMD_Locator_findAdapterByIdPtr>
+class AdapterRequest : public RequestT<std::string, Ice::AMD_Locator_findAdapterByIdPtr>, public Ice::EnableSharedFromThis<AdapterRequest>
{
public:
@@ -205,7 +204,7 @@ typedef IceUtil::Handle<AdapterRequest> AdapterRequestPtr;
class LookupI : public Lookup,
private IceUtil::Mutex,
- public ICE_ENABLE_SHARED_FROM_THIS(LookupI)
+ public Ice::EnableSharedFromThis<LookupI>
{
public:
diff --git a/cpp/src/IceSSL/Certificate.cpp b/cpp/src/IceSSL/Certificate.cpp
index 795e1df4f3f..ee814eb420f 100644
--- a/cpp/src/IceSSL/Certificate.cpp
+++ b/cpp/src/IceSSL/Certificate.cpp
@@ -977,24 +977,11 @@ Certificate::getPublicKey() const
{
throw CertificateEncodingException(__FILE__, __LINE__, errorToString(err));
}
-# ifdef ICE_CPP11_MAPPING
- return make_shared<PublicKey>(const_pointer_cast<Certificate>(shared_from_this()), key);
-# else
- return new PublicKey(const_cast<Certificate*>(this), key);
-# endif
+ return ICE_MAKE_SHARED(PublicKey, shared_from_this(), key);
#elif defined(ICE_USE_SCHANNEL)
-# ifdef ICE_CPP11_MAPPING
- return make_shared<PublicKey>(const_pointer_cast<Certificate>(shared_from_this()),
- &_certInfo->SubjectPublicKeyInfo);
-# else
- return new PublicKey(const_cast<Certificate*>(this), &_certInfo->SubjectPublicKeyInfo);
-# endif
+ return ICE_MAKE_SHARED(PublicKey, shared_from_this(), &_certInfo->SubjectPublicKeyInfo);
#else
-# ifdef ICE_CPP11_MAPPING
- return make_shared<PublicKey>(const_pointer_cast<Certificate>(shared_from_this()), X509_get_pubkey(_cert));
-# else
- return new PublicKey(const_cast<Certificate*>(this), X509_get_pubkey(_cert));
-# endif
+ return ICE_MAKE_SHARED(PublicKey, shared_from_this(), X509_get_pubkey(_cert));
#endif
}