//------------------------------------------------------------------------- ORTCPtr ORTC::create() { ORTCPtr pThis(make_shared<ORTC>(make_private{})); pThis->mThisWeak = pThis; pThis->init(); return pThis; }
//------------------------------------------------------------------------- RTPReceiverChannelAudio::TransportPtr RTPReceiverChannelAudio::Transport::create(RTPReceiverChannelAudioPtr outer) { TransportPtr pThis(make_shared<Transport>(make_private{}, outer)); pThis->mThisWeak = pThis; pThis->init(); return pThis; }
//------------------------------------------------------------------------- MediaDevicesPtr MediaDevices::create() { MediaDevicesPtr pThis(make_shared<MediaDevices>(make_private {}, IORTCForInternal::queueORTC())); pThis->mThisWeak = pThis; pThis->init(); return pThis; }
xbox_live_result<std::shared_ptr<statistic_change_subscription>> user_statistics_service_impl::subscribe_to_statistic_change( _In_ const string_t& xboxUserId, _In_ const string_t& serviceConfigurationId, _In_ const string_t& statisticName ) { std::weak_ptr<user_statistics_service_impl> thisWeakPtr = shared_from_this(); std::shared_ptr<statistic_change_subscription> statChangeSub = std::make_shared<statistic_change_subscription>( xboxUserId, serviceConfigurationId, statistic( statisticName, string_t(), string_t() ), ([thisWeakPtr](const statistic_change_event_args& eventArgs) { std::shared_ptr<user_statistics_service_impl> pThis(thisWeakPtr.lock()); if (pThis != nullptr) { pThis->statistic_changed(eventArgs); } }), ([thisWeakPtr](const xbox::services::real_time_activity::real_time_activity_subscription_error_event_args& eventArgs) { std::shared_ptr<user_statistics_service_impl> pThis(thisWeakPtr.lock()); if (pThis != nullptr) { pThis->m_realTimeActivityService->_Trigger_subscription_error(eventArgs); } }) ); auto subscriptionSucceeded = m_realTimeActivityService->_Add_subscription( statChangeSub ); if (!subscriptionSucceeded.err()) { return xbox_live_result<std::shared_ptr<statistic_change_subscription>>(statChangeSub); } return xbox_live_result<std::shared_ptr<statistic_change_subscription>>(subscriptionSucceeded.err(), subscriptionSucceeded.err_message()); }
//------------------------------------------------------------------------- ElementPtr MediaDevices::singletonToDebug() { MediaDevicesPtr pThis(MediaDevices::singleton()); if (!pThis) return ElementPtr(); AutoRecursiveLock lock(*pThis); return pThis->toDebug(); }
xbox_live_result<std::shared_ptr<team_change_subscription>> tournament_service_impl::subscribe_to_team_change( _In_ const string_t& organizerId, _In_ const string_t& tournamentId, _In_ const string_t& teamId ) { std::weak_ptr<tournament_service_impl> thisWeakPtr = shared_from_this(); std::shared_ptr<team_change_subscription> statChangeSub = std::make_shared<team_change_subscription>( organizerId, tournamentId, teamId, ([thisWeakPtr](const team_change_event_args& eventArgs) { std::shared_ptr<tournament_service_impl> pThis(thisWeakPtr.lock()); if (pThis != nullptr) { pThis->team_changed(eventArgs); } }), ([thisWeakPtr](const xbox::services::real_time_activity::real_time_activity_subscription_error_event_args& eventArgs) { std::shared_ptr<tournament_service_impl> pThis(thisWeakPtr.lock()); if (pThis != nullptr) { pThis->m_realTimeActivityService->_Trigger_subscription_error(eventArgs); } }) ); auto subscriptionSucceeded = m_realTimeActivityService->_Add_subscription( statChangeSub ); if (!subscriptionSucceeded.err()) { return xbox_live_result<std::shared_ptr<team_change_subscription>>(statChangeSub); } return xbox_live_result<std::shared_ptr<team_change_subscription>>(subscriptionSucceeded.err(), subscriptionSucceeded.err_message()); }
//------------------------------------------------------------------------- RTPReceiverChannelAudioPtr RTPReceiverChannelAudio::create( RTPReceiverChannelPtr receiverChannel, MediaStreamTrackPtr track, const Parameters ¶ms ) { RTPReceiverChannelAudioPtr pThis(make_shared<RTPReceiverChannelAudio>(make_private {}, IORTCForInternal::queueORTC(), receiverChannel, track, params)); pThis->mThisWeak = pThis; pThis->init(); return pThis; }
LPRDORuntime RDORuntime::clone() const { LPRDORuntime pRuntime = rdo::Factory<RDORuntime>::create(m_pError); ASSERT(pRuntime); pRuntime->m_sizeofSim = sizeof(RDORuntime); LPRDORuntime pThis(const_cast<RDORuntime*>(this)); pRuntime->copyFrom(pThis); return pRuntime; }
bool SocketSender::run(Exception& ex) { if (!_pSocket) { ex.set(Exception::SOCKET, "SocketSender ", name, " started in parallel without pointer of socket"); return false; } // send Exception exc; shared_ptr<SocketSender> pThis(_pThis); _pSocket->send(exc, pThis); if (exc.code() != Exception::ASSERT) ex.set(exc); return true; }
//------------------------------------------------------------------------- GeneratorPtr Generator::createJSONGenerator( JSONWriteFlags writeFlags, const char *forcedText, char attributePrefix ) { GeneratorPtr pThis(make_shared<Generator>(make_private{}, writeFlags)); pThis->mThis = pThis; pThis->mGeneratorMode = GeneratorMode_JSON; pThis->mJSONForcedText = (forcedText ? forcedText : ""); pThis->mJSONAttributePrefix = attributePrefix; return pThis; }
// Static entry point required by _beginthreadex() unsigned __stdcall OverlappedCall::ThreadMain(void* pvClosure) { HARDASSERT(::GetCurrentThreadId() != Interpreter::MainThreadId()); // Take over the initial reference (while thread is running, // this keeps a reference on the OverlappedCall object which will then // be released when the smart pointer goes out of scope at the end of // this function, at which point the call will normally be deleted, // unless that is something else is holding a reference to it.) OverlappedCallPtr pThis(static_cast<OverlappedCall*>(pvClosure), false); // N.B. OC may not actually deleted as may still be ref'd from APC queue, etc return pThis->TryMain(); }
xbox_live_result<std::shared_ptr<social_relationship_change_subscription>> social_service_impl::subscribe_to_social_relationship_change( _In_ const string_t& xboxUserId ) { std::weak_ptr<social_service_impl> thisWeakPtr = shared_from_this(); auto socialRelationshipSub = std::make_shared<social_relationship_change_subscription>( xboxUserId, ([thisWeakPtr](social_relationship_change_event_args eventArgs) { std::shared_ptr<social_service_impl> pThis(thisWeakPtr); if (pThis) { pThis->social_relationship_changed(eventArgs); } }), ([thisWeakPtr](const xbox::services::real_time_activity::real_time_activity_subscription_error_event_args& eventArgs) { std::shared_ptr<social_service_impl> pThis(thisWeakPtr); if (pThis) { pThis->m_realTimeActivityService->_Trigger_subscription_error(eventArgs); } }) ); auto subscriptionSucceed = m_realTimeActivityService->_Add_subscription( socialRelationshipSub ); if (!subscriptionSucceed.err()) { return xbox_live_result<std::shared_ptr<social_relationship_change_subscription>>(socialRelationshipSub); } return xbox_live_result<std::shared_ptr<social_relationship_change_subscription>>(subscriptionSucceed.err(), subscriptionSucceed.err_message()); }
//------------------------------------------------------------------------- IMediaDevicesTypes::PromiseWithDeviceListPtr MediaDevices::enumerateDevices() { PromiseWithDeviceListPtr promise = PromiseWithDeviceList::create(IORTCForInternal::queueDelegate()); MediaDevicesPtr pThis(MediaDevices::singleton()); if (!pThis) { ZS_LOG_WARNING(Basic, slog("media devices singleton is gone")) promise->reject(); return promise; } IMediaDevicesAsyncDelegateProxy::create(pThis)->onEnumerateDevices(promise); return promise; }
//------------------------------------------------------------------------- IMediaDevicesTypes::PromiseWithMediaStreamTrackListPtr MediaDevices::getUserMedia(const Constraints &constraints) { PromiseWithMediaStreamTrackListPtr promise = PromiseWithMediaStreamTrackList::create(IORTCForInternal::queueDelegate()); MediaDevicesPtr pThis(MediaDevices::singleton()); if (!pThis) { ZS_LOG_WARNING(Basic, slog("media devices singleton is gone")) promise->reject(); return promise; } ConstraintsPtr constraintsCopy = Constraints::create(constraints); IMediaDevicesAsyncDelegateProxy::create(pThis)->onGetUserMedia(promise, constraintsCopy); return promise; }
void RDORuntime::copyFrom(const LPRDORuntime& pOther) { ASSERT(pOther); ASSERT(m_resourceTypeList.empty()); LPRDORuntime pThis(const_cast<RDORuntime*>(this)); for (const LPRDOResourceTypeList& pRTP: pOther->m_resourceTypeList) { pRTP->clone(pThis); } m_constantList = pOther->m_constantList; m_patternParameterList = pOther->m_patternParameterList; m_resultList = pOther->m_resultList; m_pThreadProxy = pOther->m_pThreadProxy; setCurrentTime(pOther->getCurrentTime()); parent_type::copyFrom(pOther.object_parent_cast<parent_type>()); }
wxXmlProperty *nwxXmlContainer::CreateProperties(int *pnCount) { int nCount = 0; wxString sValue; wxXmlProperty *pFirst(NULL); wxXmlProperty *pLast(NULL); wxXmlProperty *pThis(NULL); PERSISTstr *pPERSIST; for(mapPERSISTstr::iterator itr = m_mapAttr.begin(); itr != m_mapAttr.end(); ++itr) { pPERSIST = itr->second; if(pPERSIST->pPersist->CreateString(&sValue,pPERSIST->pObj)) { pThis = new wxXmlProperty(pPERSIST->sName,sValue); ++nCount; if(pLast == NULL) { // begin list pFirst = pThis; pLast = pThis; } else { // append list pLast->SetNext(pThis); pLast = pThis; } } } if(pnCount != NULL) { *pnCount = nCount; } return pFirst; }
//--------------------------------------------------------------------- MessageFactoryPeerFinderPtr MessageFactoryPeerFinder::create() { MessageFactoryPeerFinderPtr pThis(new MessageFactoryPeerFinder); IMessageFactoryManager::registerFactory(pThis); return pThis; }
//--------------------------------------------------------------------- MessageFactoryIdentityLookupPtr MessageFactoryIdentityLookup::create() { MessageFactoryIdentityLookupPtr pThis(new MessageFactoryIdentityLookup); IMessageFactoryManager::registerFactory(pThis); return pThis; }
//--------------------------------------------------------------------- SessionDeleteRequestPtr SessionDeleteRequest::create() { SessionDeleteRequestPtr pThis(new SessionDeleteRequest); return pThis; }
RTMFPWriter::RTMFPWriter(State state,const string& signature, BandWriter& band) : _resetStream(true), FlashWriter(state,band.poolBuffers()), id(0), _band(band), critical(false), _stage(0), _stageAck(0), flowId(0), signature(signature), _repeatable(0), _lostCount(0), _ackCount(0) { shared_ptr<RTMFPWriter> pThis(this); _band.initWriter(pThis); if (signature.empty()) open(); }
RTMFPWriter::RTMFPWriter(const string& signature, BandWriter& band, WriterHandler* pHandler) : FlashWriter(pHandler), id(0), _band(band), _reseted(true), critical(false), _stage(0), _stageAck(0), _boundCount(0), flowId(0), signature(signature), _repeatable(0), _lostCount(0), _ackCount(0), _connectedSize(-1) { shared_ptr<RTMFPWriter> pThis(this); _band.initWriter(pThis); }