예제 #1
0
void
nsFileUploadContentStream::OnCopyComplete()
{
  // This method is being called to indicate that we are done copying.
  nsresult status = mCopyEvent->Status();

  CloseWithStatus(NS_FAILED(status) ? status : NS_BASE_STREAM_CLOSED);
}
예제 #2
0
NS_INTERFACE_MAP_END_THREADSAFE

//-----------------------------------------------------------------------------
// nsBaseContentStream::nsIInputStream

NS_IMETHODIMP
nsBaseContentStream::Close()
{
    return IsClosed() ? NS_OK : CloseWithStatus(NS_BASE_STREAM_CLOSED);
}
예제 #3
0
void
nsGopherContentStream::OnCallbackPending()
{
    nsresult rv;

    // We have a callback, so failure means we should close the stream.
    if (!mSocket) {
        rv = OpenSocket(CallbackTarget());
    } else if (mSocketInput) {
        rv = mSocketInput->AsyncWait(this, 0, 0, CallbackTarget());
    }
 
    if (NS_FAILED(rv))
        CloseWithStatus(rv);
}
예제 #4
0
NS_IMETHODIMP
nsGopherContentStream::OnOutputStreamReady(nsIAsyncOutputStream *stream)
{
    // If we're already closed, mSocketOutput is going to be null and we'll
    // just be getting notified that it got closed (by outselves).  In that
    // case, nothing to do here.
    if (!mSocketOutput) {
        NS_ASSERTION(NS_FAILED(Status()), "How did that happen?");
        return NS_OK;
    }
    
    // We have to close ourselves if we hit an error here in order to propagate
    // the error to our consumer.  Otherwise, just forward the notification so
    // that the consumer will know to start reading.

    nsresult rv = OnSocketWritable();
    if (NS_FAILED(rv))
        CloseWithStatus(rv);

    return NS_OK;
}
예제 #5
0
NS_IMETHODIMP
nsFileUploadContentStream::ReadSegments(nsWriteSegmentFun fun, void *closure,
                                        uint32_t count, uint32_t *result)
{
  *result = 0;  // nothing is ever actually read from this stream

  if (IsClosed())
    return NS_OK;

  if (IsNonBlocking()) {
    // Inform the caller that they will have to wait for the copy operation to
    // complete asynchronously.  We'll kick of the copy operation once they
    // call AsyncWait.
    return NS_BASE_STREAM_WOULD_BLOCK;  
  }

  // Perform copy synchronously, and then close out the stream.
  mCopyEvent->DoCopy();
  nsresult status = mCopyEvent->Status();
  CloseWithStatus(NS_FAILED(status) ? status : NS_BASE_STREAM_CLOSED);
  return status;
}
예제 #6
0
NS_IMETHODIMP
InputStreamShim::Close()
{
  return CloseWithStatus(NS_OK);
}
예제 #7
0
파일: nsPipe3.cpp 프로젝트: bringhurst/vbox
NS_IMETHODIMP
nsPipeInputStream::Close()
{
    return CloseWithStatus(NS_BASE_STREAM_CLOSED);
}
예제 #8
0
/* void close (); */
NS_IMETHODIMP nsMsgCompressIStream::Close()
{
  return CloseWithStatus(NS_OK);
}