Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Protected Attributes
FileChannelWorker Class Reference
Inheritance diagram for FileChannelWorker:
Inheritance graph
[legend]
Collaboration diagram for FileChannelWorker:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_IMETHOD Run ()
 Defines an entry point for a newly created thread.
NS_DECL_ISUPPORTS FileChannelWorker ()
nsresult Init (nsIFile *inPath, nsIFile *outPath, PRUint32 bufferSize)
virtual ~FileChannelWorker ()
void run ()

Static Public Member Functions

static nsresult Create (nsIRunnable **result, nsIFile *inPath, nsIFile *outPath, PRUint32 bufferSize)

Protected Attributes

nsCOMPtr< nsIFilemInPath
nsCOMPtr< nsIFilemOutPath
char * mBuffer
PRUint32 mBufferSize

Detailed Description

Definition at line 260 of file TestFileInput2.cpp.


Constructor & Destructor Documentation

Definition at line 298 of file TestFileInput2.cpp.

Here is the caller graph for this function:

virtual FileChannelWorker::~FileChannelWorker ( ) [inline, virtual]

Definition at line 334 of file TestFileInput2.cpp.

                                 {
        delete[] mBuffer;
    }

Member Function Documentation

static nsresult FileChannelWorker::Create ( nsIRunnable **  result,
nsIFile inPath,
nsIFile outPath,
PRUint32  bufferSize 
) [inline, static]

Definition at line 315 of file TestFileInput2.cpp.

    {
        FileChannelWorker* worker = new FileChannelWorker();
        if (worker == nsnull)
            return NS_ERROR_OUT_OF_MEMORY;
        NS_ADDREF(worker);

        nsresult rv = worker->Init(inPath, outPath, bufferSize);
        if (NS_FAILED(rv)) {
            NS_RELEASE(worker);
            return rv;
        }
        *result = worker;
        return NS_OK;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult FileChannelWorker::Init ( nsIFile inPath,
nsIFile outPath,
PRUint32  bufferSize 
) [inline]

Definition at line 304 of file TestFileInput2.cpp.

    {
        mInPath = inPath;
        mOutPath = outPath;
        mBuffer = new char[bufferSize];
        mBufferSize = bufferSize;
        return (mInPath && mOutPath && mBuffer)
            ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
    }

Here is the caller graph for this function:

void nsIRunnable::run ( ) [inherited]
NS_IMETHOD FileChannelWorker::Run ( ) [inline, virtual]

Defines an entry point for a newly created thread.

Implements nsIRunnable.

Definition at line 263 of file TestFileInput2.cpp.

                     {
        nsresult rv;

        PRIntervalTime startTime = PR_IntervalNow();
        PRIntervalTime endTime;
        PRUint32 copyCount = 0;
        nsCOMPtr<nsIFileChannel> inCh;
        nsCOMPtr<nsIFileChannel> outCh;
        nsCOMPtr<nsIInputStream> inStr;
        nsCOMPtr<nsIOutputStream> outStr;

        rv = NS_NewLocalFileChannel(getter_AddRefs(inCh), mInPath);
        if (NS_FAILED(rv)) return rv;

        rv = inCh->Open(getter_AddRefs(inStr));
        if (NS_FAILED(rv)) return rv;

        //rv = NS_NewLocalFileChannel(getter_AddRefs(outCh), mOutPath);
        //if (NS_FAILED(rv)) return rv;

        //rv = outCh->OpenOutputStream(0, -1, 0, getter_AddRefs(outStr));
        //if (NS_FAILED(rv)) return rv;

        // Copy from one to the other
        rv = Copy(inStr, outStr, mBuffer, mBufferSize, &copyCount);
        if (NS_FAILED(rv)) return rv;

        endTime = PR_IntervalNow();
        gTimeSampler.AddTime(endTime - startTime);

        return rv;
    }

Here is the call graph for this function:


Member Data Documentation

char* FileChannelWorker::mBuffer [protected]

Definition at line 341 of file TestFileInput2.cpp.

Definition at line 342 of file TestFileInput2.cpp.

Definition at line 339 of file TestFileInput2.cpp.

Definition at line 340 of file TestFileInput2.cpp.


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