diff options
-rw-r--r-- | WebKit/android/WebCoreSupport/WebRequest.cpp | 5 | ||||
-rw-r--r-- | WebKit/android/WebCoreSupport/WebRequest.h | 3 | ||||
-rw-r--r-- | WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp | 8 |
3 files changed, 9 insertions, 7 deletions
diff --git a/WebKit/android/WebCoreSupport/WebRequest.cpp b/WebKit/android/WebCoreSupport/WebRequest.cpp index d24c6cc..937a365 100644 --- a/WebKit/android/WebCoreSupport/WebRequest.cpp +++ b/WebKit/android/WebCoreSupport/WebRequest.cpp @@ -113,11 +113,12 @@ void WebRequest::finish(bool success) m_request = 0; } -void WebRequest::AppendBytesToUpload(const char* bytes, int bytesLen) +void WebRequest::AppendBytesToUpload(WTF::Vector<char>* data) { // AppendBytesToUpload is only valid before calling start ASSERT(m_loadState == Created, "Start called on a WebRequest not in CREATED state: (%s)", m_url.c_str()); - m_request->AppendBytesToUpload(bytes, bytesLen); + m_request->AppendBytesToUpload(data->data(), data->size()); + delete data; } void WebRequest::start(bool isPrivateBrowsing) diff --git a/WebKit/android/WebCoreSupport/WebRequest.h b/WebKit/android/WebCoreSupport/WebRequest.h index 987d8ae..408ec4e 100644 --- a/WebKit/android/WebCoreSupport/WebRequest.h +++ b/WebKit/android/WebCoreSupport/WebRequest.h @@ -28,6 +28,7 @@ #include "ChromiumIncludes.h" #include "WebUrlLoaderClient.h" +#include "wtf/Vector.h" class MessageLoop; @@ -58,7 +59,7 @@ public: WebRequest(WebUrlLoaderClient*, WebResourceRequest, int inputStream); // Optional, but if used has to be called before start - void AppendBytesToUpload(const char* bytes, int bytesLen); + void AppendBytesToUpload(Vector<char>* data); void start(bool isPrivateBrowsing); void cancel(); diff --git a/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp b/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp index 6225413..7a9125a 100644 --- a/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp +++ b/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp @@ -120,11 +120,11 @@ WebUrlLoaderClient::WebUrlLoaderClient(WebFrame* webFrame, WebCore::ResourceHand if (!element.m_data.isEmpty()) { // WebKit sometimes gives up empty data to append. These aren't // necessary so we just optimize those out here. - int size = static_cast<int>(element.m_data.size()); - // TODO: do we have to make a copy of this data? base::Thread* thread = ioThread(); - if (thread) - thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(m_request, &WebRequest::AppendBytesToUpload, element.m_data.data(), size)); + if (thread) { + Vector<char>* data = new Vector<char>(element.m_data); + thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(m_request, &WebRequest::AppendBytesToUpload, data)); + } } break; #if ENABLE(BLOB) |