Set wxWebResponseCURL buffer size as soon as known
Currently for wxWebRequestCURL objects using memory storage, a download is processed by appending to a wxMemoryBuffer each time the write callback is called. For a large transfer, this can result in many, many reallocation calls and can block the main application. This commit uses the progress callback for wxWebRequestCURL objects added in a previous commit to set a minimum size for the buffer as soon as it is known.
This commit is contained in:
@@ -114,11 +114,12 @@ public:
|
||||
// Methods called from libcurl callbacks
|
||||
size_t CURLOnWrite(void *buffer, size_t size);
|
||||
size_t CURLOnHeader(const char* buffer, size_t size);
|
||||
int CURLOnProgress();
|
||||
int CURLOnProgress(curl_off_t);
|
||||
|
||||
private:
|
||||
wxWebRequestHeaderMap m_headers;
|
||||
wxString m_statusText;
|
||||
wxFileOffset m_knownDownloadSize;
|
||||
|
||||
CURL* GetHandle() const
|
||||
{ return static_cast<wxWebRequestCURL&>(m_request).GetHandle(); }
|
||||
|
Reference in New Issue
Block a user