您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ EnsureInitialized函数代码示例

51自学网 2021-06-01 20:38:20
  C++
这篇教程C++ EnsureInitialized函数代码示例写得很实用,希望能帮到您。

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

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

示例1: EnsureInitialized

NS_IMETHODIMP nsAbBSDirectory::GetChildNodes(nsISimpleEnumerator* *aResult){  nsresult rv = EnsureInitialized();  NS_ENSURE_SUCCESS(rv, rv);  return NS_NewArrayEnumerator(aResult, mSubDirectories);}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:7,


示例2: MOZ_ASSERT

TemporaryRef<SharedThreadPool>SharedThreadPool::Get(const nsCString& aName, uint32_t aThreadLimit){  MOZ_ASSERT(NS_IsMainThread());  EnsureInitialized();  MOZ_ASSERT(sMonitor);  ReentrantMonitorAutoEnter mon(*sMonitor);  SharedThreadPool* pool = nullptr;  nsresult rv;  if (!sPools->Get(aName, &pool)) {    nsCOMPtr<nsIThreadPool> threadPool(CreateThreadPool(aName));    NS_ENSURE_TRUE(threadPool, nullptr);    pool = new SharedThreadPool(aName, threadPool);    // Set the thread and idle limits. Note that we don't rely on the    // EnsureThreadLimitIsAtLeast() call below, as the default thread limit    // is 4, and if aThreadLimit is less than 4 we'll end up with a pool    // with 4 threads rather than what we expected; so we'll have unexpected    // behaviour.    rv = pool->SetThreadLimit(aThreadLimit);    NS_ENSURE_SUCCESS(rv, nullptr);    rv = pool->SetIdleThreadLimit(aThreadLimit);    NS_ENSURE_SUCCESS(rv, nullptr);    sPools->Put(aName, pool);  } else if (NS_FAILED(pool->EnsureThreadLimitIsAtLeast(aThreadLimit))) {    NS_WARNING("Failed to set limits on thread pool");  }  MOZ_ASSERT(pool);  RefPtr<SharedThreadPool> instance(pool);  return instance.forget();}
开发者ID:AOSC-Dev,项目名称:Pale-Moon,代码行数:34,


示例3: _tprintf

HRESULT Service_Monitor::GetServiceHandle(LPCTSTR pServiceName, SC_HANDLE* pHandle){    HRESULT hr = S_OK;    if (pServiceName == NULL)    {        _tprintf(L"/nERROR: Null parameter for GetServiceHandle()/n");        hr = HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER);        goto Finished;    }    hr = EnsureInitialized();    if (SUCCEEDED(hr))    {        *pHandle = OpenService(_hSCManager, pServiceName, SERVICE_START | SERVICE_STOP | SERVICE_QUERY_STATUS);        if (*pHandle == NULL)        {            hr = HRESULT_FROM_WIN32(GetLastError());            goto Finished;        }    }Finished:    return hr;}
开发者ID:jawn,项目名称:IIS.ServiceMonitor,代码行数:25,


示例4: EnsureInitialized

NS_IMETHODIMPGfxInfo::GetAdapterDriverDate(nsAString & aAdapterDriverDate){  EnsureInitialized();  aAdapterDriverDate.Truncate();  return NS_OK;}
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:7,


示例5: NS_URIChainHasFlags

NS_IMETHODIMPnsCookiePermission::CanAccess(nsIURI         *aURI,                              nsIChannel     *aChannel,                              nsCookieAccess *aResult){  // Check this protocol doesn't allow cookies  bool hasFlags;  nsresult rv =    NS_URIChainHasFlags(aURI, nsIProtocolHandler::URI_FORBIDS_COOKIE_ACCESS,                        &hasFlags);  if (NS_FAILED(rv) || hasFlags) {    *aResult = ACCESS_DENY;    return NS_OK;  }  // Lazily initialize ourselves  if (!EnsureInitialized())    return NS_ERROR_UNEXPECTED;  // finally, check with permission manager...  rv = mPermMgr->TestPermission(aURI, kPermissionType, (uint32_t *) aResult);  if (NS_SUCCEEDED(rv)) {    if (*aResult == nsICookiePermission::ACCESS_SESSION) {      *aResult = nsICookiePermission::ACCESS_ALLOW;    }  }  return rv;}
开发者ID:ajkerrigan,项目名称:gecko-dev,代码行数:29,


示例6: Start

Result HDevice::Start(){	HRESULT hr;	if (!EnsureInitialized(L"Start") ||	    !EnsureInactive(L"Start"))		return Result::Error;	if (!!rocketEncoder)		Sleep(ROCKET_WAIT_TIME_MS);	hr = control->Run();	if (FAILED(hr)) {		if (hr == (HRESULT)0x8007001F) {			WarningHR(L"Run failed, device already in use", hr);			return Result::InUse;		} else {			WarningHR(L"Run failed", hr);			return Result::Error;		}	}	active = true;	return Result::Success;}
开发者ID:Inner-room,项目名称:libdshowcapture,代码行数:26,


示例7: SetAudioConfig

bool HDevice::SetAudioConfig(AudioConfig *config){	ComPtr<IBaseFilter> filter;	if (!EnsureInitialized(L"SetAudioConfig") ||	    !EnsureInactive(L"SetAudioConfig"))		return false;	if (!audioConfig.useVideoDevice)		graph->RemoveFilter(audioFilter);	graph->RemoveFilter(audioCapture);	graph->RemoveFilter(audioOutput);	audioFilter.Release();	audioCapture.Release();	audioOutput.Release();	audioMediaType = NULL;	if (!config)		return true;	if (!config->useVideoDevice &&	    config->name.empty() && config->path.empty()) {		Error(L"No audio device name or path specified");		return false;	}	if (config->useVideoDevice) {		if (videoFilter == NULL) {			Error(L"Tried to use video device's built-in audio, "			      L"but no video device is present");			return false;		}		filter = videoFilter;	} else {		bool success = GetDeviceFilter(CLSID_AudioInputDeviceCategory,				config->name.c_str(), config->path.c_str(),				&filter);		if (!success) {			Error(L"Audio device '%s': %s not found", config->name.c_str(),					config->path.c_str());			return false;		}	}	if (filter == NULL)		return false;	audioConfig = *config;	if (config->mode == AudioMode::Capture) {		if (!SetupAudioCapture(filter, audioConfig))			return false;		*config = audioConfig;		return true;	}	return SetupAudioOutput(filter, audioConfig);}
开发者ID:Inner-room,项目名称:libdshowcapture,代码行数:60,


示例8: GetAndroidUsage

intAndroidGraphicBuffer::Lock(uint32_t aUsage, unsigned char **bits){  if (!EnsureInitialized())    return true;  return sGLFunctions.fGraphicBufferLock(mHandle, GetAndroidUsage(aUsage), bits);}
开发者ID:drexler,项目名称:releases-mozilla-aurora,代码行数:8,


示例9:

intAndroidGraphicBuffer::Unlock(){  if (!EnsureInitialized())    return false;  return sGLFunctions.fGraphicBufferUnlock(mHandle);}
开发者ID:drexler,项目名称:releases-mozilla-aurora,代码行数:8,


示例10: EnsureInitialized

NS_IMETHODIMPnsIEHistoryEnumerator::HasMoreElements(bool* _retval){  *_retval = false;  EnsureInitialized();  MOZ_ASSERT(mURLEnumerator, "Should have instanced an IE History URLEnumerator");  if (!mURLEnumerator)    return NS_OK;  STATURL statURL;  ULONG fetched;  // First argument is not implemented, so doesn't matter what we pass.  HRESULT hr = mURLEnumerator->Next(1, &statURL, &fetched);  if (FAILED(hr) || fetched != 1UL) {    // Reached the last entry.    return NS_OK;  }  nsCOMPtr<nsIURI> uri;  if (statURL.pwcsUrl) {    nsDependentString url(statURL.pwcsUrl);    nsresult rv = NS_NewURI(getter_AddRefs(uri), url);    ::CoTaskMemFree(statURL.pwcsUrl);    if (NS_FAILED(rv)) {      // Got a corrupt or invalid URI, continue to the next entry.      return HasMoreElements(_retval);    }  }  nsDependentString title(statURL.pwcsTitle ? statURL.pwcsTitle : L"");  bool lastVisitTimeIsValid;  PRTime lastVisited = WinMigrationFileTimeToPRTime(&(statURL.ftLastVisited), &lastVisitTimeIsValid);  mCachedNextEntry = do_CreateInstance("@mozilla.org/hash-property-bag;1");  MOZ_ASSERT(mCachedNextEntry, "Should have instanced a new property bag");  if (mCachedNextEntry) {    mCachedNextEntry->SetPropertyAsInterface(NS_LITERAL_STRING("uri"), uri);    mCachedNextEntry->SetPropertyAsAString(NS_LITERAL_STRING("title"), title);    if (lastVisitTimeIsValid) {      mCachedNextEntry->SetPropertyAsInt64(NS_LITERAL_STRING("time"), lastVisited);    }    *_retval = true;  }  if (statURL.pwcsTitle)    ::CoTaskMemFree(statURL.pwcsTitle);  return NS_OK;}
开发者ID:escapewindow,项目名称:gecko-dev,代码行数:53,


示例11:

boolGLXLibrary::SupportsTextureFromPixmap(gfxASurface* aSurface){    if (!EnsureInitialized(mLibType)) {        return false;    }        if (aSurface->GetType() != gfxSurfaceTypeXlib || !mUseTextureFromPixmap) {        return false;    }    return true;}
开发者ID:huili2,项目名称:gecko-dev,代码行数:13,


示例12: NS_ENSURE_ARG_POINTER

NS_IMETHODIMP nsAbBSDirectory::DeleteDirectory(nsIAbDirectory *directory){  NS_ENSURE_ARG_POINTER(directory);  nsresult rv = EnsureInitialized();  NS_ENSURE_SUCCESS(rv, rv);  DIR_Server *server = nsnull;  mServers.Get(directory, &server);  if (!server)    return NS_ERROR_FAILURE;  GetDirectories getDirectories(server);  mServers.EnumerateRead(GetDirectories_getDirectory,                         (void*)&getDirectories);  DIR_DeleteServerFromList(server);  nsCOMPtr<nsIAbDirFactoryService> dirFactoryService =     do_GetService(NS_ABDIRFACTORYSERVICE_CONTRACTID,&rv);  NS_ENSURE_SUCCESS (rv, rv);  PRUint32 count = getDirectories.directories.Count();  nsCOMPtr<nsIAbManager> abManager = do_GetService(NS_ABMANAGER_CONTRACTID);  for (PRUint32 i = 0; i < count; i++) {    nsCOMPtr<nsIAbDirectory> d = getDirectories.directories[i];    mServers.Remove(d);    rv = mSubDirectories.RemoveObject(d);    if (abManager)      abManager->NotifyDirectoryDeleted(this, d);    nsCOMPtr<nsIRDFResource> resource(do_QueryInterface (d, &rv));    nsCString uri;    resource->GetValueUTF8(uri);    nsCOMPtr<nsIAbDirFactory> dirFactory;    rv = dirFactoryService->GetDirFactory(uri, getter_AddRefs(dirFactory));    if (NS_FAILED(rv))      continue;    rv = dirFactory->DeleteDirectory(d);  }  return rv;}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:50,


示例13: ensureNoGLError

boolAndroidGraphicBuffer::Bind(){  if (!EnsureInitialized())    return false;  if (!EnsureEGLImage()) {    LOG("No valid EGLImage!");    return false;  }  clearGLError();  sGLFunctions.fImageTargetTexture2DOES(GL_TEXTURE_2D, mEGLImage);  return ensureNoGLError("glEGLImageTargetTexture2DOES");}
开发者ID:drexler,项目名称:releases-mozilla-aurora,代码行数:15,


示例14:

NS_IMETHODIMPnsCookiePermission::SetAccess(nsIURI         *aURI,                              nsCookieAccess  aAccess){  // Lazily initialize ourselves  if (!EnsureInitialized())    return NS_ERROR_UNEXPECTED;  //  // NOTE: nsCookieAccess values conveniently match up with  //       the permission codes used by nsIPermissionManager.  //       this is nice because it avoids conversion code.  //  return mPermMgr->Add(aURI, kPermissionType, aAccess,                       nsIPermissionManager::EXPIRE_NEVER, 0);}
开发者ID:FunkyVerb,项目名称:devtools-window,代码行数:16,


示例15: EnsureInitialized

HRESULT CKpInternetStream::ReadPartial(BYTE* pbBuffer, UINT64 uCount,	UINT64* puRead){	EnsureInitialized();	if(m_hFile == NULL) { if(puRead != NULL) *puRead = 0; return STG_E_INVALIDHANDLE; }	if(pbBuffer == NULL) CKPIS_R_FAIL(E_POINTER);	if(uCount > static_cast<UINT64>(DWORD_MAX)) CKPIS_R_FAIL(E_INVALIDARG);	DWORD dwRead = 0;	const BOOL bRes = InternetReadFile(m_hFile, pbBuffer, static_cast<DWORD>(		uCount), &dwRead);	if(bRes == FALSE) CKPIS_R_FAIL(STG_E_READFAULT);	if(puRead != NULL) *puRead = dwRead;	return S_OK;}
开发者ID:xt9852,项目名称:KeePassXT,代码行数:17,


示例16: RenderFilters

bool HDevice::RenderFilters(const GUID &category, const GUID &type,		IBaseFilter *filter, IBaseFilter *capture){	HRESULT hr;	if (!EnsureInitialized(L"HDevice::RenderFilters") ||	    !EnsureInactive(L"HDevice::RenderFilters"))		return false;	hr = builder->RenderStream(&category, &type, filter, NULL, capture);	if (FAILED(hr)) {		WarningHR(L"HDevice::ConnectFilters: RenderStream failed", hr);		return false;	}	return true;}
开发者ID:Inner-room,项目名称:libdshowcapture,代码行数:17,


示例17: NS_URIChainHasFlags

NS_IMETHODIMPnsCookiePermission::CanAccess(nsIURI         *aURI,                              nsIChannel     *aChannel,                              nsCookieAccess *aResult){  // Check this protocol doesn't allow cookies  bool hasFlags;  nsresult rv =    NS_URIChainHasFlags(aURI, nsIProtocolHandler::URI_FORBIDS_COOKIE_ACCESS,                        &hasFlags);  if (NS_FAILED(rv) || hasFlags) {    *aResult = ACCESS_DENY;    return NS_OK;  }  // Lazily initialize ourselves  if (!EnsureInitialized())    return NS_ERROR_UNEXPECTED;  // finally, check with permission manager...  rv = mPermMgr->TestPermission(aURI, kPermissionType, (PRUint32 *) aResult);  if (NS_SUCCEEDED(rv)) {    switch (*aResult) {    // if we have one of the publicly-available values, just return it    case nsIPermissionManager::UNKNOWN_ACTION: // ACCESS_DEFAULT    case nsIPermissionManager::ALLOW_ACTION:   // ACCESS_ALLOW    case nsIPermissionManager::DENY_ACTION:    // ACCESS_DENY      break;    // ACCESS_SESSION means the cookie can be accepted; the session     // downgrade will occur in CanSetCookie().    case nsICookiePermission::ACCESS_SESSION:      *aResult = ACCESS_ALLOW;      break;    // ack, an unknown type! just use the defaults.    default:      *aResult = ACCESS_DEFAULT;    }  }  return rv;}
开发者ID:FunkyVerb,项目名称:devtools-window,代码行数:43,


示例18: SPADES_MARK_FUNCTION

		void SWRenderer::SetGameMap(client::GameMap *map) {			SPADES_MARK_FUNCTION();			if(map)				EnsureInitialized();			if(map == this->map)				return;						flatMapRenderer.reset();			mapRenderer.reset();						if(this->map)				this->map->RemoveListener(this);			this->map = map;			if(this->map) {				this->map->AddListener(this);				flatMapRenderer = std::make_shared<SWFlatMapRenderer>(this, map);				mapRenderer = std::make_shared<SWMapRenderer>(this, map, featureLevel);			}		}
开发者ID:panoptics,项目名称:openspades,代码行数:19,


示例19: SetVideoConfig

bool HDevice::SetVideoConfig(VideoConfig *config){	ComPtr<IBaseFilter> filter;	if (!EnsureInitialized(L"SetVideoConfig") ||	    !EnsureInactive(L"SetVideoConfig"))		return false;	videoMediaType = NULL;	graph->RemoveFilter(videoFilter);	graph->RemoveFilter(videoCapture);	videoFilter.Release();	videoCapture.Release();	if (!config)		return true;	if (config->name.empty() && config->path.empty()) {		Error(L"No video device name or path specified");		return false;	}	bool success = GetDeviceFilter(CLSID_VideoInputDeviceCategory,			config->name.c_str(), config->path.c_str(), &filter);	if (!success) {		Error(L"Video device '%s': %s not found", config->name.c_str(),				config->path.c_str());		return false;	}	if (filter == NULL) {		Error(L"Could not get video filter");		return false;	}	videoConfig = *config;	if (!SetupVideoCapture(filter, videoConfig))		return false;	*config = videoConfig;	return true;}
开发者ID:Inner-room,项目名称:libdshowcapture,代码行数:43,


示例20: ConnectFilters

bool HDevice::ConnectFilters(){	bool success = true;	if (!EnsureInitialized(L"ConnectFilters") ||	    !EnsureInactive(L"ConnectFilters"))		return false;	if (videoCapture != NULL) {		success = ConnectPins(PIN_CATEGORY_CAPTURE,				MEDIATYPE_Video, videoFilter,				videoCapture);		if (!success) {			success = RenderFilters(PIN_CATEGORY_CAPTURE,					MEDIATYPE_Video, videoFilter,					videoCapture);		}	}	if ((audioCapture || audioOutput) && success) {		IBaseFilter *filter = (audioCapture != nullptr) ?			audioCapture.Get() : audioOutput.Get();		if (audioCapture != nullptr)			SetAudioBuffering(10);		success = ConnectPins(PIN_CATEGORY_CAPTURE,				MEDIATYPE_Audio, audioFilter,				filter);		if (!success) {			success = RenderFilters(PIN_CATEGORY_CAPTURE,					MEDIATYPE_Audio, audioFilter,					filter);		}	}	if (success)		LogFilters(graph);	return success;}
开发者ID:Inner-room,项目名称:libdshowcapture,代码行数:41,


示例21: DestroyBuffer

boolAndroidGraphicBuffer::Reallocate(uint32_t aWidth, uint32_t aHeight, gfxImageFormat aFormat){  if (!EnsureInitialized())    return false;  mWidth = aWidth;  mHeight = aHeight;  mFormat = aFormat;  // Sometimes GraphicBuffer::reallocate just doesn't work. In those cases we'll just allocate a brand  // new buffer. If reallocate fails once, never try it again.  if (!gTryRealloc || sGLFunctions.fGraphicBufferReallocate(mHandle, aWidth, aHeight, GetAndroidFormat(aFormat)) != 0) {    DestroyBuffer();    EnsureBufferCreated();    gTryRealloc = false;  }  return true;}
开发者ID:drexler,项目名称:releases-mozilla-aurora,代码行数:21,



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


C++ EnsureVisible函数代码示例
C++ EnsureInit函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。