Home | History | Annotate | Download | only in updater

Lines Matching defs:nti

367   NewThreadInfo* nti = static_cast<NewThreadInfo*>(cookie);
370 // Wait for nti->writer to be non-null, indicating some of this data is wanted.
371 pthread_mutex_lock(&nti->mu);
372 while (nti->writer == nullptr) {
374 if (!nti->receiver_available) {
375 pthread_mutex_unlock(&nti->mu);
378 pthread_cond_wait(&nti->cv, &nti->mu);
380 pthread_mutex_unlock(&nti->mu);
382 // At this point nti->writer is set, and we own it. The main thread is waiting for it to
383 // disappear from nti.
384 size_t write_now = std::min(size, nti->writer->AvailableSpace());
385 if (nti->writer->Write(data, write_now) != write_now) {
393 if (nti->writer->Finished()) {
396 pthread_mutex_lock(&nti->mu);
397 nti->writer = nullptr;
398 pthread_cond_broadcast(&nti->cv);
399 pthread_mutex_unlock(&nti->mu);
407 NewThreadInfo* nti = static_cast<NewThreadInfo*>(cookie);
409 while (size > 0 || BrotliDecoderHasMoreOutput(nti->brotli_decoder_state)) {
410 // Wait for nti->writer to be non-null, indicating some of this data is wanted.
411 pthread_mutex_lock(&nti->mu);
412 while (nti->writer == nullptr) {
414 if (!nti->receiver_available) {
415 pthread_mutex_unlock(&nti->mu);
418 pthread_cond_wait(&nti->cv, &nti->mu);
420 pthread_mutex_unlock(&nti->mu);
422 // At this point nti->writer is set, and we own it. The main thread is waiting for it to
423 // disappear from nti.
425 size_t buffer_size = std::min<size_t>(32768, nti->writer->AvailableSpace());
437 nti->brotli_decoder_state, &available_in, &data, &available_out, &next_out, nullptr);
441 << BrotliDecoderErrorString(BrotliDecoderGetErrorCode(nti->brotli_decoder_state));
449 if (nti->writer->Write(buffer, write_now) != write_now) {
457 if (nti->writer->Finished()) {
460 pthread_mutex_lock(&nti->mu);
461 nti->writer = nullptr;
462 pthread_cond_broadcast(&nti->cv);
463 pthread_mutex_unlock(&nti->mu);
471 NewThreadInfo* nti = static_cast<NewThreadInfo*>(cookie);
472 if (nti->brotli_compressed) {
473 ProcessZipEntryContents(nti->za, &nti->entry, receive_brotli_new_data, nti);
475 ProcessZipEntryContents(nti->za, &nti->entry, receive_new_data, nti);
477 pthread_mutex_lock(&nti->mu);
478 nti->receiver_available = false;
479 if (nti->writer != nullptr) {
480 pthread_cond_broadcast(&nti->cv);
482 pthread_mutex_unlock(&nti->mu);
544 NewThreadInfo nti;
1361 pthread_mutex_lock(&params.nti.mu);
1362 params.nti.writer = std::make_unique<RangeSinkWriter>(params.fd, tgt);
1363 pthread_cond_broadcast(&params.nti.cv);
1365 while (params.nti.writer != nullptr) {
1366 if (!params.nti.receiver_available) {
1367 LOG(ERROR) << "missing " << (tgt.blocks() * BLOCKSIZE - params.nti.writer->BytesWritten())
1369 pthread_mutex_unlock(&params.nti.mu);
1372 pthread_cond_wait(&params.nti.cv, &params.nti.mu);
1375 pthread_mutex_unlock(&params.nti.mu);
1604 params.nti.za = za;
1605 params.nti.entry = new_entry;
1606 params.nti.brotli_compressed = android::base::EndsWith(new_data_fn->data, ".br");
1607 if (params.nti.brotli_compressed) {
1609 params.nti.brotli_decoder_state = BrotliDecoderCreateInstance(nullptr, nullptr, nullptr);
1611 params.nti.receiver_available = true;
1613 pthread_mutex_init(&params.nti.mu, nullptr);
1614 pthread_cond_init(&params.nti.cv, nullptr);
1619 int error = pthread_create(&params.thread, &attr, unzip_new_data, &params.nti);
1780 pthread_mutex_lock(&params.nti.mu);
1781 if (params.nti.receiver_available) {
1784 params.nti.receiver_available = false;
1785 pthread_cond_broadcast(&params.nti.cv);
1786 pthread_mutex_unlock(&params.nti.mu);
1809 pthread_mutex_destroy(&params.nti.mu);
1810 pthread_cond_destroy(&params.nti.cv);
1821 if (params.nti.brotli_decoder_state != nullptr) {
1822 BrotliDecoderDestroyInstance(params.nti.brotli_decoder_state);