本文整理汇总了C++中AssertIsOnOwningThread函数的典型用法代码示例。如果您正苦于以下问题:C++ AssertIsOnOwningThread函数的具体用法?C++ AssertIsOnOwningThread怎么用?C++ AssertIsOnOwningThread使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AssertIsOnOwningThread函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LOG
nsresult
MediaEngineRemoteVideoSource::Stop(mozilla::SourceMediaStream* aSource,
mozilla::TrackID aID)
{
LOG((__PRETTY_FUNCTION__));
AssertIsOnOwningThread();
{
MonitorAutoLock lock(mMonitor);
// Drop any cached image so we don't start with a stale image on next
// usage. Also, gfx gets very upset if these are held until this object
// is gc'd in final-cc during shutdown (bug 1374164)
mImage = nullptr;
// we drop mImageContainer only in MediaEngineCaptureVideoSource::Shutdown()
size_t i = mSources.IndexOf(aSource);
if (i == mSources.NoIndex) {
// Already stopped - this is allowed
return NS_OK;
}
MOZ_ASSERT(mSources.Length() == mPrincipalHandles.Length());
mSources.RemoveElementAt(i);
mPrincipalHandles.RemoveElementAt(i);
aSource->EndTrack(aID);
if (!mSources.IsEmpty()) {
return NS_OK;
}
if (mState != kStarted) {
return NS_ERROR_FAILURE;
}
mState = kStopped;
}
mozilla::camera::GetChildAndCall(
&mozilla::camera::CamerasChild::StopCapture,
mCapEngine, mCaptureIndex);
return NS_OK;
}
示例2: AssertIsOnOwningThread
already_AddRefed<IDBTransaction>
IDBDatabase::Transaction(const StringOrStringSequence& aStoreNames,
IDBTransactionMode aMode,
ErrorResult& aRv)
{
AssertIsOnOwningThread();
aRv.MightThrowJSException();
if (aMode == IDBTransactionMode::Readwriteflush &&
!IndexedDatabaseManager::ExperimentalFeaturesEnabled()) {
// Pretend that this mode doesn't exist. We don't have a way to annotate
// certain enum values as depending on preferences so we just duplicate the
// normal exception generation here.
ThreadsafeAutoJSContext cx;
// Disable any automatic error reporting that might be set up so that we
// can grab the exception object.
AutoForceSetExceptionOnContext forceExn(cx);
MOZ_ALWAYS_FALSE(
ThrowErrorMessage(cx,
MSG_INVALID_ENUM_VALUE,
"Argument 2 of IDBDatabase.transaction",
"readwriteflush",
"IDBTransactionMode"));
MOZ_ASSERT(JS_IsExceptionPending(cx));
JS::Rooted<JS::Value> exception(cx);
MOZ_ALWAYS_TRUE(JS_GetPendingException(cx, &exception));
aRv.ThrowJSException(cx, exception);
return nullptr;
}
RefPtr<IDBTransaction> transaction;
aRv = Transaction(aStoreNames, aMode, getter_AddRefs(transaction));
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
return transaction.forget();
}
示例3: AssertIsOnOwningThread
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
JSObject*
IDBCursor::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
AssertIsOnOwningThread();
switch (mType) {
case Type_ObjectStore:
case Type_Index:
return IDBCursorWithValueBinding::Wrap(aCx, this, aGivenProto);
case Type_ObjectStoreKey:
case Type_IndexKey:
return IDBCursorBinding::Wrap(aCx, this, aGivenProto);
default:
MOZ_CRASH("Bad type!");
}
}
示例4: AssertIsOnOwningThread
nsresult
MediaEngineWebRTCMicrophoneSource::Deallocate(AllocationHandle* aHandle)
{
AssertIsOnOwningThread();
Super::Deallocate(aHandle);
if (!mRegisteredHandles.Length()) {
// If empty, no callbacks to deliver data should be occuring
if (mState != kStopped && mState != kAllocated) {
return NS_ERROR_FAILURE;
}
FreeChannel();
LOG(("Audio device %d deallocated", mCapIndex));
} else {
LOG(("Audio device %d deallocated but still in use", mCapIndex));
}
return NS_OK;
}
示例5: AssertIsOnOwningThread
void
FetchStream::Close()
{
AssertIsOnOwningThread();
MutexAutoLock lock(mMutex);
if (mState == eClosed) {
return;
}
AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.Init(mGlobal))) {
ReleaseObjects(lock);
return;
}
JSContext* cx = jsapi.cx();
JS::Rooted<JSObject*> stream(cx, mStreamHolder->ReadableStreamBody());
CloseAndReleaseObjects(cx, lock, stream);
}
示例6: AssertIsOnOwningThread
already_AddRefed<DOMStringList>
IDBDatabase::ObjectStoreNames() const
{
AssertIsOnOwningThread();
MOZ_ASSERT(mSpec);
const nsTArray<ObjectStoreSpec>& objectStores = mSpec->objectStores();
RefPtr<DOMStringList> list = new DOMStringList();
if (!objectStores.IsEmpty()) {
nsTArray<nsString>& listNames = list->StringArray();
listNames.SetCapacity(objectStores.Length());
for (uint32_t index = 0; index < objectStores.Length(); index++) {
listNames.InsertElementSorted(objectStores[index].metadata().name());
}
}
return list.forget();
}
示例7: AssertIsOnOwningThread
bool
QuotaUsageRequestChild::Recv__delete__(const UsageRequestResponse& aResponse)
{
AssertIsOnOwningThread();
MOZ_ASSERT(mRequest);
switch (aResponse.type()) {
case UsageRequestResponse::Tnsresult:
HandleResponse(aResponse.get_nsresult());
break;
case UsageRequestResponse::TUsageResponse:
HandleResponse(aResponse.get_UsageResponse());
break;
default:
MOZ_CRASH("Unknown response type!");
}
return true;
}
示例8: AssertIsOnOwningThread
nsresult
MediaEngineWebRTCMicrophoneSource::Stop(SourceMediaStream *aSource, TrackID aID)
{
AssertIsOnOwningThread();
{
MonitorAutoLock lock(mMonitor);
if (!mSources.RemoveElement(aSource)) {
// Already stopped - this is allowed
return NS_OK;
}
aSource->EndTrack(aID);
if (!mSources.IsEmpty()) {
return NS_OK;
}
if (mState != kStarted) {
return NS_ERROR_FAILURE;
}
if (!mVoEBase) {
return NS_ERROR_FAILURE;
}
mState = kStopped;
}
mAudioInput->StopRecording(aSource->Graph(), mListener);
mVoERender->DeRegisterExternalMediaProcessing(mChannel, webrtc::kRecordingPerChannel);
if (mVoEBase->StopSend(mChannel)) {
return NS_ERROR_FAILURE;
}
if (mVoEBase->StopReceive(mChannel)) {
return NS_ERROR_FAILURE;
}
return NS_OK;
}
示例9: AssertIsOnOwningThread
bool
IDBTransaction::IsOpen() const
{
AssertIsOnOwningThread();
// If we haven't started anything then we're open.
if (mReadyState == IDBTransaction::INITIAL) {
return true;
}
// If we've already started then we need to check to see if we still have the
// mCreating flag set. If we do (i.e. we haven't returned to the event loop
// from the time we were created) then we are open. Otherwise check the
// currently running transaction to see if it's the same. We only allow other
// requests to be made if this transaction is currently running.
if (mReadyState == IDBTransaction::LOADING &&
(mCreating || GetCurrent() == this)) {
return true;
}
return false;
}
示例10: AssertIsOnOwningThread
bool
DeviceStorageFileSystem::IsSafeDirectory(Directory* aDir) const
{
AssertIsOnOwningThread();
MOZ_ASSERT(aDir);
ErrorResult rv;
RefPtr<FileSystemBase> fs = aDir->GetFileSystem(rv);
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
return false;
}
nsAutoString fsSerialization;
fs->SerializeDOMPath(fsSerialization);
nsAutoString thisSerialization;
SerializeDOMPath(thisSerialization);
// Check if the given directory is from this storage.
return fsSerialization == thisSerialization;
}
示例11: AssertIsOnOwningThread
void
IDBKeyRange::GetUpper(JSContext* aCx, JS::MutableHandle<JS::Value> aResult,
ErrorResult& aRv)
{
AssertIsOnOwningThread();
if (!mHaveCachedUpperVal) {
if (!mRooted) {
mozilla::HoldJSObjects(this);
mRooted = true;
}
aRv = Upper().ToJSVal(aCx, mCachedUpperVal);
if (aRv.Failed()) {
return;
}
mHaveCachedUpperVal = true;
}
aResult.set(mCachedUpperVal);
}
示例12: AssertIsOnOwningThread
void
IDBRequest::DispatchNonTransactionError(nsresult aErrorCode)
{
AssertIsOnOwningThread();
MOZ_ASSERT(NS_FAILED(aErrorCode));
MOZ_ASSERT(NS_ERROR_GET_MODULE(aErrorCode) == NS_ERROR_MODULE_DOM_INDEXEDDB);
SetError(aErrorCode);
// Make an error event and fire it at the target.
nsCOMPtr<nsIDOMEvent> event =
CreateGenericEvent(this,
nsDependentString(kErrorEventType),
eDoesBubble,
eCancelable);
MOZ_ASSERT(event);
bool ignored;
if (NS_FAILED(DispatchEvent(event, &ignored))) {
NS_WARNING("Failed to dispatch event!");
}
}
示例13: AssertIsOnOwningThread
void
IDBDatabase::RefreshSpec(bool aMayDelete)
{
AssertIsOnOwningThread();
class MOZ_STACK_CLASS Helper final
{
public:
static PLDHashOperator
RefreshTransactionsSpec(nsPtrHashKey<IDBTransaction>* aTransaction,
void* aClosure)
{
MOZ_ASSERT(aTransaction);
aTransaction->GetKey()->AssertIsOnOwningThread();
MOZ_ASSERT(aClosure);
bool mayDelete = *static_cast<bool*>(aClosure);
nsRefPtr<IDBTransaction> transaction = aTransaction->GetKey();
transaction->RefreshSpec(mayDelete);
return PL_DHASH_NEXT;
}
示例14: AssertIsOnOwningThread
void
IDBFileHandle::HandleCompleteOrAbort(bool aAborted)
{
AssertIsOnOwningThread();
FileHandleBase::HandleCompleteOrAbort(aAborted);
nsCOMPtr<nsIDOMEvent> event;
if (aAborted) {
event = CreateGenericEvent(this, nsDependentString(kAbortEventType),
eDoesBubble, eNotCancelable);
} else {
event = CreateGenericEvent(this, nsDependentString(kCompleteEventType),
eDoesNotBubble, eNotCancelable);
}
if (NS_WARN_IF(!event)) {
return;
}
bool dummy;
if (NS_FAILED(DispatchEvent(event, &dummy))) {
NS_WARNING("DispatchEvent failed!");
}
}
示例15: LOG
nsresult
MediaEngineGonkVideoSource::Deallocate(AllocationHandle* aHandle)
{
LOG((__FUNCTION__));
AssertIsOnOwningThread();
MOZ_ASSERT(!aHandle);
bool empty;
{
MonitorAutoLock lock(mMonitor);
empty = mSources.IsEmpty();
}
if (empty) {
ReentrantMonitorAutoEnter sync(mCallbackMonitor);
if (mState != kStopped && mState != kAllocated) {
return NS_ERROR_FAILURE;
}
// We do not register success callback here
NS_DispatchToMainThread(WrapRunnable(RefPtr<MediaEngineGonkVideoSource>(this),
&MediaEngineGonkVideoSource::DeallocImpl));
mCallbackMonitor.Wait();
if (mState != kReleased) {
return NS_ERROR_FAILURE;
}
mState = kReleased;
LOG(("Video device %d deallocated", mCaptureIndex));
} else {
LOG(("Video device %d deallocated but still in use", mCaptureIndex));
}
return NS_OK;
}