当前位置: 首页>>代码示例>>C++>>正文


C++ releaseResources函数代码示例

本文整理汇总了C++中releaseResources函数的典型用法代码示例。如果您正苦于以下问题:C++ releaseResources函数的具体用法?C++ releaseResources怎么用?C++ releaseResources使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了releaseResources函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: releaseResources

void ResourceLoader::cancel(const ResourceError& error)
{
    // If the load has already completed - succeeded, failed, or previously cancelled - do nothing.
    if (m_state == Terminated)
        return;
    if (m_state == Finishing) {
        releaseResources();
        return;
    }

    ResourceError nonNullError = error.isNull() ? ResourceError::cancelledError(m_request.url()) : error;

    // This function calls out to clients at several points that might do
    // something that causes the last reference to this object to go away.
    RefPtr<ResourceLoader> protector(this);

    LOG(ResourceLoading, "Cancelled load of '%s'.\n", m_resource->url().string().latin1().data());
    if (m_state == Initialized)
        m_state = Finishing;
    m_resource->setResourceError(nonNullError);

    if (m_loader) {
        m_connectionState = ConnectionStateCanceled;
        m_loader->cancel();
        m_loader.clear();
    }

    m_host->didFailLoading(m_resource, nonNullError, m_options);

    if (m_state == Finishing)
        m_resource->error(Resource::LoadError);
    if (m_state != Terminated)
        releaseResources();
}
开发者ID:halton,项目名称:blink-crosswalk,代码行数:34,代码来源:ResourceLoader.cpp

示例2: releaseResources

int CDirectXRenderLayer::initDevice(unsigned int adapter, TRasterizationType rasterization, const TDisplayMode& displayMode)
{
	if (mD3DInterface)
	{
		D3DDEVTYPE devType;
		releaseResources();

		devType = convertRasterizationTypeToDevType(rasterization);

		// Filling present parameters...
		memcpy(&mDeviceDisplayMode, &displayMode, sizeof(TDisplayMode));
		mCurrentFormat = convertTFormatToD3DFormat(displayMode.mFormat);
		ZeroMemory(&mPresentParams, sizeof(mPresentParams));
		mPresentParams.Windowed = FALSE;
		mPresentParams.BackBufferWidth = displayMode.mWidth;
		mPresentParams.BackBufferHeight = displayMode.mHeight;
		mPresentParams.BackBufferCount = 1;
		mPresentParams.FullScreen_RefreshRateInHz = displayMode.mRefreshRate;
		mPresentParams.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
		mPresentParams.BackBufferFormat = mCurrentFormat;
		/* TODO: Try to use D3DSWAPEFFECT_FLIP for better performance.
		   Maybe store pointers to two back buffers and then swap them
		   right after presentScene(). */
		mPresentParams.SwapEffect = D3DSWAPEFFECT_COPY;
		mPresentParams.Flags = 0;

		// Creating device...
		if (FAILED(mD3DInterface->CreateDevice(adapter, devType, mHwnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &mPresentParams, &mD3DDevice)))
		{
			LOGTEXT("CDirectXRenderLayer: CreateDevice() with hardware vertex processing failed");
			if (FAILED(mD3DInterface->CreateDevice(adapter, devType, mHwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &mPresentParams, &mD3DDevice)))
			{
				LOGTEXT("CDirectXRenderLayer: CreateDevice() with software vertex processing failed");
				releaseResources();
				return E_FAILED;
			}
		}

		// Retrieving device capabilities...
		if (FAILED(mD3DInterface->GetDeviceCaps(adapter, devType, &mDeviceCaps)))
		{
			LOGTEXT("CDirectXRenderLayer: GetDeviceCaps() failed");
			releaseResources();
			return E_FAILED;
		}
		mMaxPrimitiveCount = XMATH_MIN(mDeviceCaps.MaxPrimitiveCount, MAX_SPRITES_PER_TEXTURE * 2);

		// Creating font sprite...
		if (FAILED(D3DXCreateSprite(mD3DDevice, &mD3DFontSprite)))
		{
			LOGTEXT("CDirectXRenderLayer: D3DXCreateSprite() for font failed");
			releaseResources();
			return E_FAILED;
		}

		return resetDevice();
	}
	LOGTEXT("CDirectXRenderLayer: initDevice() failed");
	return E_FAILED;
}
开发者ID:tdtech,项目名称:XenomeForce,代码行数:60,代码来源:directx_render_layer.cpp

示例3: releaseResources

void ResourceLoader::cancel(const ResourceError& error)
{
    // If the load has already completed - succeeded, failed, or previously cancelled - do nothing.
    if (m_state == Terminated)
        return;
    if (m_state == Finishing) {
        releaseResources();
        return;
    }

    ResourceError nonNullError = error.isNull() ? ResourceError::cancelledError(m_request.url()) : error;

    WTF_LOG(ResourceLoading, "Cancelled load of '%s'.\n", m_resource->url().string().latin1().data());
    if (m_state == Initialized)
        m_state = Finishing;
    m_resource->setResourceError(nonNullError);

    if (m_loader) {
        m_connectionState = ConnectionStateCanceled;
        m_loader->cancel();
        m_loader.clear();
    }

    if (!m_notifiedLoadComplete) {
        m_notifiedLoadComplete = true;
        m_fetcher->didFailLoading(m_resource, nonNullError);
    }

    if (m_state == Finishing)
        m_resource->error(Resource::LoadError);
    if (m_state != Terminated)
        releaseResources();
}
开发者ID:joone,项目名称:chromium-crosswalk,代码行数:33,代码来源:ResourceLoader.cpp

示例4: locker

HRESULT D3DPresentEngine::createVideoSamples(IMFMediaType *format, QList<IMFSample*> &videoSampleQueue)
{
    if (!format)
        return MF_E_UNEXPECTED;

    HRESULT hr = S_OK;
    D3DPRESENT_PARAMETERS pp;

    IDirect3DSwapChain9 *swapChain = NULL;
    IMFSample *videoSample = NULL;

    QMutexLocker locker(&m_mutex);

    releaseResources();

    // Get the swap chain parameters from the media type.
    hr = getSwapChainPresentParameters(format, &pp);
    if (FAILED(hr))
        goto done;

    // Create the video samples.
    for (int i = 0; i < PRESENTER_BUFFER_COUNT; i++) {
        // Create a new swap chain.
        hr = m_device->CreateAdditionalSwapChain(&pp, &swapChain);
        if (FAILED(hr))
            goto done;

        // Create the video sample from the swap chain.
        hr = createD3DSample(swapChain, &videoSample);
        if (FAILED(hr))
            goto done;

        // Add it to the list.
        videoSample->AddRef();
        videoSampleQueue.append(videoSample);

        // Set the swap chain pointer as a custom attribute on the sample. This keeps
        // a reference count on the swap chain, so that the swap chain is kept alive
        // for the duration of the sample's lifetime.
        hr = videoSample->SetUnknown(MFSamplePresenter_SampleSwapChain, swapChain);
        if (FAILED(hr))
            goto done;

        qt_wmf_safeRelease(&videoSample);
        qt_wmf_safeRelease(&swapChain);
    }

done:
    if (FAILED(hr))
        releaseResources();

    qt_wmf_safeRelease(&swapChain);
    qt_wmf_safeRelease(&videoSample);
    return hr;
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:55,代码来源:evrd3dpresentengine.cpp

示例5: releaseResources

int CDirectXInputLayer::init()
{
	releaseResources();
	if (mDInputInterface)
	{
		// Creating keyboard...
		if (FAILED(mDInputInterface->CreateDevice(GUID_SysKeyboard, &mDInputKeyBoard, NULL)))
		{
			LOGTEXT("CDirectXInputLayer: CreateDevice() for KeyBoard failed");
			return E_FAILED;
		}
		if (FAILED(mDInputKeyBoard->SetCooperativeLevel(mHwnd, DISCL_NONEXCLUSIVE | DISCL_BACKGROUND)))
		{
			LOGTEXT("CDirectXInputLayer: SetCooperativeLevel() for KeyBoard failed");
			releaseResources();
			return E_FAILED;
		}
		if (FAILED(mDInputKeyBoard->SetDataFormat(&c_dfDIKeyboard)))
		{
			LOGTEXT("CDirectXInputLayer: SetDataFormat() for KeyBoard failed");
			releaseResources();
			return E_FAILED;
		}
		if (FAILED(mDInputKeyBoard->Acquire()))
		{
			LOGTEXT("CDirectXInputLayer: Acquire() for KeyBoard failed");
			releaseResources();
			return E_FAILED;
		}

		// Creating mouse...
		if (FAILED(mDInputInterface->CreateDevice(GUID_SysMouse, &mDInputMouse, NULL)))
		{
			LOGTEXT("CDirectXInputLayer: CreateDevice() for Mouse failed");
			releaseResources();
			return E_FAILED;
		}
		if (FAILED(mDInputMouse->SetCooperativeLevel(mHwnd, DISCL_NONEXCLUSIVE | DISCL_BACKGROUND)))
		{
			LOGTEXT("CDirectXInputLayer: SetCooperativeLevel() for Mouse failed");
			releaseResources();
			return E_FAILED;
		}
		if (FAILED(mDInputMouse->SetDataFormat(&c_dfDIMouse)))
		{
			LOGTEXT("CDirectXInputLayer: SetDataFormat() for Mouse failed");
			releaseResources();
			return E_FAILED;
		}
		if (FAILED(mDInputMouse->Acquire()))
		{
			LOGTEXT("CDirectXInputLayer: Acquire() for Mouse failed");
			releaseResources();
			return E_FAILED;
		}
		return E_SUCCESS;
	}
	return E_FAILED;
}
开发者ID:tdtech,项目名称:XenomeForce,代码行数:59,代码来源:directx_input_layer.cpp

示例6: useTimeSlice

    int useTimeSlice()
    {
        if (isFullyLoaded())
        {
            if (reader != nullptr && source != nullptr)
                releaseResources();

            return -1;
        }

        bool justFinished = false;

        {
            const ScopedLock sl (readerLock);

            createReader();

            if (reader != nullptr)
            {
                if (! readNextBlock())
                    return 0;

                justFinished = true;
            }
        }

        if (justFinished)
            owner.cache.storeThumb (owner, hashCode);

        return timeBeforeDeletingReader;
    }
开发者ID:randi2kewl,项目名称:ShoutOut,代码行数:31,代码来源:juce_AudioThumbnail.cpp

示例7: ASSERT

void SubresourceLoader::didFinishLoading(double finishTime)
{
    if (m_state != Initialized)
        return;
    ASSERT(!reachedTerminalState());
    ASSERT(!m_resource->resourceToRevalidate());
    ASSERT(!m_resource->errorOccurred());
    LOG(ResourceLoading, "Received '%s'.", m_resource->url().string().latin1().data());

    Ref<SubresourceLoader> protect(*this);

#if PLATFORM(IOS)
    if (resourceData())
        resourceData()->setShouldUsePurgeableMemory(true);
#endif
    CachedResourceHandle<CachedResource> protectResource(m_resource);
    m_state = Finishing;
    m_resource->setLoadFinishTime(finishTime);
    m_resource->finishLoading(resourceData());

    if (wasCancelled())
        return;
    m_resource->finish();
    ASSERT(!reachedTerminalState());
    didFinishLoadingOnePart(finishTime);
    notifyDone();
    if (reachedTerminalState())
        return;
    releaseResources();
}
开发者ID:EliBing,项目名称:webkit,代码行数:30,代码来源:SubresourceLoader.cpp

示例8: ASSERT

void ResourceLoader::didFail(const ResourceError& error)
{
    if (m_cancelled)
        return;
    ASSERT(!m_reachedTerminalState);

    // Protect this in this delegate method since the additional processing can do
    // anything including possibly derefing this; one example of this is Radar 3266216.
    RefPtr<ResourceLoader> protector(this);

    if (FormData* data = m_request.httpBody())
        data->removeGeneratedFilesIfNeeded();

    if (!m_notifiedLoadComplete) {
        m_notifiedLoadComplete = true;
        // SRL: Log that an atomic action is generated with a load failure.
    	ActionLogFormat(ActionLog::ENTER_SCOPE,
    			"failed:%s", m_request.url().lastPathComponent().ascii().data());
        if (m_options.sendLoadCallbacks == SendCallbacks)
            frameLoader()->notifier()->didFailToLoad(this, error);
        ActionLogScopeEnd();
    }

    releaseResources();
}
开发者ID:christofferqa,项目名称:R4,代码行数:25,代码来源:ResourceLoader.cpp

示例9: attachLinkHighlightToCompositingLayer

void LinkHighlight::updateGeometry()
{
    // To avoid unnecessary updates (e.g. other entities have requested animations from our WebViewImpl),
    // only proceed if we actually requested an update.
    if (!m_geometryNeedsUpdate)
        return;

    m_geometryNeedsUpdate = false;

    bool hasRenderer = m_node && m_node->layoutObject();
    const LayoutBoxModelObject* paintInvalidationContainer = hasRenderer ? m_node->layoutObject()->containerForPaintInvalidation() : 0;
    if (paintInvalidationContainer)
        attachLinkHighlightToCompositingLayer(paintInvalidationContainer);
    if (paintInvalidationContainer && computeHighlightLayerPathAndPosition(paintInvalidationContainer)) {
        // We only need to invalidate the layer if the highlight size has changed, otherwise
        // we can just re-position the layer without needing to repaint.
        m_contentLayer->layer()->invalidate();

        if (m_currentGraphicsLayer && m_currentGraphicsLayer->isTrackingPaintInvalidations())
            m_currentGraphicsLayer->trackPaintInvalidationRect(FloatRect(layer()->position().x, layer()->position().y, layer()->bounds().width, layer()->bounds().height));
    } else if (!hasRenderer) {
        clearGraphicsLayerLinkHighlightPointer();
        releaseResources();
    }
}
开发者ID:kingysu,项目名称:blink-crosswalk,代码行数:25,代码来源:LinkHighlight.cpp

示例10: ASSERT

void ResourceLoader::didCancel(const ResourceError& error)
{
    ASSERT(!m_cancelled);
    ASSERT(!m_reachedTerminalState);

    if (FormData* data = m_request.httpBody())
        data->removeGeneratedFilesIfNeeded();

    // This flag prevents bad behavior when loads that finish cause the
    // load itself to be cancelled (which could happen with a javascript that 
    // changes the window location). This is used to prevent both the body
    // of this method and the body of connectionDidFinishLoading: running
    // for a single delegate. Canceling wins.
    m_cancelled = true;
    
    if (m_handle)
        m_handle->clearAuthentication();

    m_documentLoader->cancelPendingSubstituteLoad(this);
    if (m_handle) {
        m_handle->cancel();
        m_handle = 0;
    }
    if (m_sendResourceLoadCallbacks && !m_calledDidFinishLoad)
        frameLoader()->notifier()->didFailToLoad(this, error);

    releaseResources();
}
开发者ID:UIKit0,项目名称:WebkitAIR,代码行数:28,代码来源:ResourceLoader.cpp

示例11: releaseResources

void ExternalSortExecStreamImpl::open(bool restart)
{
    if (restart) {
        releaseResources();
    }

    ConduitExecStream::open(restart);

    // divvy up available memory by degree of parallelism
    sortInfo.nSortMemPagesPerRun = (sortInfo.nSortMemPages / nParallel);

    // subtract off one page per run for I/O buffering
    assert(sortInfo.nSortMemPagesPerRun > 0);
    sortInfo.nSortMemPagesPerRun--;

    // need at least two non-I/O pages per run: one for keys and one for data
    assert(sortInfo.nSortMemPagesPerRun > 1);

    // Initialize RunLoaders.
    initRunLoaders(false);

    pOutputWriter.reset(new ExternalSortOutput(sortInfo));

    for (uint i = 0; i < nParallel; ++i) {
        runLoaders[i]->startRun();
    }

    // default to local sort as output obj
    pOutputWriter->setSubStream(*(runLoaders[0]));

    resultsReady = false;
}
开发者ID:Jach,项目名称:luciddb,代码行数:32,代码来源:ExternalSortExecStreamImpl.cpp

示例12: gc

void KisIndirectPaintingSupport::mergeToLayerImpl(KisNodeSP layer,
                                                  UndoAdapter *undoAdapter,
                                                  const KUndo2MagicString &transactionText,int timedID)
{
    /**
     * We do not apply selection here, because it has already
     * been taken into account in a tool code
     */
    KisPainter gc(layer->paintDevice());
    setupTemporaryPainter(&gc);

    d->lock.lockForWrite();

    /**
     * Scratchpad may not have an undo adapter
     */
    if(undoAdapter) {
        gc.beginTransaction(transactionText,timedID);
    }
    Q_FOREACH (const QRect &rc, d->temporaryTarget->region().rects()) {
        gc.bitBlt(rc.topLeft(), d->temporaryTarget, rc);
    }
    releaseResources();

    if(undoAdapter) {
        gc.endTransaction(undoAdapter);
    }

    d->lock.unlock();
}
开发者ID:IGLOU-EU,项目名称:krita,代码行数:30,代码来源:kis_indirect_painting_support.cpp

示例13: WinMain

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    PSTR szCmdLine, int nCmdShow)			
{									
    MSG         msg;	

	game = new Game(&backHDC, &frontHDC, &bitmapHDC, &screenRect, &CONTROLS);
	RegisterMyWindow(hInstance);

   	if (!InitialiseMyWindow(hInstance, nCmdShow))
	return FALSE;
	
	setBuffers();
	while (TRUE)					
    {							
		if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
		{
		    if (msg.message==WM_QUIT)
				break;
			TranslateMessage (&msg);							
			DispatchMessage (&msg);
		}

		else
		{	
			if(WaitFor(10))
				game->play();
		}
    }

    releaseResources();
	return msg.wParam ;										
}
开发者ID:Gi133,项目名称:Graphics-Programming-Coursework,代码行数:32,代码来源:main.cpp

示例14: ASSERT

void ResourceLoader::didFail(blink::WebURLLoader*, const blink::WebURLError& error)
{
    m_connectionState = ConnectionStateFailed;
    ASSERT(m_state != Terminated);
    WTF_LOG(ResourceLoading, "Failed to load '%s'.\n", m_resource->url().string().latin1().data());

    RefPtrWillBeRawPtr<ResourceLoader> protect(this);
    RefPtrWillBeRawPtr<ResourceLoaderHost> protectHost(m_host.get());
    ResourcePtr<Resource> protectResource(m_resource);
    m_state = Finishing;
    m_resource->setResourceError(error);

    if (!m_notifiedLoadComplete) {
        m_notifiedLoadComplete = true;
        m_host->didFailLoading(m_resource, error);
    }
    if (m_state == Terminated)
        return;

    m_resource->error(Resource::LoadError);

    if (m_state == Terminated)
        return;

    releaseResources();
}
开发者ID:xin3liang,项目名称:platform_external_chromium_org_third_party_WebKit,代码行数:26,代码来源:ResourceLoader.cpp

示例15: releaseResources

int ProtobufFileWriter::open(const char* filePath, int mode)
{
    releaseResources();
    // Ensure that the parent directory exists.
    Util_CreatePath(filePath, VPL_FALSE);
    fileDescriptor = VPLFile_Open(filePath,
            VPLFILE_OPENFLAG_WRITEONLY | VPLFILE_OPENFLAG_CREATE | VPLFILE_OPENFLAG_TRUNCATE,
            mode);
    if (fileDescriptor < 0) {
        LOG_ERROR("open(%s) returned %d", filePath, fileDescriptor);
        return UTIL_ERR_FOPEN;
    }
#ifdef VPL_PLAT_IS_WINRT
    fileOutStream = new VPLFileOutStream(fileDescriptor);
    outStream = new google::protobuf::io::CopyingOutputStreamAdaptor(fileOutStream);
#else
    outStream = new google::protobuf::io::FileOutputStream(fileDescriptor);
#endif
    if (outStream == NULL) {
        LOG_ERROR("Alloc failed");
        // no need to close the file descriptor here
        return UTIL_ERR_NO_MEM;
    }
    return GVM_OK;
}
开发者ID:iversonjimmy,项目名称:acer_cloud_wifi_copy,代码行数:25,代码来源:protobuf_file_writer.cpp


注:本文中的releaseResources函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。