mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
[not part of build] Implemented nsCacheEntryDescriptor::GetFile().
This commit is contained in:
parent
22e5a9f6da
commit
1f859d742c
3
netwerk/cache/src/nsCacheDevice.h
vendored
3
netwerk/cache/src/nsCacheDevice.h
vendored
@ -50,6 +50,9 @@ public:
|
||||
nsCacheAccessMode mode,
|
||||
nsITransport **result ) = 0;
|
||||
|
||||
virtual nsresult GetFileForEntry( nsCacheEntry * entry,
|
||||
nsIFile ** result ) = 0;
|
||||
|
||||
virtual nsresult OnDataSizeChange( nsCacheEntry * entry, PRInt32 deltaSize ) = 0;
|
||||
|
||||
// XXX need to define methods for enumerating entries
|
||||
|
2
netwerk/cache/src/nsCacheEntryDescriptor.cpp
vendored
2
netwerk/cache/src/nsCacheEntryDescriptor.cpp
vendored
@ -279,7 +279,7 @@ nsCacheEntryDescriptor::GetFile(nsIFile ** result)
|
||||
NS_ENSURE_ARG_POINTER(result);
|
||||
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return nsCacheService::GlobalInstance()->GetFileForEntry(mCacheEntry, result);
|
||||
}
|
||||
|
||||
|
||||
|
15
netwerk/cache/src/nsCacheService.cpp
vendored
15
netwerk/cache/src/nsCacheService.cpp
vendored
@ -179,7 +179,7 @@ nsCacheService::CreateSession(const char * clientID,
|
||||
/* void visitEntries (in nsICacheVisitor visitor); */
|
||||
NS_IMETHODIMP nsCacheService::VisitEntries(nsICacheVisitor *visitor)
|
||||
{
|
||||
nsAutoLock cacheService(mCacheServiceLock);
|
||||
nsAutoLock lock(mCacheServiceLock);
|
||||
|
||||
// XXX record the fact that a visitation is in progress, i.e. keep
|
||||
// list of visitors in progress.
|
||||
@ -344,7 +344,7 @@ nsCacheService::OpenCacheEntry(nsCacheSession * session,
|
||||
nsresult rv = CreateRequest(session, key, accessRequested, listener, &request);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsAutoLock cacheService(mCacheServiceLock);
|
||||
nsAutoLock lock(mCacheServiceLock);
|
||||
rv = ProcessRequest(request, result);
|
||||
|
||||
// delete requests that have completed
|
||||
@ -466,6 +466,7 @@ nsCacheService::EnsureEntryHasDevice(nsCacheEntry * entry)
|
||||
nsresult
|
||||
nsCacheService::ValidateEntry(nsCacheEntry * entry)
|
||||
{
|
||||
nsAutoLock lock(mCacheServiceLock);
|
||||
nsCacheDevice * device = EnsureEntryHasDevice(entry);
|
||||
if (!device) return NS_ERROR_UNEXPECTED; // XXX need better error here
|
||||
|
||||
@ -566,6 +567,16 @@ nsCacheService::CloseDescriptor(nsCacheEntryDescriptor * descriptor)
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsCacheService::GetFileForEntry(nsCacheEntry * entry,
|
||||
nsIFile ** result)
|
||||
{
|
||||
nsAutoLock lock(mCacheServiceLock);
|
||||
nsCacheDevice * device = EnsureEntryHasDevice(entry);
|
||||
if (!device) return NS_ERROR_UNEXPECTED; // XXX need better error here
|
||||
return device->GetFileForEntry(entry, result);
|
||||
}
|
||||
|
||||
void
|
||||
nsCacheService::DeactivateEntry(nsCacheEntry * entry)
|
||||
{
|
||||
|
5
netwerk/cache/src/nsCacheService.h
vendored
5
netwerk/cache/src/nsCacheService.h
vendored
@ -84,10 +84,13 @@ public:
|
||||
|
||||
nsresult GetTransportForEntry(nsCacheEntry * entry,
|
||||
nsCacheAccessMode mode,
|
||||
nsITransport ** result);
|
||||
nsITransport ** result);
|
||||
|
||||
void CloseDescriptor(nsCacheEntryDescriptor * descriptor);
|
||||
|
||||
nsresult GetFileForEntry(nsCacheEntry * entry,
|
||||
nsIFile ** result);
|
||||
|
||||
|
||||
/**
|
||||
* Methods called by any cache classes
|
||||
|
7
netwerk/cache/src/nsDiskCacheDevice.cpp
vendored
7
netwerk/cache/src/nsDiskCacheDevice.cpp
vendored
@ -386,6 +386,13 @@ nsDiskCacheDevice::GetTransportForEntry(nsCacheEntry * entry,
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDiskCacheDevice::GetFileForEntry(nsCacheEntry * entry,
|
||||
nsIFile ** result)
|
||||
{
|
||||
return getFileForKey(entry->Key()->get(), PR_FALSE, result);
|
||||
}
|
||||
|
||||
/**
|
||||
* This routine will get called every time an open descriptor.
|
||||
*/
|
||||
|
3
netwerk/cache/src/nsDiskCacheDevice.h
vendored
3
netwerk/cache/src/nsDiskCacheDevice.h
vendored
@ -48,6 +48,9 @@ public:
|
||||
nsCacheAccessMode mode,
|
||||
nsITransport ** result);
|
||||
|
||||
virtual nsresult GetFileForEntry(nsCacheEntry * entry,
|
||||
nsIFile ** result);
|
||||
|
||||
virtual nsresult OnDataSizeChange(nsCacheEntry * entry, PRInt32 deltaSize);
|
||||
|
||||
virtual nsresult Visit(nsICacheVisitor * visitor);
|
||||
|
8
netwerk/cache/src/nsMemoryCacheDevice.cpp
vendored
8
netwerk/cache/src/nsMemoryCacheDevice.cpp
vendored
@ -206,6 +206,14 @@ nsMemoryCacheDevice::GetTransportForEntry( nsCacheEntry * entry,
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsMemoryCacheDevice::GetFileForEntry( nsCacheEntry * entry,
|
||||
nsIFile ** result )
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsMemoryCacheDevice::OnDataSizeChange( nsCacheEntry * entry, PRInt32 deltaSize)
|
||||
{
|
||||
|
3
netwerk/cache/src/nsMemoryCacheDevice.h
vendored
3
netwerk/cache/src/nsMemoryCacheDevice.h
vendored
@ -48,6 +48,9 @@ public:
|
||||
nsCacheAccessMode mode,
|
||||
nsITransport **transport );
|
||||
|
||||
virtual nsresult GetFileForEntry( nsCacheEntry * entry,
|
||||
nsIFile ** result );
|
||||
|
||||
virtual nsresult OnDataSizeChange( nsCacheEntry * entry, PRInt32 deltaSize );
|
||||
|
||||
virtual nsresult Visit( nsICacheVisitor * visitor );
|
||||
|
Loading…
Reference in New Issue
Block a user