LLVFile Class Reference

#include <llvfile.h>

Collaboration diagram for LLVFile:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 LLVFile (LLVFS *vfs, const LLUUID &file_id, const LLAssetType::EType file_type, S32 mode=LLVFile::READ)
 ~LLVFile ()
BOOL read (U8 *buffer, S32 bytes, BOOL async=FALSE, F32 priority=128.f)
void setReadPriority (const F32 priority)
BOOL isReadComplete ()
S32 getLastBytesRead ()
BOOL eof ()
BOOL write (const U8 *buffer, S32 bytes)
BOOL seek (S32 offset, S32 origin=-1)
S32 tell () const
S32 getSize ()
S32 getMaxSize ()
BOOL setMaxSize (S32 size)
BOOL rename (const LLUUID &new_id, const LLAssetType::EType new_type)
BOOL remove ()
bool isLocked (EVFSLock lock)
void waitForLock (EVFSLock lock)

Static Public Member Functions

static U8readFile (LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type, S32 *bytes_read=0)
static BOOL writeFile (const U8 *buffer, S32 bytes, LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type)
static void initClass (LLVFSThread *vfsthread=NULL)
static void cleanupClass ()
static LLVFSThreadgetVFSThread ()

Static Public Attributes

static const S32 READ = 0x00000001
static const S32 WRITE = 0x00000002
static const S32 READ_WRITE = 0x00000003
static const S32 APPEND = 0x00000006
static BOOL ALLOW_ASYNC = TRUE

Protected Member Functions

U32 threadPri ()

Protected Attributes

LLAssetType::EType mFileType
LLUUID mFileID
S32 mPosition
S32 mMode
LLVFSmVFS
F32 mPriority
BOOL mOnReadQueue
S32 mBytesRead
LLVFSThread::handle_t mHandle

Static Protected Attributes

static LLVFSThreadsVFSThread = NULL
static BOOL sAllocdVFSThread = FALSE

Detailed Description

Definition at line 40 of file llvfile.h.


Constructor & Destructor Documentation

LLVFile::LLVFile ( LLVFS vfs,
const LLUUID file_id,
const LLAssetType::EType  file_type,
S32  mode = LLVFile::READ 
)

Definition at line 53 of file llvfile.cpp.

References LLVFS::incLock(), mBytesRead, mFileID, mFileType, mHandle, mMode, mPosition, mPriority, mVFS, LLQueuedThread::nullHandle(), and VFSLOCK_OPEN.

LLVFile::~LLVFile (  ) 

Definition at line 69 of file llvfile.cpp.

References LLVFS::decLock(), LLQueuedThread::FLAG_ABORT, LLQueuedThread::FLAG_AUTO_COMPLETE, isReadComplete(), mFileID, mFileType, mHandle, mMode, mVFS, LLQueuedThread::nullHandle(), LLQueuedThread::setFlags(), sVFSThread, VFSLOCK_OPEN, and WRITE.


Member Function Documentation

void LLVFile::cleanupClass (  )  [static]

Definition at line 412 of file llvfile.cpp.

References NULL, sAllocdVFSThread, and sVFSThread.

Referenced by cleanup_app().

BOOL LLVFile::eof (  ) 

Definition at line 194 of file llvfile.cpp.

References getSize(), and mPosition.

Referenced by LLXfer_VFile::suck().

S32 LLVFile::getLastBytesRead (  ) 

Definition at line 189 of file llvfile.cpp.

References mBytesRead.

Referenced by LLHTTPAssetStorage::curlUpCallback(), LLAssetStorage::legacyGetDataCallback(), LLLiveLSLEditor::loadScriptText(), LLHTTPAssetRequest::readCompressedData(), readFile(), LLFloaterCompileQueue::scriptArrived(), LLViewerAssetStorage::storeAssetData(), LLXfer_VFile::suck(), and vfs_read().

S32 LLVFile::getMaxSize (  ) 

Definition at line 302 of file llvfile.cpp.

References LLVFS::getMaxSize(), mFileID, mFileType, mVFS, S32, and size.

S32 LLVFile::getSize (  ) 

Definition at line 294 of file llvfile.cpp.

References LLVFS::getSize(), mFileID, mFileType, mVFS, S32, size, VFSLOCK_APPEND, and waitForLock().

Referenced by LLHTTPAssetStorage::checkForTimeouts(), LLHTTPAssetStorage::curlDownCallback(), LLHTTPAssetStorage::curlUpCallback(), eof(), LLAssetStorage::getEstateAsset(), LLAssetStorage::getInvItemAsset(), LLVorbisDecodeState::initDecode(), LLLiveLSLEditor::loadScriptText(), onCovenantLoadComplete(), LLKeyframeMotion::onInitialize(), LLPreviewLSL::onLoadComplete(), LLPreviewNotecard::onLoadComplete(), LLPreviewGesture::onLoadComplete(), LLKeyframeMotion::onLoadComplete(), LLGestureManager::onLoadComplete(), LLPanelEstateCovenant::onLoadComplete(), LLLandmarkList::processGetAssetReply(), LLHTTPAssetRequest::readCompressedData(), readFile(), LLTransferSourceAsset::responderCallback(), seek(), LLXfer_VFile::startSend(), LLViewerAssetStorage::storeAssetData(), LLXfer_VFile::suck(), and vfs_seek().

static LLVFSThread* LLVFile::getVFSThread (  )  [inline, static]

Definition at line 69 of file llvfile.h.

References sVFSThread.

Referenced by update_statistics().

void LLVFile::initClass ( LLVFSThread vfsthread = NULL  )  [static]

Definition at line 394 of file llvfile.cpp.

References NULL, sAllocdVFSThread, LLVFSThread::sLocal, sVFSThread, and TRUE.

Referenced by init_cache().

bool LLVFile::isLocked ( EVFSLock  lock  ) 

Definition at line 421 of file llvfile.cpp.

References LLVFS::isLocked(), mFileID, mFileType, and mVFS.

Referenced by waitForLock().

BOOL LLVFile::isReadComplete (  ) 

Definition at line 167 of file llvfile.cpp.

References LLQueuedThread::completeRequest(), FALSE, LLVFSThread::Request::getBytesRead(), LLQueuedThread::getRequest(), mBytesRead, mHandle, mPosition, LLQueuedThread::nullHandle(), LLQueuedThread::STATUS_COMPLETE, sVFSThread, and TRUE.

Referenced by ~LLVFile().

BOOL LLVFile::read ( U8 buffer,
S32  bytes,
BOOL  async = FALSE,
F32  priority = 128.f 
)

Definition at line 89 of file llvfile.cpp.

References FALSE, llendl, llwarns, mBytesRead, mFileID, mFileType, mHandle, mMode, mPosition, mPriority, mVFS, LLQueuedThread::nullHandle(), LLVFSThread::read(), READ, LLVFSThread::readImmediate(), sVFSThread, threadPri(), TRUE, VFSLOCK_APPEND, and waitForLock().

Referenced by LLHTTPAssetStorage::curlUpCallback(), LLAssetStorage::legacyGetDataCallback(), LLLiveLSLEditor::loadScriptText(), onCovenantLoadComplete(), LLKeyframeMotion::onInitialize(), LLPreviewLSL::onLoadComplete(), LLPreviewNotecard::onLoadComplete(), LLPreviewGesture::onLoadComplete(), LLKeyframeMotion::onLoadComplete(), LLGestureManager::onLoadComplete(), LLPanelEstateCovenant::onLoadComplete(), LLLandmarkList::processGetAssetReply(), LLHTTPAssetRequest::readCompressedData(), readFile(), LLFloaterCompileQueue::scriptArrived(), LLViewerAssetStorage::storeAssetData(), LLXfer_VFile::suck(), and vfs_read().

U8 * LLVFile::readFile ( LLVFS vfs,
const LLUUID uuid,
LLAssetType::EType  type,
S32 bytes_read = 0 
) [static]

Definition at line 129 of file llvfile.cpp.

References getLastBytesRead(), getSize(), NULL, read(), READ, and S32.

Referenced by LLTexLayerSetBuffer::readBackAndUpload().

BOOL LLVFile::remove (  ) 

Definition at line 367 of file llvfile.cpp.

References llendl, llwarns, mFileID, mFileType, mHandle, mMode, mPosition, mVFS, LLQueuedThread::nullHandle(), LLVFS::removeFile(), TRUE, VFSLOCK_APPEND, VFSLOCK_READ, waitForLock(), and WRITE.

Referenced by LLHTTPAssetStorage::checkForTimeouts(), LLVorbisDecodeState::flushBadFile(), LLXfer_VFile::free(), LLAssetStorage::getEstateAsset(), LLAssetStorage::getInvItemAsset(), and LLTexLayerSetBuffer::readBackAndUpload().

BOOL LLVFile::rename ( const LLUUID new_id,
const LLAssetType::EType  new_type 
)

Definition at line 338 of file llvfile.cpp.

References LLVFS::decLock(), FALSE, LLVFS::incLock(), llendl, llwarns, mFileID, mFileType, mHandle, mMode, mVFS, LLQueuedThread::nullHandle(), LLVFS::renameFile(), TRUE, VFSLOCK_APPEND, VFSLOCK_OPEN, VFSLOCK_READ, waitForLock(), and WRITE.

Referenced by LLHTTPAssetStorage::checkForTimeouts(), and LLXfer_VFile::processEOF().

BOOL LLVFile::seek ( S32  offset,
S32  origin = -1 
)

Definition at line 253 of file llvfile.cpp.

References APPEND, FALSE, getSize(), llendl, llwarns, mMode, mPosition, S32, size, and TRUE.

Referenced by LLXfer_VFile::suck(), and vfs_seek().

BOOL LLVFile::setMaxSize ( S32  size  ) 

Definition at line 309 of file llvfile.cpp.

References LLVFS::checkAvailable(), count, FALSE, LLFastTimer::FTM_VFILE_WAIT, LLQueuedThread::getPending(), LLThread::isPaused(), llendl, llinfos, llwarns, mFileID, mFileType, mMode, ms_sleep(), mVFS, S32, LLVFS::setMaxSize(), sVFSThread, t, LLQueuedThread::update(), and WRITE.

Referenced by LLHTTPAssetStorage::curlDownCallback(), LLPreviewNotecard::saveIfNeeded(), LLPreviewGesture::saveIfNeeded(), LLXfer_VFile::setXferSize(), LLViewerAssetStorage::storeAssetData(), LLHTTPAssetStorage::storeAssetData(), upload_new_resource(), and writeFile().

void LLVFile::setReadPriority ( const F32  priority  ) 

Definition at line 158 of file llvfile.cpp.

References mHandle, mPriority, LLQueuedThread::nullHandle(), LLQueuedThread::setPriority(), sVFSThread, and threadPri().

S32 LLVFile::tell (  )  const

Definition at line 289 of file llvfile.cpp.

References mPosition.

Referenced by LLHTTPAssetStorage::curlUpCallback(), LLHTTPAssetRequest::readCompressedData(), and vfs_tell().

U32 LLVFile::threadPri (  )  [inline, protected]

Definition at line 74 of file llvfile.h.

References llmin(), mPriority, and LLQueuedThread::PRIORITY_NORMAL.

Referenced by read(), and setReadPriority().

void LLVFile::waitForLock ( EVFSLock  lock  ) 

Definition at line 426 of file llvfile.cpp.

References LLFastTimer::FTM_VFILE_WAIT, isLocked(), LLThread::isPaused(), ms_sleep(), sVFSThread, t, and LLQueuedThread::update().

Referenced by getSize(), read(), remove(), rename(), and write().

BOOL LLVFile::write ( const U8 buffer,
S32  bytes 
)

Definition at line 199 of file llvfile.cpp.

References APPEND, FALSE, LLQueuedThread::FLAG_AUTO_COMPLETE, LLQueuedThread::FLAG_AUTO_DELETE, llendl, llerrs, llwarns, mFileID, mFileType, mHandle, mMode, mPosition, mVFS, LLQueuedThread::nullHandle(), S32, sVFSThread, TRUE, VFSLOCK_APPEND, VFSLOCK_READ, waitForLock(), LLVFSThread::write(), WRITE, and LLVFSThread::writeImmediate().

Referenced by LLHTTPAssetStorage::curlDownCallback(), LLVorbisDecodeState::finishDecode(), LLXfer_VFile::flush(), LLPreviewNotecard::saveIfNeeded(), LLPreviewGesture::saveIfNeeded(), LLViewerAssetStorage::storeAssetData(), LLHTTPAssetStorage::storeAssetData(), upload_new_resource(), and writeFile().

BOOL LLVFile::writeFile ( const U8 buffer,
S32  bytes,
LLVFS vfs,
const LLUUID uuid,
LLAssetType::EType  type 
) [static]

Definition at line 246 of file llvfile.cpp.

References setMaxSize(), write(), and WRITE.

Referenced by LLFloaterAuction::onClickSnapshot(), LLTexLayerSetBuffer::readBackAndUpload(), LLSnapshotLivePreview::saveTexture(), LLFloaterPostcard::sendPostcard(), and LLFloaterReporter::takeScreenshot().


Member Data Documentation

BOOL LLVFile::ALLOW_ASYNC = TRUE [static]

Definition at line 82 of file llvfile.h.

const S32 LLVFile::APPEND = 0x00000006 [static]

Definition at line 80 of file llvfile.h.

Referenced by LLTransferTargetVFile::completionCallback(), LLHTTPAssetStorage::curlDownCallback(), LLTransferTargetVFile::dataCallback(), LLXfer_VFile::flush(), LLFloaterAnimPreview::onBtnOK(), LLPreviewNotecard::saveIfNeeded(), LLPreviewGesture::saveIfNeeded(), seek(), LLXfer_VFile::setXferSize(), LLXfer_VFile::startDownload(), and write().

S32 LLVFile::mBytesRead [protected]

Definition at line 94 of file llvfile.h.

Referenced by getLastBytesRead(), isReadComplete(), LLVFile(), and read().

LLUUID LLVFile::mFileID [protected]

Definition at line 87 of file llvfile.h.

Referenced by getMaxSize(), getSize(), isLocked(), LLVFile(), read(), remove(), rename(), setMaxSize(), write(), and ~LLVFile().

LLAssetType::EType LLVFile::mFileType [protected]

Definition at line 85 of file llvfile.h.

Referenced by getMaxSize(), getSize(), isLocked(), LLVFile(), read(), remove(), rename(), setMaxSize(), write(), and ~LLVFile().

LLVFSThread::handle_t LLVFile::mHandle [protected]

Definition at line 95 of file llvfile.h.

Referenced by isReadComplete(), LLVFile(), read(), remove(), rename(), setReadPriority(), write(), and ~LLVFile().

S32 LLVFile::mMode [protected]

Definition at line 89 of file llvfile.h.

Referenced by LLVFile(), read(), remove(), rename(), seek(), setMaxSize(), write(), and ~LLVFile().

BOOL LLVFile::mOnReadQueue [protected]

Definition at line 92 of file llvfile.h.

S32 LLVFile::mPosition [protected]

Definition at line 88 of file llvfile.h.

Referenced by eof(), isReadComplete(), LLVFile(), read(), remove(), seek(), tell(), and write().

F32 LLVFile::mPriority [protected]

Definition at line 91 of file llvfile.h.

Referenced by LLVFile(), read(), setReadPriority(), and threadPri().

LLVFS* LLVFile::mVFS [protected]

Definition at line 90 of file llvfile.h.

Referenced by getMaxSize(), getSize(), isLocked(), LLVFile(), read(), remove(), rename(), setMaxSize(), write(), and ~LLVFile().

const S32 LLVFile::READ = 0x00000001 [static]

Definition at line 77 of file llvfile.h.

Referenced by LLHTTPAssetStorage::curlUpCallback(), LLTransferSourceAsset::dataCallback(), onCovenantLoadComplete(), LLPreviewNotecard::onLoadComplete(), LLPreviewGesture::onLoadComplete(), LLKeyframeMotion::onLoadComplete(), LLGestureManager::onLoadComplete(), LLPanelEstateCovenant::onLoadComplete(), LLHTTPAssetRequest::prepareCompressedUpload(), read(), readFile(), LLTransferSourceAsset::responderCallback(), LLXfer_VFile::startSend(), and LLViewerAssetStorage::storeAssetData().

const S32 LLVFile::READ_WRITE = 0x00000003 [static]

Definition at line 79 of file llvfile.h.

BOOL LLVFile::sAllocdVFSThread = FALSE [static, protected]

Definition at line 73 of file llvfile.h.

Referenced by cleanupClass(), and initClass().

LLVFSThread * LLVFile::sVFSThread = NULL [static, protected]

Definition at line 72 of file llvfile.h.

Referenced by cleanupClass(), getVFSThread(), initClass(), isReadComplete(), read(), setMaxSize(), setReadPriority(), waitForLock(), write(), and ~LLVFile().

const S32 LLVFile::WRITE = 0x00000002 [static]

Definition at line 78 of file llvfile.h.

Referenced by LLTransferTargetVFile::completionCallback(), LLXfer_VFile::free(), LLXfer_VFile::processEOF(), LLTexLayerSetBuffer::readBackAndUpload(), remove(), rename(), setMaxSize(), LLViewerAssetStorage::storeAssetData(), LLHTTPAssetStorage::storeAssetData(), upload_new_resource(), write(), writeFile(), and ~LLVFile().


The documentation for this class was generated from the following files:
Generated on Thu Jul 1 06:11:56 2010 for Second Life Viewer by  doxygen 1.4.7