コード例 #1
0
void AudioNode::finishDeref(RefType refType)
{
    ASSERT(context()->isGraphOwner());
    
    switch (refType) {
    case RefTypeNormal:
        ASSERT(m_normalRefCount > 0);
        atomicDecrement(&m_normalRefCount);
        break;
    case RefTypeConnection:
        ASSERT(m_connectionRefCount > 0);
        atomicDecrement(&m_connectionRefCount);
        break;
    case RefTypeDisabled:
        ASSERT(m_disabledRefCount > 0);
        atomicDecrement(&m_disabledRefCount);
        break;
    default:
        ASSERT_NOT_REACHED();
    }
    
#if DEBUG_AUDIONODE_REFERENCES
    printf("%p: %d: AudioNode::deref(%d) %d %d %d\n", this, type(), refType, m_normalRefCount, m_connectionRefCount, m_disabledRefCount);
#endif

    if (!m_connectionRefCount) {
        if (!m_normalRefCount && !m_disabledRefCount) {
            if (!m_isMarkedForDeletion) {
                // All references are gone - we need to go away.
                for (unsigned i = 0; i < m_outputs.size(); ++i)
                    output(i)->disconnectAllInputs(); // this will deref() nodes we're connected to...

                // Mark for deletion at end of each render quantum or when context shuts down.
                context()->markForDeletion(this);
                m_isMarkedForDeletion = true;
            }
        } else if (refType == RefTypeConnection) {
            if (!m_isDisabled) {
                // Still may have JavaScript references, but no more "active" connection references, so put all of our outputs in a "dormant" disabled state.
                // Garbage collection may take a very long time after this time, so the "dormant" disabled nodes should not bog down the rendering...

                // As far as JavaScript is concerned, our outputs must still appear to be connected.
                // But internally our outputs should be disabled from the inputs they're connected to.
                // disable() can recursively deref connections (and call disable()) down a whole chain of connected nodes.

                // FIXME: we special case the convolver and delay since they have a significant tail-time and shouldn't be disconnected simply
                // because they no longer have any input connections.  This needs to be handled more generally where AudioNodes have
                // a tailTime attribute.  Then the AudioNode only needs to remain "active" for tailTime seconds after there are no
                // longer any active connections.
                if (type() != NodeTypeConvolver && type() != NodeTypeDelay) {
                    m_isDisabled = true;
                    for (unsigned i = 0; i < m_outputs.size(); ++i)
                        output(i)->disable();
                }
            }
        }
    }
}
コード例 #2
0
ConditionVariable1::~ConditionVariable1()
{
	TRACE_CALL(lib_com.cnd, ("ConditionVariable1{0x%x}::~ConditionVariable1", _T_PTR(this)));

	CloseHandle(event_);
	atomicDecrement(num_);
}
コード例 #3
0
ConditionVariable1::~ConditionVariable1()
{
	TRACE_CALL(lib_com.cnd, ("ConditionVariable1{0x%x}::~ConditionVariable1", _T_PTR(this)));

	pthread_cond_destroy(&cid_);
	atomicDecrement(num_);
}
コード例 #4
0
ファイル: attributes.cpp プロジェクト: ataibarkai/Pixie-iOS
///////////////////////////////////////////////////////////////////////
// Class				:	CAttributes
// Method				:	~CAttributes
// Description			:	Deallocate everything
// Return Value			:	-
// Comments				:
CAttributes::~CAttributes(){
	CActiveLight	*cLight;

	atomicDecrement(&stats.numAttributes);

	if (surface != NULL)				surface->detach();
	if (displacement != NULL)			displacement->detach();
	if (atmosphere != NULL)				atmosphere->detach();
	if (interior != NULL)				interior->detach();
	if (exterior != NULL)				exterior->detach();

	if (globalMapName != NULL)			free(globalMapName);
	if (causticMapName != NULL)			free(causticMapName);
	if (globalMap != NULL)				globalMap->detach();
	if (causticMap != NULL)				causticMap->detach();
	if (irradianceHandle != NULL)		free(irradianceHandle);
	if (irradianceHandleMode != NULL)	free(irradianceHandleMode);

	if (name != NULL)					free(name);

	if (maxDisplacementSpace != NULL)	free(maxDisplacementSpace);

	while((cLight=lightSources) != NULL) {
		lightSources	=	cLight->next;
		delete cLight;
	}

	if (next != NULL)			delete next;
}
コード例 #5
0
void RefCountedLeakCounter::decrement()
{
#if ENABLE(JSC_MULTIPLE_THREADS)
    atomicDecrement(&m_count);
#else
    --m_count;
#endif
}
コード例 #6
0
ファイル: Routine.cpp プロジェクト: Abraham2591/Swiftshader
	void Routine::unbind()
	{
		long count = atomicDecrement(&bindCount);

		if(count == 0)
		{
			delete this;
		}
	}
コード例 #7
0
///////////////////////////////////////////////////////////////////////
// Class				:	CBSplinePatchGrid
// Method				:	~CBSplinePatchGrid
// Description			:
/// \brief					Dtor
// Return Value			:	-
// Comments				:
CBSplinePatchGrid::~CBSplinePatchGrid() {
	delete [] vertex;

	variables->detach();

	if (parameters != NULL)	delete parameters;

	atomicDecrement(&stats.numGprims);
}
コード例 #8
0
ファイル: delayed.cpp プロジェクト: AtomicPerception/pixie
///////////////////////////////////////////////////////////////////////
// Class				:	CDelayedObject
// Method				:	~CDelayedObject
// Description			:
/// \brief					Dtor
// Return Value			:	-
// Comments				:
CDelayedObject::~CDelayedObject() {
	atomicDecrement(&stats.numDelayeds);

	dataRefCount[0]--;

	if (dataRefCount[0] == 0) {
		if (freeFunction != NULL)	freeFunction(data);
		delete dataRefCount;
	}
}
コード例 #9
0
ファイル: ThreadState.cpp プロジェクト: kjthegod/WebKit
 void doPark(ThreadState* state, intptr_t* stackEnd)
 {
     state->recordStackEnd(stackEnd);
     MutexLocker locker(m_mutex);
     if (!atomicDecrement(&m_unparkedThreadCount))
         m_parked.signal();
     while (!acquireLoad(&m_canResume))
         m_resume.wait(m_mutex);
     atomicIncrement(&m_unparkedThreadCount);
 }
コード例 #10
0
ファイル: AudioNode.cpp プロジェクト: kodybrown/webkit
void AudioNode::finishDeref(RefType refType)
{
    ASSERT(context()->isGraphOwner());

    switch (refType) {
    case RefTypeNormal:
        ASSERT(m_normalRefCount > 0);
        atomicDecrement(&m_normalRefCount);
        break;
    case RefTypeConnection:
        ASSERT(m_connectionRefCount > 0);
        atomicDecrement(&m_connectionRefCount);
        break;
    default:
        ASSERT_NOT_REACHED();
    }

#if DEBUG_AUDIONODE_REFERENCES
    fprintf(stderr, "%p: %d: AudioNode::deref(%d) %d %d\n", this, nodeType(), refType, m_normalRefCount, m_connectionRefCount);
#endif

    if (!m_connectionRefCount) {
        if (!m_normalRefCount) {
            if (!m_isMarkedForDeletion) {
                // All references are gone - we need to go away.
                for (unsigned i = 0; i < m_outputs.size(); ++i)
                    output(i)->disconnectAll(); // This will deref() nodes we're connected to.

                // Mark for deletion at end of each render quantum or when context shuts down.
                context()->markForDeletion(this);
                m_isMarkedForDeletion = true;
            }
        } else if (refType == RefTypeConnection)
            disableOutputsIfNecessary();
    }
}
コード例 #11
0
ファイル: options.cpp プロジェクト: juvenal/pixie-fork
///////////////////////////////////////////////////////////////////////
// Class				:	COptions
// Method				:	~COptions
// Description			:
/// \brief					Destructor
// Return Value			:	-
// Comments				:
COptions::~COptions(){
	atomicDecrement(&stats.numOptions);

	if (fromRGB != NULL) 
		delete [] fromRGB;

	if (toRGB != NULL)
		delete [] toRGB;

	if (displays != NULL) {
		CDisplay	*cDisplay,*nDisplay;

		for (cDisplay=displays;cDisplay!=NULL;) {
			nDisplay	=	cDisplay->next;
			delete cDisplay;
			cDisplay	=	nDisplay;
		}
	}

	if (clipPlanes != NULL) {
		CClipPlane	*cPlane,*nPlane;

		for (cPlane=clipPlanes;cPlane!=NULL;) {
			nPlane	=	cPlane->next;
			delete cPlane;
			cPlane	=	nPlane;
		}
	}

	if (hider != NULL)
		free(hider);


	optionsDeleteSearchPath(archivePath);
	optionsDeleteSearchPath(proceduralPath);
	optionsDeleteSearchPath(texturePath);
	optionsDeleteSearchPath(shaderPath);
	optionsDeleteSearchPath(displayPath);
	optionsDeleteSearchPath(modulePath);

	if (causticIn				!= NULL)	free(causticIn);
	if (causticOut				!= NULL)	free(causticOut);
	if (globalIn				!= NULL)	free(globalIn);
	if (globalOut				!= NULL)	free(globalOut);
	if (filelog					!= NULL)	free(filelog);
}
コード例 #12
0
ファイル: ThreadState.cpp プロジェクト: kjthegod/WebKit
 void doEnterSafePoint(ThreadState* state, intptr_t* stackEnd)
 {
     state->recordStackEnd(stackEnd);
     state->copyStackUntilSafePointScope();
     // m_unparkedThreadCount tracks amount of unparked threads. It is
     // positive if and only if we have requested other threads to park
     // at safe-points in preparation for GC. The last thread to park
     // itself will make the counter hit zero and should notify GC thread
     // that it is safe to proceed.
     // If no other thread is waiting for other threads to park then
     // this counter can be negative: if N threads are at safe-points
     // the counter will be -N.
     if (!atomicDecrement(&m_unparkedThreadCount)) {
         MutexLocker locker(m_mutex);
         m_parked.signal(); // Safe point reached.
     }
 }
コード例 #13
0
ファイル: DNSCFNet.cpp プロジェクト: UIKit0/WebkitAIR
void DNSResolveQueue::resolve(const String& hostname)
{
    ASSERT(isMainThread());

    RetainPtr<CFStringRef> hostnameCF(AdoptCF, hostname.createCFString());
    RetainPtr<CFHostRef> host(AdoptCF, CFHostCreateWithName(0, hostnameCF.get()));
    if (!host) {
        atomicDecrement(&m_requestsInFlight);
        return;
    }
    CFHostClientContext context = { 0, 0, 0, 0, 0 };
    Boolean result = CFHostSetClient(host.get(), clientCallback, &context);
    ASSERT_UNUSED(result, result);
#if !PLATFORM(WIN)
    CFHostScheduleWithRunLoop(host.get(), CFRunLoopGetMain(), kCFRunLoopCommonModes);
#else
    // On Windows, we run a separate thread with CFRunLoop, which is where clientCallback will be called.
    CFHostScheduleWithRunLoop(host.get(), loaderRunLoop(), kCFRunLoopDefaultMode);
#endif
    CFHostStartInfoResolution(host.get(), kCFHostAddresses, 0);
    host.releaseRef(); // The host will be released from clientCallback().
}
コード例 #14
0
bool 
ConditionVariable::wait(Mutex* mutex, int msec)
{
	TRACE_CALL(lib_com.cnd, ("ConditionVariable{0x%x}::wait", _T_PTR(this)));

	HANDLE h = CreateEvent(0, true, false, 0);
	atomicIncrement(num_);
	events_.push_back(h);

	mutex->unlock();
	bool res = (WAIT_TIMEOUT != WaitForSingleObject(h, msec ? msec : INFINITE));
	mutex->lock();

	for (std::vector<HANDLE>::iterator i = events_.begin(); i != events_.end(); i++)
		if (*i == h) {
			events_.erase(i);
			break;
		}
	
	CloseHandle(h);
	atomicDecrement(num_);

	return res;
}
コード例 #15
0
    void RefCountedLeakCounter::decrement()
    {
#ifndef NDEBUG
        atomicDecrement(&count);
#endif
    }
コード例 #16
0
ファイル: log.cpp プロジェクト: skynowa/cxxtools
 atomic_t decrement()
 {
   decremented = true;
   return atomicDecrement(count);
 }
コード例 #17
0
void AudioContext::decrementActiveSourceCount()
{
    atomicDecrement(&m_activeSourceCount);
}
コード例 #18
0
ファイル: dlobject.cpp プロジェクト: AtomicPerception/pixie
///////////////////////////////////////////////////////////////////////
// Class				:	CDLObject
// Method				:	~CDLObject
// Description			:
/// \brief					Dtor
// Return Value			:	-
// Comments				:
CDLObject::~CDLObject() {
	atomicDecrement(&stats.numGprims);

	tiniFunction(data);
	osUnloadModule(handle);
}
コード例 #19
0
ファイル: log.cpp プロジェクト: skynowa/cxxtools
 ~ScopedAtomicIncrementer()
 {
   if (!decremented)
     atomicDecrement(count);
 }
コード例 #20
0
ファイル: xform.cpp プロジェクト: ataibarkai/Pixie-iOS
///////////////////////////////////////////////////////////////////////
// Class				:	CXform
// Method				:	~CXform
// Description			:	Destructor
// Return Value			:	-
// Comments				:	
CXform::~CXform() {
	atomicDecrement(&stats.numXforms);

	if (next != NULL)	delete next;
}
コード例 #21
0
ファイル: object.cpp プロジェクト: AtomicPerception/pixie
///////////////////////////////////////////////////////////////////////
// Class				:	CObject
// Method				:	~CObject
// Description			:
/// \brief					Dtor
// Return Value			:	-
// Comments				:	
CObject::~CObject() {
	atomicDecrement(&stats.numObjects);

	attributes->detach();
	xform->detach();
}
コード例 #22
0
void RefCountedLeakCounter::decrement()
{
    atomicDecrement(&m_count);
}
コード例 #23
0
ファイル: delayed.cpp プロジェクト: AtomicPerception/pixie
///////////////////////////////////////////////////////////////////////
// Class				:	CDelayedInstance
// Method				:	~CDelayedInstance
// Description			:
/// \brief					Dtor
// Return Value			:	-
// Comments				:
CDelayedInstance::~CDelayedInstance() {
	atomicDecrement(&stats.numDelayeds);
}
コード例 #24
0
void ReadWriteLock::unlockReader()
{
	atomicDecrement(&mImpl->readerCounter);
}