diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-29 22:35:33 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-29 22:35:33 +0000 |
commit | ea3d1d84be3d6f97bf50e76511c9e26af6895533 (patch) | |
tree | 94c73f600dcca23329221ad8c51e6a5158263f7e /chrome/plugin | |
parent | 403e46333b43009776a08273501e4ca8c5c06e12 (diff) | |
download | chromium_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/plugin')
-rw-r--r-- | chrome/plugin/webplugin_delegate_stub.cc | 33 | ||||
-rw-r--r-- | chrome/plugin/webplugin_delegate_stub.h | 25 | ||||
-rw-r--r-- | chrome/plugin/webplugin_proxy.cc | 59 | ||||
-rw-r--r-- | chrome/plugin/webplugin_proxy.h | 35 |
4 files changed, 56 insertions, 96 deletions
diff --git a/chrome/plugin/webplugin_delegate_stub.cc b/chrome/plugin/webplugin_delegate_stub.cc index 49c535c..1764366 100644 --- a/chrome/plugin/webplugin_delegate_stub.cc +++ b/chrome/plugin/webplugin_delegate_stub.cc @@ -130,6 +130,8 @@ void WebPluginDelegateStub::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(PluginMsg_InstallMissingPlugin, OnInstallMissingPlugin) IPC_MESSAGE_HANDLER(PluginMsg_HandleURLRequestReply, OnHandleURLRequestReply) + IPC_MESSAGE_HANDLER(PluginMsg_HTTPRangeRequestReply, + OnHTTPRangeRequestReply) IPC_MESSAGE_HANDLER(PluginMsg_CreateCommandBuffer, OnCreateCommandBuffer) IPC_MESSAGE_UNHANDLED_ERROR() @@ -237,8 +239,8 @@ void WebPluginDelegateStub::OnDidFail(int id) { } void WebPluginDelegateStub::OnDidFinishLoadWithReason( - const GURL& url, int reason, intptr_t notify_data) { - delegate_->DidFinishLoadWithReason(url, reason, notify_data); + const GURL& url, int reason, int notify_id) { + delegate_->DidFinishLoadWithReason(url, reason, notify_id); } void WebPluginDelegateStub::OnSetFocus() { @@ -304,9 +306,7 @@ void WebPluginDelegateStub::OnUpdateGeometry( ); } -void WebPluginDelegateStub::OnGetPluginScriptableObject( - int* route_id, - intptr_t* npobject_ptr) { +void WebPluginDelegateStub::OnGetPluginScriptableObject(int* route_id) { NPObject* object = delegate_->GetPluginScriptableObject(); if (!object) { *route_id = MSG_ROUTING_NONE; @@ -314,7 +314,6 @@ void WebPluginDelegateStub::OnGetPluginScriptableObject( } *route_id = channel_->GenerateRouteID(); - *npobject_ptr = reinterpret_cast<intptr_t>(object); // The stub will delete itself when the proxy tells it that it's released, or // otherwise when the channel is closed. new NPObjectStub( @@ -328,10 +327,8 @@ void WebPluginDelegateStub::OnGetPluginScriptableObject( void WebPluginDelegateStub::OnSendJavaScriptStream(const GURL& url, const std::string& result, bool success, - bool notify_needed, - intptr_t notify_data) { - delegate_->SendJavaScriptStream(url, result, success, notify_needed, - notify_data); + int notify_id) { + delegate_->SendJavaScriptStream(url, result, success, notify_id); } void WebPluginDelegateStub::OnDidReceiveManualResponse( @@ -404,11 +401,15 @@ void WebPluginDelegateStub::CreateSharedBuffer( } void WebPluginDelegateStub::OnHandleURLRequestReply( - const PluginMsg_URLRequestReply_Params& params) { + unsigned long resource_id, const GURL& url, int notify_id) { WebPluginResourceClient* resource_client = - delegate_->CreateResourceClient(params.resource_id, params.url, - params.notify_needed, - params.notify_data, - params.stream); - webplugin_->OnResourceCreated(params.resource_id, resource_client); + delegate_->CreateResourceClient(resource_id, url, notify_id); + webplugin_->OnResourceCreated(resource_id, resource_client); +} + +void WebPluginDelegateStub::OnHTTPRangeRequestReply( + unsigned long resource_id, int range_request_id) { + WebPluginResourceClient* resource_client = + delegate_->CreateSeekableResourceClient(resource_id, range_request_id); + webplugin_->OnResourceCreated(resource_id, resource_client); } diff --git a/chrome/plugin/webplugin_delegate_stub.h b/chrome/plugin/webplugin_delegate_stub.h index 34358fa..ddc8632 100644 --- a/chrome/plugin/webplugin_delegate_stub.h +++ b/chrome/plugin/webplugin_delegate_stub.h @@ -24,7 +24,6 @@ class WebPluginProxy; struct PluginMsg_Init_Params; struct PluginMsg_DidReceiveResponseParams; struct PluginMsg_UpdateGeometry_Param; -struct PluginMsg_URLRequestReply_Params; class WebCursor; namespace WebKit { @@ -59,32 +58,25 @@ class WebPluginDelegateStub : public IPC::Channel::Listener, // Message handlers for the WebPluginDelegate calls that are proxied from the // renderer over the IPC channel. void OnInit(const PluginMsg_Init_Params& params, bool* result); - void OnWillSendRequest(int id, const GURL& url); void OnDidReceiveResponse(const PluginMsg_DidReceiveResponseParams& params); void OnDidReceiveData(int id, const std::vector<char>& buffer, int data_offset); void OnDidFinishLoading(int id); void OnDidFail(int id); - - void OnDidFinishLoadWithReason(const GURL& url, int reason, - intptr_t notify_data); + void OnDidFinishLoadWithReason(const GURL& url, int reason, int notify_id); void OnSetFocus(); void OnHandleInputEvent(const WebKit::WebInputEvent* event, bool* handled, WebCursor* cursor); - void OnPaint(const gfx::Rect& damaged_rect); void OnDidPaint(); - void OnPrint(base::SharedMemoryHandle* shared_memory, size_t* size); - void OnUpdateGeometry(const PluginMsg_UpdateGeometry_Param& param); - void OnGetPluginScriptableObject(int* route_id, intptr_t* npobject_ptr); + void OnGetPluginScriptableObject(int* route_id); void OnSendJavaScriptStream(const GURL& url, const std::string& result, - bool success, bool notify_needed, - intptr_t notify_data); - + bool success, + int notify_id); void OnDidReceiveManualResponse( const GURL& url, const PluginMsg_DidReceiveResponseParams& params); @@ -92,12 +84,11 @@ class WebPluginDelegateStub : public IPC::Channel::Listener, void OnDidFinishManualLoading(); void OnDidManualLoadFail(); void OnInstallMissingPlugin(); - - void OnHandleURLRequestReply( - const PluginMsg_URLRequestReply_Params& params); - + void OnHandleURLRequestReply(unsigned long resource_id, + const GURL& url, + int notify_id); + void OnHTTPRangeRequestReply(unsigned long resource_id, int range_request_id); void OnCreateCommandBuffer(int* route_id); - void CreateSharedBuffer(size_t size, base::SharedMemory* shared_buf, base::SharedMemoryHandle* remote_handle); diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc index 34091e9..a05113b 100644 --- a/chrome/plugin/webplugin_proxy.cc +++ b/chrome/plugin/webplugin_proxy.cc @@ -26,7 +26,6 @@ #include "chrome/plugin/npobject_util.h" #include "chrome/plugin/plugin_channel.h" #include "chrome/plugin/plugin_thread.h" -#include "chrome/plugin/webplugin_delegate_stub.h" #include "skia/ext/platform_device.h" #include "third_party/WebKit/WebKit/chromium/public/WebBindings.h" #include "webkit/glue/plugins/webplugin_delegate_impl.h" @@ -151,9 +150,8 @@ NPObject* WebPluginProxy::GetWindowScriptNPObject() { int npobject_route_id = channel_->GenerateRouteID(); bool success = false; - intptr_t npobject_ptr = NULL; Send(new PluginHostMsg_GetWindowScriptNPObject( - route_id_, npobject_route_id, &success, &npobject_ptr)); + route_id_, npobject_route_id, &success)); if (!success) return NULL; @@ -169,9 +167,7 @@ NPObject* WebPluginProxy::GetPluginElement() { int npobject_route_id = channel_->GenerateRouteID(); bool success = false; - intptr_t npobject_ptr = NULL; - Send(new PluginHostMsg_GetPluginElement( - route_id_, npobject_route_id, &success, &npobject_ptr)); + Send(new PluginHostMsg_GetPluginElement(route_id_, npobject_route_id, &success)); if (!success) return NULL; @@ -254,31 +250,20 @@ void WebPluginProxy::DidPaint() { InvalidateRect(damaged_rect_); } -void WebPluginProxy::OnResourceCreated(int resource_id, HANDLE cookie) { - WebPluginResourceClient* resource_client = - reinterpret_cast<WebPluginResourceClient*>(cookie); - if (!resource_client) { - NOTREACHED(); - return; - } - +void WebPluginProxy::OnResourceCreated(int resource_id, + WebPluginResourceClient* client) { DCHECK(resource_clients_.find(resource_id) == resource_clients_.end()); - resource_clients_[resource_id] = resource_client; + resource_clients_[resource_id] = client; } -void WebPluginProxy::HandleURLRequest(const char *method, - bool is_javascript_url, - const char* target, unsigned int len, - const char* buf, bool is_file_data, - bool notify, const char* url, - intptr_t notify_data, +void WebPluginProxy::HandleURLRequest(const char* url, + const char *method, + const char* target, + const char* buf, + unsigned int len, + int notify_id, bool popups_allowed) { - if (!url) { - NOTREACHED(); - return; - } - - if (!target && (0 == base::strcasecmp(method, "GET"))) { + if (!target && (0 == base::strcasecmp(method, "GET"))) { // Please refer to https://bugzilla.mozilla.org/show_bug.cgi?id=366082 // for more details on this. if (delegate_->GetQuirks() & @@ -293,8 +278,8 @@ void WebPluginProxy::HandleURLRequest(const char *method, } PluginHostMsg_URLRequest_Params params; + params.url = url; params.method = method; - params.is_javascript_url = is_javascript_url; if (target) params.target = std::string(target); @@ -303,10 +288,7 @@ void WebPluginProxy::HandleURLRequest(const char *method, memcpy(¶ms.buffer.front(), buf, len); } - params.is_file_data = is_file_data; - params.notify = notify; - params.url = url; - params.notify_data = notify_data; + params.notify_id = notify_id; params.popups_allowed = popups_allowed; Send(new PluginHostMsg_URLRequest(route_id_, params)); @@ -567,15 +549,10 @@ void WebPluginProxy::CancelDocumentLoad() { Send(new PluginHostMsg_CancelDocumentLoad(route_id_)); } -void WebPluginProxy::InitiateHTTPRangeRequest(const char* url, - const char* range_info, - intptr_t existing_stream, - bool notify_needed, - intptr_t notify_data) { - - Send(new PluginHostMsg_InitiateHTTPRangeRequest(route_id_, url, - range_info, existing_stream, - notify_needed, notify_data)); +void WebPluginProxy::InitiateHTTPRangeRequest( + const char* url, const char* range_info, int range_request_id) { + Send(new PluginHostMsg_InitiateHTTPRangeRequest( + route_id_, url, range_info, range_request_id)); } void WebPluginProxy::SetDeferResourceLoading(unsigned long resource_id, diff --git a/chrome/plugin/webplugin_proxy.h b/chrome/plugin/webplugin_proxy.h index 4a91685..5fc699c 100644 --- a/chrome/plugin/webplugin_proxy.h +++ b/chrome/plugin/webplugin_proxy.h @@ -103,17 +103,17 @@ class WebPluginProxy : public webkit_glue::WebPlugin { // Callback from the renderer to let us know that a paint occurred. void DidPaint(); - // Notification received on a plugin issued resource request - // creation. - void OnResourceCreated(int resource_id, HANDLE cookie); - - void HandleURLRequest(const char *method, - bool is_javascript_url, - const char* target, unsigned int len, - const char* buf, bool is_file_data, - bool notify, const char* url, - intptr_t notify_data, bool popups_allowed); - + // Notification received on a plugin issued resource request creation. + void OnResourceCreated(int resource_id, + webkit_glue::WebPluginResourceClient* client); + + void HandleURLRequest(const char* url, + const char *method, + const char* target, + const char* buf, + unsigned int len, + int notify_id, + bool popups_allowed); void UpdateGeometry(const gfx::Rect& window_rect, const gfx::Rect& clip_rect, const TransportDIB::Handle& windowless_buffer, @@ -123,22 +123,13 @@ class WebPluginProxy : public webkit_glue::WebPlugin { int ack_key #endif ); - void CancelDocumentLoad(); - - void InitiateHTTPRangeRequest(const char* url, - const char* range_info, - intptr_t existing_stream, - bool notify_needed, - intptr_t notify_data); - + void InitiateHTTPRangeRequest( + const char* url, const char* range_info, int range_request_id); void SetDeferResourceLoading(unsigned long resource_id, bool defer); - bool IsOffTheRecord(); - void ResourceClientDeleted( webkit_glue::WebPluginResourceClient* resource_client); - gfx::NativeViewId containing_window() { return containing_window_; } private: |