• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ releaseResources函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: clearGraphicsLayerLinkHighlightPointer

void LinkHighlight::notifyAnimationFinished(double, blink::WebAnimation::TargetProperty)
{
    // Since WebViewImpl may hang on to us for a while, make sure we
    // release resources as soon as possible.
    clearGraphicsLayerLinkHighlightPointer();
    releaseResources();
}
开发者ID:junmin-zhu,项目名称:blink,代码行数:7,代码来源:LinkHighlight.cpp


示例17: releaseResources

HRESULT DXRender::resetDevice()
{
	HRESULT hr = S_OK;

	if (isDeviceReady())
		return D3D_OK;
	
	if (!shouldResetDevice())
		return D3DERR_DEVICELOST;
	
	texMgr->onPowerSuspend();
	menuManager->onRelease();
	scnManager->onRelease();
	hr = releaseResources();
	if (FAILED(hr))
	{
		LOG(QString_NT("Could not release resources after device was lost: hr = %1").arg(hr));
		return hr;
	}
	
	LOG(QString_NT("Started resetting the device"));
	hr = device->Reset(&_dummyDevicePresentationParameters);
	if (FAILED(hr))
	{
		LOG(QString_NT("Could not reset the device: hr = %1").arg(hr));
		if (hr == D3DERR_INVALIDCALL)
		{
			device->AddRef();
			ULONG ref = device->Release();
			LOG(QString_NT("Ref Count: %1").arg(ref));
		}
		return hr;
	}
	LOG(QString_NT("Finished resetting the device"));
	
	LOG(QString_NT("Start recreating resources"));
	hr = recreateResources();
	if (FAILED(hr))
	{
		LOG(QString_NT("Could not recreate resources after device was lost: hr = %1").arg(hr));
		return hr;
	}
	LOG(QString_NT("Finish recreating resources"));

	texMgr->onPowerResume();
	
	ResizeWallsToWorkArea(winOS->GetWindowWidth(), winOS->GetWindowHeight());

	// Recreate the swap chain
	hr = onResize(winOS->GetWindowWidth(), winOS->GetWindowHeight());

	if (SUCCEEDED(hr))
	{
		LOG(QString_NT("%1: Device reset successfully").arg(timeGetTime()));
		_deviceLost = false;
	}
	return hr;
}
开发者ID:DX94,项目名称:BumpTop,代码行数:58,代码来源:BT_DXRender.cpp


示例18: initResources

void RSManager::initResources(bool downsampling, unsigned rw, unsigned rh, unsigned numBBs, D3DFORMAT bbFormat, D3DSWAPEFFECT swapEff, bool autoDepthStencil, D3DFORMAT depthStencilFormat) {
	if(inited) releaseResources();
	SDLOG(0, "RenderstateManager resource initialization started\n");
	this->downsampling = downsampling;
	renderWidth = rw;
	renderHeight = rh;
	numBackBuffers = numBBs;
	bbFormat = bbFormat;
	swapEffect = swapEff == D3DSWAPEFFECT_COPY ? SWAP_COPY : (swapEff == D3DSWAPEFFECT_DISCARD ? SWAP_DISCARD : SWAP_FLIP);
	if(swapEffect == SWAP_FLIP) numBackBuffers++; // account for the "front buffer" in the swap chain
		
	console.initialize(d3ddev, downsampling ? Settings::get().getPresentWidth() : rw, downsampling ? Settings::get().getPresentHeight() : rh);
	Console::setLatest(&console);
	imgWriter = std::unique_ptr<ImageWriter>(new ImageWriter(d3ddev, rw, rh));

	// perf measurement
	console.add(frameTimeText);
	perfMonitor = new D3DPerfMonitor(d3ddev, 120);
	
	// create state block for state save/restore
	d3ddev->CreateStateBlock(D3DSBT_ALL, &prevStateBlock);
	// create and capture default state block
	d3ddev->CreateStateBlock(D3DSBT_ALL, &initStateBlock);
	initStateBlock->Capture();

	// if required, determine depth/stencil surf type and create
	if(downsampling && autoDepthStencil) {
		d3ddev->CreateDepthStencilSurface(rw, rh, depthStencilFormat, D3DMULTISAMPLE_NONE, 0, false, &depthStencilSurf, NULL);
		SDLOG(2, "Generated depth stencil surface - format: %s\n", D3DFormatToString(depthStencilFormat));
		// set our depth stencil surface
		d3ddev->SetDepthStencilSurface(depthStencilSurf);
	}

	if(downsampling) {
		// generate backbuffers
		SDLOG(2, "Generating backbuffers:\n")
		for(unsigned i=0; i<numBackBuffers; ++i) {
			backBuffers.push_back(rtMan->createTexture(rw, rh, backbufferFormat));
			SDLOG(2, "Backbuffer %u: %p\n", i, backBuffers[i]);
		}

		// set back buffer 0 as initial rendertarget
		d3ddev->SetRenderTarget(0, backBuffers[0]->getSurf());
		// generate additional buffer to emulate flip if required
		if(swapEffect == SWAP_FLIP && Settings::get().getEmulateFlipBehaviour()) {
			extraBuffer = rtMan->createSurface(rw, rh, backbufferFormat);
			SDLOG(2, "Extra backbuffer: %p\n", extraBuffer);
		}

		scaler = new Scaler(d3ddev, rw, rh, Settings::get().getPresentWidth(), Settings::get().getPresentHeight());
	}

	plugin = GamePlugin::getPlugin(d3ddev, *this);
	plugin->initialize(rw, rh, bbFormat);
	
	SDLOG(0, "RenderstateManager resource initialization completed\n");
	inited = true;
}
开发者ID:Thomitastic,项目名称:gedosato,代码行数:58,代码来源:renderstate_manager.cpp


示例19: ASSERT

bool ResourceLoader::init(const ResourceRequest& r)
{
    ASSERT(!m_handle);
    ASSERT(m_request.isNull());
    ASSERT(m_deferredRequest.isNull());
    ASSERT(!m_documentLoader->isSubstituteLoadPending(this));
    
    ResourceRequest clientRequest(r);

    m_loadTiming.markStartTimeAndFetchStart();

#if PLATFORM(IOS)
    // If the documentLoader was detached while this ResourceLoader was waiting its turn
    // in ResourceLoadScheduler queue, don't continue.
    if (!m_documentLoader->frame()) {
        cancel();
        return false;
    }
#endif
    
    m_defersLoading = m_options.defersLoadingPolicy == DefersLoadingPolicy::AllowDefersLoading && m_frame->page()->defersLoading();

    if (m_options.securityCheck == DoSecurityCheck && !m_frame->document()->securityOrigin()->canDisplay(clientRequest.url())) {
        FrameLoader::reportLocalLoadFailed(m_frame.get(), clientRequest.url().string());
        releaseResources();
        return false;
    }
    
    // https://bugs.webkit.org/show_bug.cgi?id=26391
    // The various plug-in implementations call directly to ResourceLoader::load() instead of piping requests
    // through FrameLoader. As a result, they miss the FrameLoader::addExtraFieldsToRequest() step which sets
    // up the 1st party for cookies URL. Until plug-in implementations can be reigned in to pipe through that
    // method, we need to make sure there is always a 1st party for cookies set.
    if (clientRequest.firstPartyForCookies().isNull()) {
        if (Document* document = m_frame->document())
            clientRequest.setFirstPartyForCookies(document->firstPartyForCookies());
    }

    willSendRequestInternal(clientRequest, ResourceResponse());

#if PLATFORM(IOS)
    // If this ResourceLoader was stopped as a result of willSendRequest, bail out.
    if (m_reachedTerminalState)
        return false;
#endif

    if (clientRequest.isNull()) {
        cancel();
        return false;
    }

    m_originalRequest = m_request = clientRequest;
    return true;
}
开发者ID:endlessm,项目名称:WebKit,代码行数:54,代码来源:ResourceLoader.cpp


示例20: job

/**
 * \brief Function to get the status of the job
 * \param jobJsonSerialized the job structure encoded in json
 * \return -1 if the job is unknown or server not unavailable
 */
int
OpenNebulaServer::getJobState(const std::string& jobSerialized) {

  int jobStatus = vishnu::STATE_UNDEFINED;

  // Get input job infos
  JsonObject job(jobSerialized);
  std::string jobId = job.getStringProperty("jobid");
  std::string pid = job.getStringProperty("batchjobid");
  std::string owner = job.getStringProperty("owner");
  std::string vmId = job.getStringProperty("vmid");
  std::string vmIp = job.getStringProperty("vmip");

  if (! vmIp.empty()) {
    // retrive vm info
    VmT vmInfo;
    OneCloudInstance cloudInstance(mcloudEndpoint, getSessionString());

    if (cloudInstance.loadVmInfo(vishnu::convertToInt(vmId), vmInfo) == 0) {
      switch (vmInfo.state) {
        case VM_ACTIVE:
          monitorScriptState(jobId, vmIp, owner, pid, jobStatus);
          break;
        case VM_POWEROFF:
        case VM_FAILED:
        case VM_STOPPED:
        case VM_DONE:
          jobStatus = vishnu::STATE_FAILED;
          break;
        case VM_INIT:
        case VM_HOLD:
        case VM_UNDEPLOYED:
          jobStatus = vishnu::STATE_SUBMITTED;
        default:
          break;
      }
    }
    if (jobStatus == vishnu::STATE_CANCELLED
        || jobStatus == vishnu::STATE_COMPLETED
        || jobStatus == vishnu::STATE_FAILED) {

      LOG(boost::str(boost::format("[WARN] Cleaning job %1%; Status: %2%; VM ID: %3%; VM State: %4%.")
                     % jobId % vishnu::convertJobStateToString(jobStatus) % vmId % vmState2String(vmInfo.state)),
          LogWarning);

      releaseResources(vmId);
    }
  } else {
    LOG(boost::str(boost::format("[WARN] Unable to monitor job: %1%, VMID: %2%."
                                 " Empty vm address") % jobId % vmId), LogWarning);
    jobStatus = vishnu::STATE_UNDEFINED;
  }
  return jobStatus;
}
开发者ID:SysFera,项目名称:vishnu,代码行数:59,代码来源:OpenNebulaServer.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ release_and_free_resource函数代码示例发布时间:2022-05-30
下一篇:
C++ releaseOutPorts函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap