Esempio n. 1
0
void
IORequest::SubRequestFinished(IORequest* request, status_t status,
	bool partialTransfer, size_t transferEndOffset)
{
	TRACE("IORequest::SubrequestFinished(%p, %#lx, %d, %lu): request: %p\n",
		request, status, partialTransfer, transferEndOffset, this);

	MutexLocker locker(fLock);

	if (status != B_OK || partialTransfer) {
		if (fTransferSize > transferEndOffset)
			fTransferSize = transferEndOffset;
		fPartialTransfer = true;
	}

	if (status != B_OK && fStatus == 1)
		fStatus = status;

	if (--fPendingChildren > 0 || fSuppressChildNotifications)
		return;

	// last child finished

	// set status, if not done yet
	if (fStatus == 1)
		fStatus = B_OK;

	locker.Unlock();

	NotifyFinished();
}
Esempio n. 2
0
void
Downloader::SendInternal ()
{
	LOG_DOWNLOADER ("Downloader::SendInternal ()\n");
	
	g_return_if_fail (request != NULL);

	if (!send_queued)
		return;
	
	send_queued = false;
	
	if (completed) {
		// Consumer is re-sending a request which finished successfully.
		NotifyFinished ();
		return;
	}
	
	if (failed_msg != NULL) {
		if (HasHandlers (DownloadFailedEvent)) {
			// Consumer is re-sending a request which failed.
			Emit (DownloadFailedEvent,
			      new ErrorEventArgs (this, DownloadError,
						  MoonError (MoonError::EXCEPTION, 4001, failed_msg)));
		}
		return;
	}
	
	started = true;
	aborted = false;
	
	g_return_if_fail (request != NULL);

	request->Send ();
}
Esempio n. 3
0
void
Downloader::StoppedHandler (HttpRequest *sender, HttpRequestStoppedEventArgs *args)
{
	SetFilename (sender->GetFilename ());
	if (args->IsSuccess ()) {
		NotifyFinished ();
	} else {
		NotifyFailed (args->GetErrorMessage ());
	}
}
Esempio n. 4
0
// Called from the MediaStreamGraph thread
// this can be in response to our own RemoveListener() (via ::Remove()), or
// because the DOM GC'd the DOMLocalMediaStream/etc we're attached to.
void
GetUserMediaCallbackMediaStreamListener::NotifyRemoved(MediaStreamGraph* aGraph)
{
    {
        MutexAutoLock lock(mLock); // protect access to mRemoved
        MM_LOG(("Listener removed by DOM Destroy(), mFinished = %d", (int) mFinished));
        mRemoved = true;
    }
    if (!mFinished) {
        NotifyFinished(aGraph);
    }
}
Esempio n. 5
0
void
IORequest::SetStatusAndNotify(status_t status)
{
	MutexLocker locker(fLock);

	if (fStatus != 1)
		return;

	fStatus = status;

	locker.Unlock();

	NotifyFinished();
}