本文整理汇总了C++中IsClosed函数的典型用法代码示例。如果您正苦于以下问题:C++ IsClosed函数的具体用法?C++ IsClosed怎么用?C++ IsClosed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsClosed函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Assert
BackgroundJobProcessor::~BackgroundJobProcessor()
{
// This should appear to be called from the same thread from which this instance was created
Assert(IsClosed());
if (parallelThreadData)
{
for (unsigned int i = 0; i < this->threadCount; i++)
{
HeapDelete(parallelThreadData[i]);
}
HeapDeleteArray(this->maxThreadCount, parallelThreadData);
}
}
示例2: promise
already_AddRefed<Promise>
MediaKeySession::Update(const ArrayBufferViewOrArrayBuffer& aResponse, ErrorResult& aRv)
{
nsRefPtr<DetailedPromise> promise(MakePromise(aRv));
if (aRv.Failed()) {
return nullptr;
}
nsTArray<uint8_t> data;
if (IsClosed() || !mKeys->GetCDMProxy()) {
promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR,
NS_LITERAL_CSTRING("Session is closed or was not properly initialized"));
EME_LOG("MediaKeySession[%p,'%s'] Update() failed, session is closed or was not properly initialised.",
this, NS_ConvertUTF16toUTF8(mSessionId).get());
return promise.forget();
}
if (!CopyArrayBufferViewOrArrayBufferData(aResponse, data)) {
promise->MaybeReject(NS_ERROR_DOM_INVALID_ACCESS_ERR,
NS_LITERAL_CSTRING("Invalid response buffer"));
EME_LOG("MediaKeySession[%p,'%s'] Update() failed, invalid response buffer",
this, NS_ConvertUTF16toUTF8(mSessionId).get());
return promise.forget();
}
#ifdef PR_LOGGING
// Convert response to base64 for easier logging.
// Note: UpdateSession() Move()s the data out of the array, so we have
// to copy it here.
nsAutoCString base64Response;
nsDependentCSubstring rawResponse(reinterpret_cast<const char*>(data.Elements()),
data.Length());
if (NS_FAILED(Base64Encode(rawResponse, base64Response))) {
NS_WARNING("Failed to base64 encode response for logging");
}
#endif
PromiseId pid = mKeys->StorePromise(promise);
mKeys->GetCDMProxy()->UpdateSession(mSessionId,
pid,
data);
EME_LOG("MediaKeySession[%p,'%s'] Update() sent to CDM, "
"promiseId=%d Response(base64)='%s'",
this,
NS_ConvertUTF16toUTF8(mSessionId).get(),
pid,
base64Response.get());
return promise.forget();
}
示例3: IsContinuous
bool ON_ArcCurve::IsContinuous(
ON::continuity c,
double t,
int*, // hint - formal parameter intentionally ignored in this virtual function
double, // point_tolerance - formal parameter intentionally ignored in this virtual function
double, // d1_tolerance - formal parameter intentionally ignored in this virtual function
double, // d2_tolerance - formal parameter intentionally ignored in this virtual function
double, // cos_angle_tolerance - formal parameter intentionally ignored in this virtual function
double // curvature_tolerance - formal parameter intentionally ignored in this virtual function
) const
{
// 20 March 2003 Dale Lear
// Added this override of IsContinuous() to
// speed queries and support the
// locus favors of ON::continuity.
bool rc = true;
if ( !IsClosed() )
{
switch(c)
{
case ON::unknown_continuity:
case ON::C0_continuous:
case ON::C1_continuous:
case ON::C2_continuous:
case ON::G1_continuous:
case ON::G2_continuous:
case ON::Cinfinity_continuous:
case ON::Gsmooth_continuous:
// rc = true;
break;
case ON::C0_locus_continuous:
case ON::C1_locus_continuous:
case ON::C2_locus_continuous:
case ON::G1_locus_continuous:
case ON::G2_locus_continuous:
// open arc is locus discontinuous at end parameter.
// By convention (see ON::continuity comments) it
// is locus continuous at start parameter.
if ( t >= Domain()[1] )
rc = false;
break;
}
}
return rc;
}
示例4:
NS_IMETHODIMP
nsBaseContentStream::ReadSegments(nsWriteSegmentFun fun, void *closure,
PRUint32 count, PRUint32 *result)
{
*result = 0;
if (mStatus == NS_BASE_STREAM_CLOSED)
return NS_OK;
// No data yet
if (!IsClosed() && IsNonBlocking())
return NS_BASE_STREAM_WOULD_BLOCK;
return mStatus;
}
示例5: IsAtSeam
int ON_Surface::IsAtSeam(double s, double t) const
{
int rc = 0;
int i;
for (i=0; i<2; i++){
if (!IsClosed(i))
continue;
double p = (i) ? t : s;
if (p == Domain(i)[0] || p == Domain(i)[1])
rc += (i+1);
}
return rc;
}
示例6: Assert
void BackgroundJobProcessor::AddJob(Job *const job, const bool prioritize)
{
// This function is called from inside the lock
Assert(job);
Assert(managers.Contains(job->Manager()));
Assert(!IsClosed());
if(numJobs + 1 == 0)
Js::Throw::OutOfMemory(); // Overflow: job counts we use are int32's.
++numJobs;
__super::AddJob(job, prioritize);
IndicateNewJob();
}
示例7: promise
already_AddRefed<Promise>
MediaKeySession::Close(ErrorResult& aRv)
{
nsRefPtr<Promise> promise(mKeys->MakePromise(aRv));
if (aRv.Failed()) {
return nullptr;
}
if (IsClosed() || !mKeys->GetCDMProxy()) {
promise->MaybeResolve(JS::UndefinedHandleValue);
return promise.forget();
}
mKeys->GetCDMProxy()->CloseSession(mSessionId, mKeys->StorePromise(promise));
return promise.forget();
}
示例8: NS_ASSERTION
// static
IndexedDatabaseManager*
IndexedDatabaseManager::GetOrCreate()
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
if (IsClosed()) {
NS_ERROR("Calling GetOrCreate() after shutdown!");
return nullptr;
}
if (!gDBManager) {
sIsMainProcess = XRE_IsParentProcess();
if (sIsMainProcess && Preferences::GetBool("disk_space_watcher.enabled", false)) {
// See if we're starting up in low disk space conditions.
nsCOMPtr<nsIDiskSpaceWatcher> watcher =
do_GetService(DISKSPACEWATCHER_CONTRACTID);
if (watcher) {
bool isDiskFull;
if (NS_SUCCEEDED(watcher->GetIsDiskFull(&isDiskFull))) {
sLowDiskSpaceMode = isDiskFull;
}
else {
NS_WARNING("GetIsDiskFull failed!");
}
}
else {
NS_WARNING("No disk space watcher component available!");
}
}
RefPtr<IndexedDatabaseManager> instance(new IndexedDatabaseManager());
nsresult rv = instance->Init();
NS_ENSURE_SUCCESS(rv, nullptr);
if (gInitialized.exchange(true)) {
NS_ERROR("Initialized more than once?!");
}
gDBManager = instance;
ClearOnShutdown(&gDBManager);
}
return gDBManager;
}
示例9: promise
already_AddRefed<Promise>
MediaKeySession::Close(ErrorResult& aRv)
{
RefPtr<DetailedPromise> promise(MakePromise(aRv,
NS_LITERAL_CSTRING("MediaKeySession.close")));
if (aRv.Failed()) {
return nullptr;
}
// 1. Let session be the associated MediaKeySession object.
// 2. If session is closed, return a resolved promise.
if (IsClosed()) {
EME_LOG("MediaKeySession[%p,'%s'] Close() already closed",
this, NS_ConvertUTF16toUTF8(mSessionId).get());
promise->MaybeResolveWithUndefined();
return promise.forget();
}
// 3. If session's callable value is false, return a promise rejected
// with an InvalidStateError.
if (!IsCallable()) {
EME_LOG("MediaKeySession[%p,''] Close() called before sessionId set by CDM", this);
promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR,
NS_LITERAL_CSTRING("MediaKeySession.Close() called before sessionId set by CDM"));
return promise.forget();
}
if (!mKeys->GetCDMProxy()) {
EME_LOG("MediaKeySession[%p,'%s'] Close() null CDMProxy",
this, NS_ConvertUTF16toUTF8(mSessionId).get());
promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR,
NS_LITERAL_CSTRING("MediaKeySession.Close() lost reference to CDM"));
return promise.forget();
}
// 4. Let promise be a new promise.
PromiseId pid = mKeys->StorePromise(promise);
// 5. Run the following steps in parallel:
// 5.1 Let cdm be the CDM instance represented by session's cdm instance value.
// 5.2 Use cdm to close the session associated with session.
mKeys->GetCDMProxy()->CloseSession(mSessionId, pid);
EME_LOG("MediaKeySession[%p,'%s'] Close() sent to CDM, promiseId=%d",
this, NS_ConvertUTF16toUTF8(mSessionId).get(), pid);
// Session Closed algorithm is run when CDM causes us to run OnSessionClosed().
// 6. Return promise.
return promise.forget();
}
示例10: CSegment
const OPT<SHAPE_LINE_CHAIN::INTERSECTION> SHAPE_LINE_CHAIN::SelfIntersecting() const
{
for( int s1 = 0; s1 < SegmentCount(); s1++ )
{
for( int s2 = s1 + 1; s2 < SegmentCount(); s2++ )
{
const VECTOR2I s2a = CSegment( s2 ).A, s2b = CSegment( s2 ).B;
if( s1 + 1 != s2 && CSegment( s1 ).Contains( s2a ) )
{
INTERSECTION is;
is.our = CSegment( s1 );
is.their = CSegment( s2 );
is.p = s2a;
return is;
}
else if( CSegment( s1 ).Contains( s2b ) &&
// for closed polylines, the ending point of the
// last segment == starting point of the first segment
// this is a normal case, not self intersecting case
!( IsClosed() && s1 == 0 && s2 == SegmentCount()-1 ) )
{
INTERSECTION is;
is.our = CSegment( s1 );
is.their = CSegment( s2 );
is.p = s2b;
return is;
}
else
{
OPT_VECTOR2I p = CSegment( s1 ).Intersect( CSegment( s2 ), true );
if( p )
{
INTERSECTION is;
is.our = CSegment( s1 );
is.their = CSegment( s2 );
is.p = *p;
return is;
}
}
}
}
return OPT<SHAPE_LINE_CHAIN::INTERSECTION>();
}
示例11: assert
/**--------------------------------------------------------------------------<BR>
C2DLineBaseSet::AddIfCommonEnd
\brief Adds the points of another to this if they have a common end which is either
the first or last point. Returns true if there was a match.
<P>---------------------------------------------------------------------------*/
bool C2DLineBaseSet::AddIfCommonEnd(C2DLineBaseSet& Other)
{
assert(!IsClosed());
assert(!Other.IsClosed());
int nThisCount = size() ;
if (nThisCount < 1) return false;
int nOtherCount = Other.size();
if (nOtherCount < 1) return false;
if ( GetAt(0)->GetPointFrom() == Other.GetAt(0)->GetPointFrom())
{
ReverseDirection();
*this << Other;
return true;
}
else if( GetAt(0)->GetPointFrom() == Other.GetAt(nOtherCount - 1)->GetPointTo() )
{
ReverseDirection();
Other.ReverseDirection();
*this << Other;
return true;
}
else if (GetAt(nThisCount - 1)->GetPointTo() == Other.GetAt(0)->GetPointFrom())
{
*this << Other;
return true;
}
else if (GetAt(nThisCount - 1)->GetPointTo() == Other.GetAt(nOtherCount - 1)->GetPointTo() )
{
Other.ReverseDirection();
*this << Other;
return true;
}
return false;
}
示例12: SetGlobalComment
bool CZipArchive::SetGlobalComment(const CString &szComment)
{
if (IsClosed())
{
TRACE(_T("ZipArchive is closed.\n"));
return false;
}
if (m_storage.IsSpanMode() == -1)
{
TRACE(_T("You cannot modify the global comment of the existing disk spanning archive.\n"));
return false;
}
m_centralDir.m_szComment = szComment;
m_centralDir.RemoveFromDisk();
return true;
}
示例13:
NS_IMETHODIMP
nsFileUploadContentStream::AsyncWait(nsIInputStreamCallback *callback,
uint32_t flags, uint32_t count,
nsIEventTarget *target)
{
nsresult rv = nsBaseContentStream::AsyncWait(callback, flags, count, target);
if (NS_FAILED(rv) || IsClosed())
return rv;
if (IsNonBlocking()) {
nsCOMPtr<nsIRunnable> callback =
NS_NewRunnableMethod(this, &nsFileUploadContentStream::OnCopyComplete);
mCopyEvent->Dispatch(callback, mSink, target);
}
return NS_OK;
}
示例14: Recv
void BaseSession::Recv(Array& raw_data)
{
if (IsClosed())
return;
stream_ibuffer_.Insert(stream_ibuffer_.End(), raw_data.Begin(), raw_data.Size());
for (;;)
{
if (stream_ibuffer_.Size() < 2)
return;
uint16_t len = *reinterpret_cast<uint16_t *>(stream_ibuffer_.Begin());
if (stream_ibuffer_.Size() < 2 + len)
return;
Array proto(static_cast<char *>(stream_ibuffer_.Begin())+2, len);
OnAfterRecv(proto);
stream_ibuffer_.Erase(stream_ibuffer_.Begin(), 2+len);
}
}
示例15: DestroyCurveTree
bool ON_NurbsCurve::Morph( const ON_SpaceMorph& morph )
{
DestroyCurveTree();
ON_BOOL32 bIsClosed = IsClosed();
ON_BOOL32 bIsPeriodic = IsPeriodic();
morph.MorphPointList( m_dim, m_is_rat, m_cv_count, m_cv_stride, m_cv );
if ( bIsPeriodic )
{
int i, deg = m_order-1;
for ( i = 0; i < deg; i++ )
SetCV( m_cv_count-deg+i, ON::intrinsic_point_style, CV(i) );
}
else if ( bIsClosed )
{
SetCV( m_cv_count-1, ON::intrinsic_point_style, CV(0) );
}
return true;
}