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(); }
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() ? cancelledError() : 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_handle) { m_handle->cancel(); m_handle = 0; } if (m_options.sendLoadCallbacks == SendCallbacks && !m_notifiedLoadComplete) frameLoader()->notifier()->dispatchDidFail(m_documentLoader.get(), m_resource->identifier(), nonNullError); if (m_state == Finishing) m_resource->error(CachedResource::LoadError); if (m_state != Terminated) 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; }
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(); }
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; }
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; }
void SubresourceLoader::didFinishLoading(double finishTime) { if (m_state != Initialized) return; ASSERT(!reachedTerminalState()); ASSERT(!m_resource->resourceToRevalidate()); // FIXME (129394): We should cancel the load when a decode error occurs instead of continuing the load to completion. ASSERT(!m_resource->errorOccurred() || m_resource->status() == CachedResource::DecodeError); LOG(ResourceLoading, "Received '%s'.", m_resource->url().string().latin1().data()); logResourceLoaded(m_frame.get(), m_resource->type()); Ref<SubresourceLoader> protectedThis(*this); 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(); }
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; }
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(); }
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(); }
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(); } }
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_defersLoading = 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()); } willSendRequest(clientRequest, ResourceResponse()); if (clientRequest.isNull()) { cancel(); return false; } m_originalRequest = m_request = clientRequest; return true; }
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(); }
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; }
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); CachedResourceHandle<CachedResource> protectResource(m_resource); m_state = Finishing; m_activityAssertion.clear(); m_resource->setLoadFinishTime(finishTime); m_resource->finishLoading(resourceData()); if (wasCancelled()) return; m_resource->finish(); ASSERT(!reachedTerminalState()); didFinishLoadingOnePart(finishTime); notifyDone(); if (reachedTerminalState()) return; releaseResources(); }
//============================================================================== void Processor::prepareToPlay(double /*sampleRate*/, int samplesPerBlock) { // Play safe to be clean releaseResources(); // Prepare convolvers { juce::ScopedLock convolverLock(_convolverMutex); _convolverHeadBlockSize = 1; while (_convolverHeadBlockSize < static_cast<size_t>(samplesPerBlock)) { _convolverHeadBlockSize *= 2; } _convolverTailBlockSize = std::max(size_t(8192), 2 * _convolverHeadBlockSize); } // Prepare convolution buffers _wetBuffer.setSize(2, samplesPerBlock); _convolutionBuffer.resize(samplesPerBlock); // Initialize parameters _stereoWidth.initializeWidth(getParameter(Parameters::StereoWidth)); // Initialize IR agents for (size_t i=0; i<_agents.size(); ++i) { _agents[i]->initialize(); } notifyAboutChange(); updateConvolvers(); }
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(); }
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 ; }
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(); }
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; }
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(); }
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; }
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; }
CDirectXInputLayer::~CDirectXInputLayer() { releaseResources(); if (mDInputInterface) { mDInputInterface->Release(); mDInputInterface = NULL; } }
CDirectXRenderLayer::~CDirectXRenderLayer() { releaseResources(); if (mD3DInterface) { mD3DInterface->Release(); mD3DInterface = NULL; } }
void ResourceLoader::didFinishLoading(double finishTime) { didFinishLoadingOnePart(finishTime); // If the load has been cancelled by a delegate in response to didFinishLoad(), do not release // the resources a second time, they have been released by cancel. if (m_cancelled) return; releaseResources(); }
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; }
/** * \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; }
void ResourceLoader::cancel(const ResourceError& error) { // If the load has already completed - succeeded, failed, or previously cancelled - do nothing. if (m_reachedTerminalState) return; ResourceError nonNullError = error.isNull() ? cancelledError() : error; // willCancel() and didFailToLoad() both call out to clients that might do // something causing the last reference to this object to go away. RefPtr<ResourceLoader> protector(this); // If we re-enter cancel() from inside willCancel(), we want to pick up from where we left // off without re-running willCancel() if (!m_calledWillCancel) { m_calledWillCancel = true; willCancel(nonNullError); } // If we re-enter cancel() from inside didFailToLoad(), we want to pick up from where we // left off without redoing any of this work. if (!m_cancelled) { m_cancelled = true; if (FormData* data = m_request.httpBody()) data->removeGeneratedFilesIfNeeded(); if (m_handle) m_handle->clearAuthentication(); m_documentLoader->cancelPendingSubstituteLoad(this); if (m_handle) { m_handle->cancel(); m_handle = 0; } if (m_options.sendLoadCallbacks == SendCallbacks && m_identifier && !m_notifiedLoadComplete) { ActionLogScope log_scope( String::format("cancel_fail:%s", m_request.url().lastPathComponent().ascii().data()).ascii().data()); frameLoader()->notifier()->didFailToLoad(this, nonNullError); } } // If cancel() completed from within the call to willCancel() or didFailToLoad(), // we don't want to redo didCancel() or releasesResources(). if (m_reachedTerminalState) return; didCancel(nonNullError); releaseResources(); }
void ResourceLoader::didFinishLoading() { // If load has been cancelled after finishing (which could happen with a // JavaScript that changes the window location), do nothing. if (m_cancelled) return; ASSERT(!m_reachedTerminalState); didFinishLoadingOnePart(); releaseResources(); }