summaryrefslogtreecommitdiffstats
path: root/chrome_frame/plugin_url_request.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome_frame/plugin_url_request.cc')
-rw-r--r--chrome_frame/plugin_url_request.cc34
1 files changed, 18 insertions, 16 deletions
diff --git a/chrome_frame/plugin_url_request.cc b/chrome_frame/plugin_url_request.cc
index 8af3e1e..e0166bc 100644
--- a/chrome_frame/plugin_url_request.cc
+++ b/chrome_frame/plugin_url_request.cc
@@ -14,8 +14,7 @@ PluginUrlRequest::PluginUrlRequest()
enable_frame_busting_(false),
resource_type_(ResourceType::MAIN_FRAME),
load_flags_(0),
- is_chunked_upload_(false),
- upload_data_(NULL) {
+ is_chunked_upload_(false) {
}
PluginUrlRequest::~PluginUrlRequest() {
@@ -35,22 +34,25 @@ bool PluginUrlRequest::Initialize(PluginUrlRequestDelegate* delegate,
resource_type_ = resource_type;
load_flags_ = load_flags;
- if (upload_data && upload_data->GetContentLength()) {
- post_data_len_ = upload_data->GetContentLength();
- is_chunked_upload_ = upload_data->is_chunked();
-
-#pragma warning(disable:4244)
- upload_data_.reserve(post_data_len_);
-#pragma warning(default:4244)
-
- std::vector<net::UploadData::Element>::iterator element_index;
- for (element_index = upload_data->elements()->begin();
- element_index != upload_data->elements()->end();
- ++element_index) {
- std::copy(element_index->bytes().begin(), element_index->bytes().end(),
- std::back_inserter(upload_data_));
+ if (upload_data) {
+ // We store a pointer to UrlmonUploadDataStream and not net::UploadData
+ // since UrlmonUploadDataStream implements thread safe ref counting and
+ // UploadData does not.
+ CComObject<UrlmonUploadDataStream>* upload_stream = NULL;
+ HRESULT hr = CComObject<UrlmonUploadDataStream>::CreateInstance(
+ &upload_stream);
+ if (FAILED(hr)) {
+ NOTREACHED();
+ } else {
+ post_data_len_ = upload_data->GetContentLength();
+ upload_stream->AddRef();
+ upload_stream->Initialize(upload_data);
+ upload_data_.Attach(upload_stream);
+ is_chunked_upload_ = upload_data->is_chunked();
}
}
+
enable_frame_busting_ = enable_frame_busting;
+
return true;
}