1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-20 01:14:20 +00:00

Add URL stream progress support on OSX/iOS

This commit is contained in:
hogliux 2015-04-17 17:44:56 +01:00
parent 0c3023327a
commit 0bac9fefc6

View file

@ -128,7 +128,8 @@ public:
hasFailed (false),
hasFinished (false),
numRedirectsToFollow (maxRedirects),
numRedirects (0)
numRedirects (0),
latestTotalBytes (0)
{
static DelegateClass cls;
delegate = [cls.createInstance() init];
@ -152,7 +153,7 @@ public:
while (isThreadRunning() && ! initialised)
{
if (callback != nullptr)
callback (context, -1, (int) [[request HTTPBody] length]);
callback (context, latestTotalBytes, (int) [[request HTTPBody] length]);
Thread::sleep (1);
}
@ -245,8 +246,9 @@ public:
initialised = true;
}
void didSendBodyData (NSInteger /*totalBytesWritten*/, NSInteger /*totalBytesExpected*/)
void didSendBodyData (NSInteger totalBytesWritten, NSInteger /*totalBytesExpected*/)
{
latestTotalBytes = totalBytesWritten;
}
void finishedLoading()
@ -280,6 +282,7 @@ public:
bool initialised, hasFailed, hasFinished;
const int numRedirectsToFollow;
int numRedirects;
int latestTotalBytes;
private:
//==============================================================================