Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1193)

Unified Diff: content/child/npapi/plugin_url_fetcher.cc

Issue 139303020: Merge 245600 "Give QuickTime the plugin stream data in writeable..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1750/src/
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/child/npapi/plugin_url_fetcher.h ('k') | content/child/npapi/webplugin_delegate_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/npapi/plugin_url_fetcher.cc
===================================================================
--- content/child/npapi/plugin_url_fetcher.cc (revision 245614)
+++ content/child/npapi/plugin_url_fetcher.cc (working copy)
@@ -4,6 +4,7 @@
#include "content/child/npapi/plugin_url_fetcher.h"
+#include "base/memory/scoped_ptr.h"
#include "content/child/child_thread.h"
#include "content/child/npapi/webplugin.h"
#include "content/child/npapi/plugin_host.h"
@@ -80,7 +81,8 @@
bool is_plugin_src_load,
int origin_pid,
int render_view_id,
- unsigned long resource_id)
+ unsigned long resource_id,
+ bool copy_stream_data)
: plugin_stream_(plugin_stream),
url_(url),
first_party_for_cookies_(first_party_for_cookies),
@@ -89,6 +91,7 @@
notify_redirects_(notify_redirects),
is_plugin_src_load_(is_plugin_src_load),
resource_id_(resource_id),
+ copy_stream_data_(copy_stream_data),
data_offset_(0),
pending_failure_notification_(false) {
webkit_glue::ResourceLoaderBridge::RequestInfo request_info;
@@ -301,7 +304,17 @@
} else {
int64 offset = data_offset_;
data_offset_ += data_length;
- plugin_stream_->DidReceiveData(data, data_length, offset);
+
+ if (copy_stream_data_) {
+ // QuickTime writes to this memory, and since we got it from
+ // ResourceDispatcher it's not mapped for write access in this process.
+ // http://crbug.com/308466.
+ scoped_ptr<char[]> data_copy(new char[data_length]);
+ memcpy(data_copy.get(), data, data_length);
+ plugin_stream_->DidReceiveData(data_copy.get(), data_length, offset);
+ } else {
+ plugin_stream_->DidReceiveData(data, data_length, offset);
+ }
// DANGER: this instance may be deleted at this point.
}
}
« no previous file with comments | « content/child/npapi/plugin_url_fetcher.h ('k') | content/child/npapi/webplugin_delegate_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698