Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Protected Attributes | Private Attributes
nsPluginStreamInfo Class Reference
Inheritance diagram for nsPluginStreamInfo:
Inheritance graph
Collaboration diagram for nsPluginStreamInfo:
Collaboration graph

List of all members.

Public Member Functions

 nsPluginStreamInfo ()
virtual ~nsPluginStreamInfo ()
NS_DECL_ISUPPORTS NS_IMETHOD GetContentType (nsMIMEType *result)
NS_IMETHOD IsSeekable (PRBool *result)
NS_IMETHOD GetLength (PRUint32 *result)
NS_IMETHOD GetLastModified (PRUint32 *result)
NS_IMETHOD GetURL (const char **result)
NS_IMETHOD RequestRead (nsByteRange *rangeList)
NS_IMETHOD GetStreamOffset (PRInt32 *result)
NS_IMETHOD SetStreamOffset (PRInt32 result)
void SetContentType (const nsMIMEType contentType)
void SetSeekable (const PRBool seekable)
void SetLength (const PRUint32 length)
void SetLastModified (const PRUint32 modified)
void SetURL (const char *url)
void SetPluginInstance (nsIPluginInstance *aPluginInstance)
void SetPluginStreamListenerPeer (nsPluginStreamListenerPeer *aPluginStreamListenerPeer)
void MakeByteRangeString (nsByteRange *aRangeList, nsACString &string, PRInt32 *numRequests)
PRBool UseExistingPluginCacheFile (nsPluginStreamInfo *psi)
void SetStreamComplete (const PRBool complete)
void SetRequest (nsIRequest *request)
nsIRequestGetRequest ()
void isSeekable (out boolean aSeekable)
void getURL (out constCharPtr aURL)
void requestRead (in nsByteRangePtr aRangeList)

Public Attributes

readonly attribute nsMIMEType contentType
readonly attribute unsigned long length
readonly attribute unsigned long lastModified
attribute long streamOffset

Protected Attributes

nsCOMPtr< nsIRequestmRequest

Private Attributes

char * mContentType
char * mURL
PRBool mSeekable
PRUint32 mLength
PRUint32 mModified
PRInt32 mStreamOffset
PRBool mStreamComplete

Detailed Description

Definition at line 1110 of file nsPluginHostImpl.cpp.

Constructor & Destructor Documentation

Member Function Documentation

Definition at line 1346 of file nsPluginHostImpl.cpp.

  *result = mModified;
  return NS_OK;

Definition at line 1339 of file nsPluginHostImpl.cpp.

  *result = mLength;
  return NS_OK;

Definition at line 124 of file ns4xPluginStreamListener.h.

    return mRequest;

Definition at line 1471 of file nsPluginHostImpl.cpp.

  *result = mStreamOffset;
  return NS_OK;

Definition at line 1353 of file nsPluginHostImpl.cpp.

  *result = mURL;
  return NS_OK;
void nsIPluginStreamInfo::isSeekable ( out boolean  aSeekable) [inherited]

Definition at line 1332 of file nsPluginHostImpl.cpp.

  *result = mSeekable;
  return NS_OK;
void nsPluginStreamInfo::MakeByteRangeString ( nsByteRange aRangeList,
nsACString &  string,
PRInt32 numRequests 

Definition at line 1360 of file nsPluginHostImpl.cpp.

  *numRequests  = 0;
  //the string should look like this: bytes=500-700,601-999

  PRInt32 requestCnt = 0;
  nsCAutoString string("bytes=");

  for(nsByteRange * range = aRangeList; range != nsnull; range = range->next)
    // XXX zero length?

    // XXX needs to be fixed for negative offsets
    string.AppendInt(range->offset + range->length - 1);
      string += ",";


  // get rid of possible trailing comma
  string.Trim(",", PR_FALSE);

  rangeRequest = string;
  *numRequests  = requestCnt;

Here is the caller graph for this function:

Definition at line 1398 of file nsPluginHostImpl.cpp.

  nsCAutoString rangeString;
  PRInt32 numRequests;

  //first of all lets see if mPluginStreamListenerPeer is still alive
  nsCOMPtr<nsISupportsWeakReference> suppWeakRef(
    do_QueryInterface((nsISupportsWeakReference *)(mPluginStreamListenerPeer)));
  if (!suppWeakRef)
    return NS_ERROR_FAILURE;

  nsCOMPtr<nsIWeakReference> pWeakRefPluginStreamListenerPeer =
  if (!pWeakRefPluginStreamListenerPeer)
    return NS_ERROR_FAILURE;

  MakeByteRangeString(rangeList, rangeString, &numRequests);

  if(numRequests == 0)
    return NS_ERROR_FAILURE;

  nsresult rv = NS_OK;
  nsCOMPtr<nsIURI> url;

  rv = NS_NewURI(getter_AddRefs(url), nsDependentCString(mURL));

  nsCOMPtr<nsIInterfaceRequestor> callbacks = do_QueryReferent(mPluginStreamListenerPeer->mWeakPtrChannelCallbacks);
  nsCOMPtr<nsILoadGroup> loadGroup = do_QueryReferent(mPluginStreamListenerPeer->mWeakPtrChannelLoadGroup);
  nsCOMPtr<nsIChannel> channel;
  rv = NS_NewChannel(getter_AddRefs(channel), url, nsnull, loadGroup, callbacks);
  if (NS_FAILED(rv))
    return rv;

  nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(channel));
    return NS_ERROR_FAILURE;

  httpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Range"), rangeString, PR_FALSE);

  mPluginStreamListenerPeer->mAbort = PR_TRUE; // instruct old stream listener to cancel
                                               // the request on the next ODA.

  nsCOMPtr<nsIStreamListener> converter;

  if (numRequests == 1) {
    converter = mPluginStreamListenerPeer;

    // set current stream offset equal to the first offset in the range list
    // it will work for single byte range request
    // for multy range we'll reset it in ODA
  } else {
    nsPluginByteRangeStreamListener *brrListener =
      new nsPluginByteRangeStreamListener(pWeakRefPluginStreamListenerPeer);
    if (brrListener)
      converter = brrListener;
      return NS_ERROR_OUT_OF_MEMORY;

  mPluginStreamListenerPeer->mPendingRequests += numRequests;

  nsCOMPtr<nsISupportsPRUint32> container = do_CreateInstance(NS_SUPPORTS_PRUINT32_CONTRACTID, &rv);
  if (NS_FAILED(rv))
    return rv;
  rv = container->SetData(MAGIC_REQUEST_CONTEXT);
  if (NS_FAILED(rv))
    return rv;

  return channel->AsyncOpen(converter, container);

Here is the call graph for this function:

Definition at line 1514 of file nsPluginHostImpl.cpp.

  mModified = modified;

Definition at line 1506 of file nsPluginHostImpl.cpp.

  mLength = length;

Definition at line 1532 of file nsPluginHostImpl.cpp.

    NS_IF_ADDREF(mPluginInstance = aPluginInstance);

Definition at line 1540 of file nsPluginHostImpl.cpp.

    // not addref'd - nsPluginStreamInfo is owned by mPluginStreamListenerPeer
    mPluginStreamListenerPeer = aPluginStreamListenerPeer;

Definition at line 1177 of file nsPluginHostImpl.cpp.

    mRequest = request;

Definition at line 1498 of file nsPluginHostImpl.cpp.

  mSeekable = seekable;

Definition at line 6871 of file nsPluginHostImpl.cpp.

  mStreamComplete = complete;

  if (complete) {
    // We're done, release the request.


Definition at line 1479 of file nsPluginHostImpl.cpp.

  mStreamOffset = offset;
  return NS_OK;

Here is the caller graph for this function:

Definition at line 1522 of file nsPluginHostImpl.cpp.

Definition at line 6855 of file nsPluginHostImpl.cpp.



 if ( psi->mLength == mLength &&
      psi->mModified == mModified &&
      mStreamComplete &&
      !PL_strcmp(psi->mURL, mURL))
    return PR_TRUE;
  return PR_FALSE;

Member Data Documentation

Definition at line 58 of file nsIPluginStreamInfo.idl.

readonly attribute unsigned long nsIPluginStreamInfo::lastModified [inherited]

Definition at line 64 of file nsIPluginStreamInfo.idl.

readonly attribute unsigned long nsIPluginStreamInfo::length [inherited]

Definition at line 62 of file nsIPluginStreamInfo.idl.

Definition at line 1184 of file nsPluginHostImpl.cpp.

Definition at line 1187 of file nsPluginHostImpl.cpp.

Definition at line 1188 of file nsPluginHostImpl.cpp.

Definition at line 1189 of file nsPluginHostImpl.cpp.

Definition at line 1190 of file nsPluginHostImpl.cpp.

Definition at line 130 of file ns4xPluginStreamListener.h.

Definition at line 1186 of file nsPluginHostImpl.cpp.

Definition at line 1192 of file nsPluginHostImpl.cpp.

Definition at line 1191 of file nsPluginHostImpl.cpp.

char* nsPluginStreamInfo::mURL [private]

Definition at line 1185 of file nsPluginHostImpl.cpp.

Definition at line 70 of file nsIPluginStreamInfo.idl.

The documentation for this class was generated from the following file: