summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-29 22:35:33 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-29 22:35:33 +0000
commitea3d1d84be3d6f97bf50e76511c9e26af6895533 (patch)
tree94c73f600dcca23329221ad8c51e6a5158263f7e /chrome/renderer
parent403e46333b43009776a08273501e4ca8c5c06e12 (diff)
downloadchromium_src-ea3d1d84be3d6f97bf50e76511c9e26af6895533.zip
chromium_src-ea3d1d84be3d6f97bf50e76511c9e26af6895533.tar.gz
chromium_src-ea3d1d84be3d6f97bf50e76511c9e26af6895533.tar.bz2
Fix passing pointers between processes.
BUG=31880 Review URL: http://codereview.chromium.org/558036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37555 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/webplugin_delegate_pepper.cc34
-rw-r--r--chrome/renderer/webplugin_delegate_pepper.h14
-rw-r--r--chrome/renderer/webplugin_delegate_proxy.cc92
-rw-r--r--chrome/renderer/webplugin_delegate_proxy.h23
4 files changed, 66 insertions, 97 deletions
diff --git a/chrome/renderer/webplugin_delegate_pepper.cc b/chrome/renderer/webplugin_delegate_pepper.cc
index d25364f..b9b61fe 100644
--- a/chrome/renderer/webplugin_delegate_pepper.cc
+++ b/chrome/renderer/webplugin_delegate_pepper.cc
@@ -173,11 +173,8 @@ NPObject* WebPluginDelegatePepper::GetPluginScriptableObject() {
}
void WebPluginDelegatePepper::DidFinishLoadWithReason(
- const GURL& url,
- NPReason reason,
- intptr_t notify_data) {
- instance()->DidFinishLoadWithReason(
- url, reason, reinterpret_cast<void*>(notify_data));
+ const GURL& url, NPReason reason, int notify_id) {
+ instance()->DidFinishLoadWithReason(url, reason, notify_id);
}
int WebPluginDelegatePepper::GetProcessId() {
@@ -189,10 +186,8 @@ void WebPluginDelegatePepper::SendJavaScriptStream(
const GURL& url,
const std::string& result,
bool success,
- bool notify_needed,
- intptr_t notify_data) {
- instance()->SendJavaScriptStream(url, result, success, notify_needed,
- notify_data);
+ int notify_id) {
+ instance()->SendJavaScriptStream(url, result, success, notify_id);
}
void WebPluginDelegatePepper::DidReceiveManualResponse(
@@ -220,22 +215,13 @@ FilePath WebPluginDelegatePepper::GetPluginPath() {
}
WebPluginResourceClient* WebPluginDelegatePepper::CreateResourceClient(
- unsigned long resource_id, const GURL& url, bool notify_needed,
- intptr_t notify_data, intptr_t existing_stream) {
- // Stream already exists. This typically happens for range requests
- // initiated via NPN_RequestRead.
- if (existing_stream) {
- NPAPI::PluginStream* plugin_stream =
- reinterpret_cast<NPAPI::PluginStream*>(existing_stream);
-
- return plugin_stream->AsResourceClient();
- }
+ unsigned long resource_id, const GURL& url, int notify_id) {
+ return instance()->CreateStream(resource_id, url, std::string(), notify_id);
+}
- std::string mime_type;
- NPAPI::PluginStreamUrl *stream = instance()->CreateStream(
- resource_id, url, mime_type, notify_needed,
- reinterpret_cast<void*>(notify_data));
- return stream;
+WebPluginResourceClient* WebPluginDelegatePepper::CreateSeekableResourceClient(
+ unsigned long resource_id, int range_request_id) {
+ return instance()->GetRangeRequest(range_request_id);
}
NPError WebPluginDelegatePepper::Device2DQueryCapability(int32 capability,
diff --git a/chrome/renderer/webplugin_delegate_pepper.h b/chrome/renderer/webplugin_delegate_pepper.h
index b2ac3c6..b316789 100644
--- a/chrome/renderer/webplugin_delegate_pepper.h
+++ b/chrome/renderer/webplugin_delegate_pepper.h
@@ -53,12 +53,12 @@ class WebPluginDelegatePepper : public webkit_glue::WebPluginDelegate {
WebKit::WebCursorInfo* cursor);
virtual NPObject* GetPluginScriptableObject();
virtual void DidFinishLoadWithReason(const GURL& url, NPReason reason,
- intptr_t notify_data);
+ int notify_id);
virtual int GetProcessId();
virtual void SendJavaScriptStream(const GURL& url,
const std::string& result,
- bool success, bool notify_needed,
- intptr_t notify_data);
+ bool success,
+ int notify_id);
virtual void DidReceiveManualResponse(const GURL& url,
const std::string& mime_type,
const std::string& headers,
@@ -69,11 +69,9 @@ class WebPluginDelegatePepper : public webkit_glue::WebPluginDelegate {
virtual void DidManualLoadFail();
virtual void InstallMissingPlugin();
virtual webkit_glue::WebPluginResourceClient* CreateResourceClient(
- unsigned long resource_id,
- const GURL& url,
- bool notify_needed,
- intptr_t notify_data,
- intptr_t stream);
+ unsigned long resource_id, const GURL& url, int notify_id);
+ virtual webkit_glue::WebPluginResourceClient* CreateSeekableResourceClient(
+ unsigned long resource_id, int range_request_id);
// WebPlugin2DDeviceDelegate implementation.
virtual NPError Device2DQueryCapability(int32 capability, int32* value);
diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc
index 5cfe049..83666d5 100644
--- a/chrome/renderer/webplugin_delegate_proxy.cc
+++ b/chrome/renderer/webplugin_delegate_proxy.cc
@@ -66,31 +66,24 @@ class ResourceClientProxy : public webkit_glue::WebPluginResourceClient {
public:
ResourceClientProxy(PluginChannelHost* channel, int instance_id)
: channel_(channel), instance_id_(instance_id), resource_id_(0),
- notify_needed_(false), notify_data_(0),
multibyte_response_expected_(false) {
}
~ResourceClientProxy() {
}
- void Initialize(unsigned long resource_id, const GURL& url,
- bool notify_needed, intptr_t notify_data,
- intptr_t existing_stream) {
+ void Initialize(unsigned long resource_id, const GURL& url, int notify_id) {
resource_id_ = resource_id;
- url_ = url;
- notify_needed_ = notify_needed;
- notify_data_ = notify_data;
-
- PluginMsg_URLRequestReply_Params params;
- params.resource_id = resource_id;
- params.url = url_;
- params.notify_needed = notify_needed_;
- params.notify_data = notify_data_;
- params.stream = existing_stream;
-
- multibyte_response_expected_ = (existing_stream != 0);
+ channel_->Send(new PluginMsg_HandleURLRequestReply(
+ instance_id_, resource_id, url, notify_id));
+ }
- channel_->Send(new PluginMsg_HandleURLRequestReply(instance_id_, params));
+ void InitializeForSeekableStream(unsigned long resource_id,
+ int range_request_id) {
+ resource_id_ = resource_id;
+ multibyte_response_expected_ = true;
+ channel_->Send(new PluginMsg_HTTPRangeRequestReply(
+ instance_id_, resource_id, range_request_id));
}
// PluginResourceClient implementation:
@@ -154,9 +147,6 @@ class ResourceClientProxy : public webkit_glue::WebPluginResourceClient {
scoped_refptr<PluginChannelHost> channel_;
int instance_id_;
unsigned long resource_id_;
- GURL url_;
- bool notify_needed_;
- intptr_t notify_data_;
// Set to true if the response expected is a multibyte response.
// For e.g. response for a HTTP byte range request.
bool multibyte_response_expected_;
@@ -314,13 +304,9 @@ bool WebPluginDelegateProxy::Send(IPC::Message* msg) {
void WebPluginDelegateProxy::SendJavaScriptStream(const GURL& url,
const std::string& result,
bool success,
- bool notify_needed,
- intptr_t notify_data) {
- PluginMsg_SendJavaScriptStream* msg =
- new PluginMsg_SendJavaScriptStream(instance_id_, url, result,
- success, notify_needed,
- notify_data);
- Send(msg);
+ int notify_id) {
+ Send(new PluginMsg_SendJavaScriptStream(
+ instance_id_, url, result, success, notify_id));
}
void WebPluginDelegateProxy::DidReceiveManualResponse(
@@ -823,9 +809,7 @@ NPObject* WebPluginDelegateProxy::GetPluginScriptableObject() {
return WebBindings::retainObject(npobject_);
int route_id = MSG_ROUTING_NONE;
- intptr_t npobject_ptr;
- Send(new PluginMsg_GetPluginScriptableObject(
- instance_id_, &route_id, &npobject_ptr));
+ Send(new PluginMsg_GetPluginScriptableObject(instance_id_, &route_id));
if (route_id == MSG_ROUTING_NONE)
return NULL;
@@ -836,9 +820,9 @@ NPObject* WebPluginDelegateProxy::GetPluginScriptableObject() {
}
void WebPluginDelegateProxy::DidFinishLoadWithReason(
- const GURL& url, NPReason reason, intptr_t notify_data) {
+ const GURL& url, NPReason reason, int notify_id) {
Send(new PluginMsg_DidFinishLoadWithReason(
- instance_id_, url, reason, notify_data));
+ instance_id_, url, reason, notify_id));
}
void WebPluginDelegateProxy::SetFocus() {
@@ -909,7 +893,7 @@ void WebPluginDelegateProxy::OnInvalidateRect(const gfx::Rect& rect) {
}
void WebPluginDelegateProxy::OnGetWindowScriptNPObject(
- int route_id, bool* success, intptr_t* npobject_ptr) {
+ int route_id, bool* success) {
*success = false;
NPObject* npobject = NULL;
if (plugin_)
@@ -923,11 +907,9 @@ void WebPluginDelegateProxy::OnGetWindowScriptNPObject(
window_script_object_ = (new NPObjectStub(
npobject, channel_host_.get(), route_id, 0, page_url_))->AsWeakPtr();
*success = true;
- *npobject_ptr = reinterpret_cast<intptr_t>(npobject);
}
-void WebPluginDelegateProxy::OnGetPluginElement(
- int route_id, bool* success, intptr_t* npobject_ptr) {
+void WebPluginDelegateProxy::OnGetPluginElement(int route_id, bool* success) {
*success = false;
NPObject* npobject = NULL;
if (plugin_)
@@ -940,7 +922,6 @@ void WebPluginDelegateProxy::OnGetPluginElement(
new NPObjectStub(
npobject, channel_host_.get(), route_id, 0, page_url_);
*success = true;
- *npobject_ptr = reinterpret_cast<intptr_t>(npobject);
}
void WebPluginDelegateProxy::OnSetCookie(const GURL& url,
@@ -1155,24 +1136,33 @@ void WebPluginDelegateProxy::OnHandleURLRequest(
if (params.target.length())
target = params.target.c_str();
- plugin_->HandleURLRequest(params.method.c_str(),
- params.is_javascript_url, target,
- static_cast<unsigned int>(params.buffer.size()),
- data, params.is_file_data, params.notify,
- params.url.c_str(), params.notify_data,
- params.popups_allowed);
+ plugin_->HandleURLRequest(
+ params.url.c_str(), params.method.c_str(), target, data,
+ static_cast<unsigned int>(params.buffer.size()), params.notify_id,
+ params.popups_allowed);
}
webkit_glue::WebPluginResourceClient*
WebPluginDelegateProxy::CreateResourceClient(
- unsigned long resource_id, const GURL& url, bool notify_needed,
- intptr_t notify_data, intptr_t npstream) {
+ unsigned long resource_id, const GURL& url, int notify_id) {
+ if (!channel_host_)
+ return NULL;
+
+ ResourceClientProxy* proxy = new ResourceClientProxy(channel_host_,
+ instance_id_);
+ proxy->Initialize(resource_id, url, notify_id);
+ return proxy;
+}
+
+webkit_glue::WebPluginResourceClient*
+WebPluginDelegateProxy::CreateSeekableResourceClient(
+ unsigned long resource_id, int range_request_id) {
if (!channel_host_)
return NULL;
ResourceClientProxy* proxy = new ResourceClientProxy(channel_host_,
instance_id_);
- proxy->Initialize(resource_id, url, notify_needed, notify_data, npstream);
+ proxy->InitializeForSeekableStream(resource_id, range_request_id);
return proxy;
}
@@ -1195,11 +1185,11 @@ void WebPluginDelegateProxy::OnCancelDocumentLoad() {
}
void WebPluginDelegateProxy::OnInitiateHTTPRangeRequest(
- const std::string& url, const std::string& range_info,
- intptr_t existing_stream, bool notify_needed, intptr_t notify_data) {
- plugin_->InitiateHTTPRangeRequest(url.c_str(), range_info.c_str(),
- existing_stream, notify_needed,
- notify_data);
+ const std::string& url,
+ const std::string& range_info,
+ int range_request_id) {
+ plugin_->InitiateHTTPRangeRequest(
+ url.c_str(), range_info.c_str(), range_request_id);
}
void WebPluginDelegateProxy::OnDeferResourceLoading(unsigned long resource_id,
diff --git a/chrome/renderer/webplugin_delegate_proxy.h b/chrome/renderer/webplugin_delegate_proxy.h
index c884c9f..510f977 100644
--- a/chrome/renderer/webplugin_delegate_proxy.h
+++ b/chrome/renderer/webplugin_delegate_proxy.h
@@ -65,7 +65,7 @@ class WebPluginDelegateProxy
virtual void Print(gfx::NativeDrawingContext context);
virtual NPObject* GetPluginScriptableObject();
virtual void DidFinishLoadWithReason(const GURL& url, NPReason reason,
- intptr_t notify_data);
+ int notify_id);
virtual void SetFocus();
virtual bool HandleInputEvent(const WebKit::WebInputEvent& event,
WebKit::WebCursorInfo* cursor);
@@ -80,8 +80,8 @@ class WebPluginDelegateProxy
virtual void SendJavaScriptStream(const GURL& url,
const std::string& result,
- bool success, bool notify_needed,
- intptr_t notify_data);
+ bool success,
+ int notify_id);
virtual void DidReceiveManualResponse(const GURL& url,
const std::string& mime_type,
@@ -93,11 +93,9 @@ class WebPluginDelegateProxy
virtual void DidManualLoadFail();
virtual void InstallMissingPlugin();
virtual webkit_glue::WebPluginResourceClient* CreateResourceClient(
- unsigned long resource_id,
- const GURL& url,
- bool notify_needed,
- intptr_t notify_data,
- intptr_t existing_stream);
+ unsigned long resource_id, const GURL& url, int notify_id);
+ virtual webkit_glue::WebPluginResourceClient* CreateSeekableResourceClient(
+ unsigned long resource_id, int range_request_id);
CommandBufferProxy* CreateCommandBuffer();
@@ -117,9 +115,8 @@ class WebPluginDelegateProxy
void OnHandleURLRequest(const PluginHostMsg_URLRequest_Params& params);
void OnCancelResource(int id);
void OnInvalidateRect(const gfx::Rect& rect);
- void OnGetWindowScriptNPObject(int route_id, bool* success,
- intptr_t* npobject_ptr);
- void OnGetPluginElement(int route_id, bool* success, intptr_t* npobject_ptr);
+ void OnGetWindowScriptNPObject(int route_id, bool* success);
+ void OnGetPluginElement(int route_id, bool* success);
void OnSetCookie(const GURL& url,
const GURL& first_party_for_cookies,
const std::string& cookie);
@@ -137,9 +134,7 @@ class WebPluginDelegateProxy
void OnCancelDocumentLoad();
void OnInitiateHTTPRangeRequest(const std::string& url,
const std::string& range_info,
- intptr_t existing_stream,
- bool notify_needed,
- intptr_t notify_data);
+ int range_request_id);
void OnDeferResourceLoading(unsigned long resource_id, bool defer);
#if defined(OS_MACOSX)