Bug 1354389. P2 - remove the unused function. r?cpearce
MozReview-Commit-ID: 4Mx89MxJmVO
--- a/dom/media/MediaCache.cpp
+++ b/dom/media/MediaCache.cpp
@@ -147,18 +147,16 @@ public:
// Cache-file access methods. These are the lowest-level cache methods.
// mReentrantMonitor must be held; these can be called on any thread.
// This can return partial reads.
// Note mReentrantMonitor will be dropped while doing IO. The caller need
// to handle changes happening when the monitor is not held.
nsresult ReadCacheFile(int64_t aOffset, void* aData, int32_t aLength,
int32_t* aBytes);
- // This will fail if all aLength bytes are not read
- nsresult ReadCacheFileAllBytes(int64_t aOffset, void* aData, int32_t aLength);
int64_t AllocateResourceID()
{
mReentrantMonitor.AssertCurrentThreadIn();
return mNextResourceID++;
}
// mReentrantMonitor must be held, called on main thread.
@@ -684,39 +682,16 @@ MediaCache::ReadCacheFile(
// TODO: fix calls of ReadCacheFile() to handle state changes happening when
// the monitor is not held.
ReentrantMonitorAutoExit unlock(mReentrantMonitor);
return fileCache->Read(aOffset,
reinterpret_cast<uint8_t*>(aData), aLength, aBytes);
}
}
-nsresult
-MediaCache::ReadCacheFileAllBytes(int64_t aOffset, void* aData, int32_t aLength)
-{
- mReentrantMonitor.AssertCurrentThreadIn();
-
- int64_t offset = aOffset;
- int32_t count = aLength;
- // Cast to char* so we can do byte-wise pointer arithmetic
- char* data = static_cast<char*>(aData);
- while (count > 0) {
- int32_t bytes;
- nsresult rv = ReadCacheFile(offset, data, count, &bytes);
- if (NS_FAILED(rv))
- return rv;
- if (bytes == 0)
- return NS_ERROR_FAILURE;
- count -= bytes;
- data += bytes;
- offset += bytes;
- }
- return NS_OK;
-}
-
static int32_t GetMaxBlocks()
{
// We look up the cache size every time. This means dynamic changes
// to the pref are applied.
// Cache size is in KB
int32_t cacheSize = Preferences::GetInt("media.cache_size", 500*1024);
int64_t maxBlocks = static_cast<int64_t>(cacheSize)*1024/MediaCache::BLOCK_SIZE;
maxBlocks = std::max<int64_t>(maxBlocks, 1);