bool VCommand::Trigger(const VValueBag* inBagValue, const ICommandListener* inExcept) { // To ensure the command won't dispose while it's used, we retain locally Retain(); VIndex nbCalls = 0; VCommandContext context(this, inBagValue, inExcept); if (fFocusRelated) { // Sent to default handler (which generally forward directly to focus) if (ICommandListener::sDefaultListener != NULL && ICommandListener::sDefaultListener->DoCommandTriggeredOnFocus(this, &context)) nbCalls = 1; } else { // Sent to target nbCalls = fTriggerSignal.TriggerExcept(dynamic_cast<const VObject*>(inExcept), this, &context); } // If not handled, sent to default handler if (nbCalls == 0 && ICommandListener::sDefaultListener != NULL) ICommandListener::sDefaultListener->DoOrphanCommandTriggered(this, &context); Release(); return nbCalls != 0; }
void FrameLoaderClientAndroid::transitionToCommittedForNewPage() { ASSERT(m_frame); #ifdef ANDROID_META_SUPPORT // reset metadata settings for the main frame as they are not preserved cross page if (m_frame == m_frame->page()->mainFrame() && m_frame->settings()) m_frame->settings()->resetMetadataSettings(); #endif // Save the old WebViewCore before creating a new FrameView. There is one // WebViewCore per page. Each frame, including the main frame and sub frame, // has a 1:1 FrameView and WebFrameView. WebViewCore* webViewCore = WebViewCore::getWebViewCore(m_frame->view()); Retain(webViewCore); // Save the old WebFrameView's bounds and apply them to the new WebFrameView WebFrameView* oldWebFrameView = static_cast<WebFrameView*> (m_frame->view()->platformWidget()); IntRect bounds = oldWebFrameView->getBounds(); IntRect windowBounds = oldWebFrameView->getWindowBounds(); WebCore::FrameView* oldFrameView = oldWebFrameView->view(); m_frame->createView(bounds.size(), oldFrameView->baseBackgroundColor(), oldFrameView->isTransparent(), IntSize(), false); // Create a new WebFrameView for the new FrameView WebFrameView* newFrameView = new WebFrameView(m_frame->view(), webViewCore); newFrameView->setLocation(bounds.x(), bounds.y()); newFrameView->setSize(bounds.width(), bounds.height()); newFrameView->setWindowBounds(windowBounds.x(), windowBounds.y(), windowBounds.width(), windowBounds.height()); // newFrameView attaches itself to FrameView which Retains the reference, so // call Release for newFrameView Release(newFrameView); // WebFrameView Retains webViewCore, so call Release for webViewCore Release(webViewCore); m_webFrame->transitionToCommitted(m_frame); }
Shader& Shader::operator = (const Shader& a_Other) { Release(); m_Object = a_Other.m_Object; m_pRefCount = a_Other.m_pRefCount; Retain(); return *this; }
bool MCGImageImageRep::LockImageFrame(uindex_t p_index, MCGFloat p_density, MCGImageFrame &r_frame) { if (p_index > 0) return false; Retain(); r_frame = m_frame; return true; }
void VCommand::UpdateValue(const VValueBag* inBagValue, const ICommandListener* inExcept) { Retain(); VCommandContext context(this, inBagValue, inExcept); fUpdateSignal.TriggerExcept(dynamic_cast<const VObject*>(inExcept), this, &context); Release(); }
bool VRIAJSRuntimeContext::_AttachToJSContext( XBOX::VJSContext& inContext) { bool done = inContext.GetGlobalObjectPrivateInstance()->SetSpecific( 'riax', this, VJSSpecifics::DestructorReleaseVObject); if (done) { Retain(); } return done; }
void Critter::Splatter() { Retain(); RemoveFromWorld(); class Splatter splatter(GetWorldPosition(), _splatterColor); splatter.Activate(); Release(); }
void CTcpSocket::Fini(void) { if (!m_binit) return; if ( m_io ) { Retain(); m_io->Post(std::bind(&CTcpSocket::real_fini, this)); } }
Animation * SoundInstance::VolumeAnimation(float32 newVolume, float32 time, int32 track /*= 0*/) { animatedVolume = GetVolume(); Animation * a = new LinearAnimation<float32>(this, &animatedVolume, newVolume, time, Interpolation::LINEAR); a->AddEvent(Animation::EVENT_ANIMATION_END, Message(this, &SoundInstance::OnVolumeAnimationEnded)); Retain(); a->Start(track); return a; }
void XWinFileSystemNotification::XWinChangeData::ReadDirectoryChanges() { if (!fIsCanceled) { // retain the data. It will be released in CompletionRoutine. Retain(); BOOL ok = ::ReadDirectoryChangesW( fFolderHandle, fBuffer, sizeof( fBuffer ), true, fThisPointer->MakeFilter( fFilters ), NULL, &fOverlapped, XWinFileSystemNotification::CompletionRoutine); xbox_assert( ok); if (!ok) Release(); } }
bool CTcpSocket::Connect(const std::string& ip, unsigned int port) { if (m_status != status_null) return false; if (!m_binit) return false; if (m_type != type_connecter) return false; //if (!m_io || !m_ccb) return false; Retain(); m_io->Post(std::bind(&CTcpSocket::real_connect, this, ip, port)); return true; }
void Thread::Start() { Retain(); #if defined(__DAVAENGINE_IPHONE__) || defined(__DAVAENGINE_MACOS__) StartMacOS(); #elif defined(__DAVAENGINE_WIN32__) StartWin32(); #elif defined(__DAVAENGINE_ANDROID__) StartAndroid(); #else //PLATFORMS //other platforms #endif //PLATFORMS }
bool MCGImageImageRep::LockBitmap(uindex_t p_index, MCGFloat p_density, MCImageBitmap *&r_bitmap) { if (p_index > 0) return false; if (!EnsureBitmap()) return false; Retain(); r_bitmap = m_bitmap; return true; }
void Sound::Play() { FMOD::Channel * fmodInstance = 0; FMOD_VERIFY(SoundSystem::Instance()->fmodSystem->playSound(FMOD_CHANNEL_FREE, fmodSound, true, &fmodInstance)); //start sound paused FMOD_VECTOR pos = {position.x, position.y, position.z}; FMOD_VERIFY(fmodInstance->setPriority(priority)); FMOD_VERIFY(fmodInstance->setCallback(SoundInstanceEndPlaying)); FMOD_VERIFY(fmodInstance->setUserData(this)); FMOD_VERIFY(fmodInstance->setChannelGroup(fmodInstanceGroup)); if(is3d) FMOD_VERIFY(fmodInstance->set3DAttributes(&pos, 0)); FMOD_VERIFY(fmodInstance->setPaused(false)); Retain(); }
bool FMODSoundEvent::Trigger() { SoundSystem * soundSystem = SoundSystem::Instance(); FMOD::EventSystem * fmodEventSystem = soundSystem->fmodEventSystem; if(is3D) { FMOD::Event * fmodEventInfo = 0; FMOD_VERIFY(fmodEventSystem->getEvent(eventName.c_str(), FMOD_EVENT_INFOONLY, &fmodEventInfo)); if(fmodEventInfo) { FMOD_VERIFY(fmodEventInfo->set3DAttributes((FMOD_VECTOR*)&position, 0, isDirectional ? (FMOD_VECTOR*)&direction : NULL)); FMOD_VERIFY(fmodEventInfo->setVolume(volume)); ApplyParamsToEvent(fmodEventInfo); } } FMOD::Event * fmodEvent = 0; FMOD_RESULT result = fmodEventSystem->getEvent(eventName.c_str(), FMOD_EVENT_DEFAULT, &fmodEvent); if(result == FMOD_OK) { ApplyParamsToEvent(fmodEvent); FMOD_VERIFY(fmodEvent->setVolume(volume)); FMOD_RESULT startResult = fmodEvent->start(); if(startResult == FMOD_OK) { FMOD_VERIFY(fmodEvent->setCallback(FMODEventCallback, this)); fmodEventInstances.push_back(fmodEvent); Retain(); } else if(startResult != FMOD_ERR_EVENT_FAILED) //'just fail' max playbacks behavior { Logger::Error("[FMODSoundEvent::Trigger()] Failed to start event by %d on eventID: %s", startResult, eventName.c_str()); } } else if(result != FMOD_ERR_EVENT_FAILED) //'just fail' max playbacks behavior { Logger::Error("[FMODSoundEvent::Trigger()] Failed to retrieve event by %d on eventID: %s", result, eventName.c_str()); } PerformEvent(EVENT_TRIGGERED); return fmodEvent != 0; }
bool MCCachedImageRep::LockImageFrame(uindex_t p_frame, MCImageFrame *&r_frame) { if (m_frames == nil) { if (!EnsureImageFrames()) return false; } if (p_frame < m_frame_count) { m_lock_count++; //m_frame_locks[p_frame]++; Retain(); r_frame = &m_frames[p_frame]; return true; } return false; }
void GameObject::ChangeManager(GameObjectManager *newManager) { Retain(); if(manager) { manager->RemoveObject(this); } if (newManager) { newManager->AddObject(this); for (List<GameObject*>::iterator t = children.begin(); t != children.end(); ++t) { GameObject * child = *t; child->ChangeManager(newManager); } } Release(); }
void QSetDefglobalValue( Environment *theEnv, Defglobal *theGlobal, UDFValue *vPtr, bool resetVar) { CLIPSValue newValue; /*====================================================*/ /* If the new value passed for the defglobal is NULL, */ /* then reset the defglobal to the initial value it */ /* had when it was defined. */ /*====================================================*/ if (resetVar) { EvaluateExpression(theEnv,theGlobal->initial,vPtr); if (EvaluationData(theEnv)->EvaluationError) { vPtr->value = FalseSymbol(theEnv); } } /*==========================================*/ /* If globals are being watch, then display */ /* the change to the global variable. */ /*==========================================*/ #if DEBUGGING_FUNCTIONS if (theGlobal->watch && (! ConstructData(theEnv)->ClearReadyInProgress) && (! ConstructData(theEnv)->ClearInProgress)) { WriteString(theEnv,STDOUT,":== ?*"); WriteString(theEnv,STDOUT,theGlobal->header.name->contents); WriteString(theEnv,STDOUT,"* ==> "); WriteUDFValue(theEnv,STDOUT,vPtr); WriteString(theEnv,STDOUT," <== "); WriteCLIPSValue(theEnv,STDOUT,&theGlobal->current); WriteString(theEnv,STDOUT,"\n"); } #endif /*==============================================*/ /* Retain the new value of the global variable. */ /*==============================================*/ NormalizeMultifield(theEnv,vPtr); if (vPtr->header->type != MULTIFIELD_TYPE) { newValue.value = vPtr->value; } else { newValue.value = CopyMultifield(theEnv,vPtr->multifieldValue); } Retain(theEnv,newValue.header); /*==============================================*/ /* Remove the old value of the global variable. */ /*==============================================*/ Release(theEnv,theGlobal->current.header); if (theGlobal->current.header->type == MULTIFIELD_TYPE) { if (theGlobal->current.multifieldValue->busyCount == 0) { ReturnMultifield(theEnv,theGlobal->current.multifieldValue); } else { AddToMultifieldList(theEnv,theGlobal->current.multifieldValue); } } /*===========================================*/ /* Set the new value of the global variable. */ /*===========================================*/ theGlobal->current.value = newValue.value; /*===========================================*/ /* Set the variable indicating that a change */ /* has been made to a global variable. */ /*===========================================*/ DefglobalData(theEnv)->ChangeToGlobals = true; if (EvaluationData(theEnv)->CurrentExpression == NULL) { CleanCurrentGarbageFrame(theEnv,NULL); CallPeriodicTasks(theEnv); } }
void TextBlock::Prepare(Texture *texture /*=NULL*/) { Retain(); ScopedPtr<Job> job = JobManager::Instance()->CreateJob(JobManager::THREAD_MAIN, Message(this, &TextBlock::PrepareInternal, SafeRetain(texture))); }
CFGAS_GEFont* CFGAS_GEFont::Derive(uint32_t dwFontStyles, uint16_t wCodePage) { if (GetFontStyles() == dwFontStyles) return Retain(); return new CFGAS_GEFont(*this, dwFontStyles); }
void ChromeClientAndroid::setWebFrame(android::WebFrame* webframe) { Release(m_webFrame); m_webFrame = webframe; Retain(m_webFrame); }
void Widget::retainPlatformWidget() { Retain(platformWidget()); }
IFX_Font* CFX_GEFont::Derive(FX_DWORD dwFontStyles, FX_WORD wCodePage) { if (GetFontStyles() == dwFontStyles) { return Retain(); } return new CFX_GEFont(*this, dwFontStyles); }
Shader::Shader(const Shader& a_Other) : m_Object(a_Other.m_Object), m_pRefCount(a_Other.m_pRefCount) { Retain(); }