mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-26 18:21:04 +00:00
Improve cache ahndling.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@19293 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
bd51b8caea
commit
20c509536e
2 changed files with 40 additions and 14 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2004-05-12 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSURL.m: ([-loadResourceDataNotifyingClient:usingCache:])
|
||||||
|
used cached information if requested. Always load using a cached
|
||||||
|
handle so that results will be available to later calls.
|
||||||
|
Addresses bug #8901
|
||||||
|
|
||||||
2004-05-09 David Ayers <d.ayers@inode.at>
|
2004-05-09 David Ayers <d.ayers@inode.at>
|
||||||
|
|
||||||
* Headers/Additions/GNUstepBase/GSObjCRuntime.h
|
* Headers/Additions/GNUstepBase/GSObjCRuntime.h
|
||||||
|
|
|
@ -1132,8 +1132,26 @@ static unsigned urlAlign;
|
||||||
- (void) loadResourceDataNotifyingClient: (id)client
|
- (void) loadResourceDataNotifyingClient: (id)client
|
||||||
usingCache: (BOOL)shouldUseCache
|
usingCache: (BOOL)shouldUseCache
|
||||||
{
|
{
|
||||||
NSURLHandle *handle = [self URLHandleUsingCache: shouldUseCache];
|
NSURLHandle *handle = [self URLHandleUsingCache: YES];
|
||||||
|
NSData *d;
|
||||||
|
|
||||||
|
if (shouldUseCache == YES && (d = [handle availableResourceData]) != nil)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* We already have cached data we should use.
|
||||||
|
*/
|
||||||
|
if ([client respondsToSelector:
|
||||||
|
@selector(URL:resourceDataDidBecomeAvailable:)])
|
||||||
|
{
|
||||||
|
[client URL: self resourceDataDidBecomeAvailable: d];
|
||||||
|
}
|
||||||
|
if ([client respondsToSelector: @selector(URLResourceDidFinishLoading:)])
|
||||||
|
{
|
||||||
|
[client URLResourceDidFinishLoading: self];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (client != nil)
|
if (client != nil)
|
||||||
{
|
{
|
||||||
[clientsLock lock];
|
[clientsLock lock];
|
||||||
|
@ -1152,6 +1170,7 @@ static unsigned urlAlign;
|
||||||
*/
|
*/
|
||||||
[handle loadInBackground];
|
[handle loadInBackground];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the parameter portion of the receiver or nil if there is no
|
* Returns the parameter portion of the receiver or nil if there is no
|
||||||
|
@ -1335,7 +1354,7 @@ static unsigned urlAlign;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the resource data for the represented URL and returns the result.
|
* Loads the resource data for the represented URL and returns the result.
|
||||||
* The shoulduseCache flag determines whether an existing cached NSURLHandle
|
* The shouldUseCache flag determines whether an existing cached NSURLHandle
|
||||||
* can be used to provide the data.
|
* can be used to provide the data.
|
||||||
*/
|
*/
|
||||||
- (NSData*) resourceDataUsingCache: (BOOL)shouldUseCache
|
- (NSData*) resourceDataUsingCache: (BOOL)shouldUseCache
|
||||||
|
|
Loading…
Reference in a new issue