already_AddRefed<Promise> Cache::Add(JSContext* aContext, const RequestOrUSVString& aRequest, CallerType aCallerType, ErrorResult& aRv) { if (NS_WARN_IF(!mActor)) { aRv.Throw(NS_ERROR_UNEXPECTED); return nullptr; } CacheChild::AutoLock actorLock(mActor); if (!IsValidPutRequestMethod(aRequest, aRv)) { return nullptr; } GlobalObject global(aContext, mGlobal->GetGlobalJSObject()); MOZ_DIAGNOSTIC_ASSERT(!global.Failed()); nsTArray<RefPtr<Request>> requestList(1); RefPtr<Request> request = Request::Constructor(global, aRequest, RequestInit(), aRv); if (NS_WARN_IF(aRv.Failed())) { return nullptr; } nsAutoString url; request->GetUrl(url); if (NS_WARN_IF(!IsValidPutRequestURL(url, aRv))) { return nullptr; } requestList.AppendElement(std::move(request)); return AddAll(global, std::move(requestList), aCallerType, aRv); }
FaceContainer& FaceContainer::operator= (const FaceContainer &other) { m_faces.clear(); AddAll(other); return *this; }
void VSCSearch::SetupConnections() { connect( this->ui.pushButtonStart, SIGNAL( clicked() ), this, SLOT(StartSearch())); connect( this->ui.pushButtonStop, SIGNAL( clicked() ), this, SLOT(StopSearch())); connect( this->ui.pushButtonAdd, SIGNAL( clicked() ), this, SLOT(AddAll())); connect( this->ui.pushButtonSelect, SIGNAL( clicked() ), this, SLOT(SelectAll())); connect( this, SIGNAL(NewSearchedItem(astring, astring, astring, astring, astring, astring) ), this, SLOT(AddItem(astring, astring, astring, astring, astring, astring)), Qt::QueuedConnection); //Qt::QueuedConnection }
void main( int argc, char *argv[] ) { collection c; if ( argc > 1 ) N = atoi( argv[1] ); printf("Collection size %d\n", N ); GenList( N ); c = ConsCollection( N, sizeof( int ) ); AddAll( c ); printf("Added %d items\n", N ); CheckAll( c ); printf("Checked %d items\n", N ); DeleteAll_1( c ); printf("Deleted all items\n" ); AddAll( c ); printf("Added %d items\n", N ); DeleteAll_2( c ); printf("Deleted all items\n" ); }
already_AddRefed<Promise> Cache::AddAll(JSContext* aContext, const Sequence<OwningRequestOrUSVString>& aRequestList, CallerType aCallerType, ErrorResult& aRv) { if (NS_WARN_IF(!mActor)) { aRv.Throw(NS_ERROR_UNEXPECTED); return nullptr; } CacheChild::AutoLock actorLock(mActor); GlobalObject global(aContext, mGlobal->GetGlobalJSObject()); MOZ_DIAGNOSTIC_ASSERT(!global.Failed()); nsTArray<RefPtr<Request>> requestList(aRequestList.Length()); for (uint32_t i = 0; i < aRequestList.Length(); ++i) { RequestOrUSVString requestOrString; if (aRequestList[i].IsRequest()) { requestOrString.SetAsRequest() = aRequestList[i].GetAsRequest(); if (NS_WARN_IF(!IsValidPutRequestMethod(requestOrString.GetAsRequest(), aRv))) { return nullptr; } } else { requestOrString.SetAsUSVString().Rebind( aRequestList[i].GetAsUSVString().Data(), aRequestList[i].GetAsUSVString().Length()); } RefPtr<Request> request = Request::Constructor(global, requestOrString, RequestInit(), aRv); if (NS_WARN_IF(aRv.Failed())) { return nullptr; } nsAutoString url; request->GetUrl(url); if (NS_WARN_IF(!IsValidPutRequestURL(url, aRv))) { return nullptr; } requestList.AppendElement(std::move(request)); } return AddAll(global, std::move(requestList), aCallerType, aRv); }
void FaceContainer::AddAll(Ptr<FaceContainer> other) { AddAll(*other); }
FaceContainer::FaceContainer(const FaceContainer& other) { AddAll(other); }