diff options
author | sehr@google.com <sehr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-03 16:51:38 +0000 |
---|---|---|
committer | sehr@google.com <sehr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-03 16:51:38 +0000 |
commit | 5f6745ebf3f595e6cddaf70b76d78699e40b0a44 (patch) | |
tree | 32addee40780977d039c520fb12087dccf1ef8fc /chrome | |
parent | 194b41be7fdce80b33da38a844fb70a7b5eadb78 (diff) | |
download | chromium_src-5f6745ebf3f595e6cddaf70b76d78699e40b0a44.zip chromium_src-5f6745ebf3f595e6cddaf70b76d78699e40b0a44.tar.gz chromium_src-5f6745ebf3f595e6cddaf70b76d78699e40b0a44.tar.bz2 |
To implement Pepper in Native Client we need access to the implementation of the
Pepper APIs in Chrome. Specifically, we need to be able to get the base::SharedMemory
or TransportDIB memory regions used to communicate with devices. To enable doing this,
especially in 64-bit Chrome, I needed to change the GetStateContext and SetStateContext
functions to manipulate 64-bit values. This CL does not include the Native Client
hookup to the new APIs, but is needed to do so.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/569004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37975 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/renderer/pepper_devices.h | 4 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_pepper.cc | 34 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_pepper.h | 12 |
3 files changed, 37 insertions, 13 deletions
diff --git a/chrome/renderer/pepper_devices.h b/chrome/renderer/pepper_devices.h index 50b3013..1abd554 100644 --- a/chrome/renderer/pepper_devices.h +++ b/chrome/renderer/pepper_devices.h @@ -31,6 +31,8 @@ class Graphics2DDeviceContext { NPDeviceFlushContextCallbackPtr callback, NPP id, void* user_data); + TransportDIB* transport_dib() { return transport_dib_.get(); } + private: static int32 next_buffer_id_; scoped_ptr<TransportDIB> transport_dib_; @@ -63,6 +65,8 @@ class AudioDeviceContext : public AudioMessageFilter::Delegate { virtual void OnVolume(double volume); // End of AudioMessageFilter::Delegate implementation + base::SharedMemory* shared_memory() { return shared_memory_.get(); } + private: void OnDestroy(); diff --git a/chrome/renderer/webplugin_delegate_pepper.cc b/chrome/renderer/webplugin_delegate_pepper.cc index 4c02715..048a796 100644 --- a/chrome/renderer/webplugin_delegate_pepper.cc +++ b/chrome/renderer/webplugin_delegate_pepper.cc @@ -20,6 +20,7 @@ #include "chrome/renderer/render_thread.h" #include "chrome/renderer/webplugin_delegate_proxy.h" #include "third_party/npapi/bindings/npapi_extensions.h" +#include "third_party/npapi/bindings/npapi_extensions_private.h" #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" #include "webkit/glue/plugins/plugin_constants_win.h" #include "webkit/glue/plugins/plugin_instance.h" @@ -272,14 +273,24 @@ NPError WebPluginDelegatePepper::Device2DInitializeContext( NPError WebPluginDelegatePepper::Device2DSetStateContext( NPDeviceContext2D* context, int32 state, - int32 value) { + intptr_t value) { return NPERR_GENERIC_ERROR; } NPError WebPluginDelegatePepper::Device2DGetStateContext( NPDeviceContext2D* context, int32 state, - int32* value) { + intptr_t* value) { + if (state == NPExtensionsReservedStateSharedMemory) { + if (!context) + return NPERR_INVALID_PARAM; + Graphics2DDeviceContext* ctx = graphic2d_contexts_.Lookup( + reinterpret_cast<intptr_t>(context->reserved)); + if (!ctx) + return NPERR_INVALID_PARAM; + *value = reinterpret_cast<intptr_t>(ctx->transport_dib()); + return NPERR_NO_ERROR; + } return NPERR_GENERIC_ERROR; } @@ -388,14 +399,14 @@ NPError WebPluginDelegatePepper::Device3DInitializeContext( NPError WebPluginDelegatePepper::Device3DSetStateContext( NPDeviceContext3D* context, int32 state, - int32 value) { + intptr_t value) { return NPERR_GENERIC_ERROR; } NPError WebPluginDelegatePepper::Device3DGetStateContext( NPDeviceContext3D* context, int32 state, - int32* value) { + intptr_t* value) { return NPERR_GENERIC_ERROR; } @@ -504,7 +515,7 @@ NPError WebPluginDelegatePepper::DeviceAudioInitializeContext( NPError WebPluginDelegatePepper::DeviceAudioSetStateContext( NPDeviceContextAudio* context, int32 state, - int32 value) { + intptr_t value) { // TODO(neb,cpu) implement SetStateContext return NPERR_GENERIC_ERROR; } @@ -512,8 +523,17 @@ NPError WebPluginDelegatePepper::DeviceAudioSetStateContext( NPError WebPluginDelegatePepper::DeviceAudioGetStateContext( NPDeviceContextAudio* context, int32 state, - int32* value) { - // TODO(neb,cpu) implement GetStateContext + intptr_t* value) { + if (state == NPExtensionsReservedStateSharedMemory) { + if (!context) + return NPERR_INVALID_PARAM; + AudioDeviceContext* ctx = audio_contexts_.Lookup( + reinterpret_cast<intptr_t>(context->reserved)); + if (!ctx) + return NPERR_INVALID_PARAM; + *value = reinterpret_cast<intptr_t>(ctx->shared_memory()); + return NPERR_NO_ERROR; + } return NPERR_GENERIC_ERROR; } diff --git a/chrome/renderer/webplugin_delegate_pepper.h b/chrome/renderer/webplugin_delegate_pepper.h index b316789..85db1a92 100644 --- a/chrome/renderer/webplugin_delegate_pepper.h +++ b/chrome/renderer/webplugin_delegate_pepper.h @@ -82,10 +82,10 @@ class WebPluginDelegatePepper : public webkit_glue::WebPluginDelegate { NPDeviceContext2D* context); virtual NPError Device2DSetStateContext(NPDeviceContext2D* context, int32 state, - int32 value); + intptr_t value); virtual NPError Device2DGetStateContext(NPDeviceContext2D* context, int32 state, - int32* value); + intptr_t* value); virtual NPError Device2DFlushContext(NPP id, NPDeviceContext2D* context, NPDeviceFlushContextCallbackPtr callback, @@ -101,10 +101,10 @@ class WebPluginDelegatePepper : public webkit_glue::WebPluginDelegate { NPDeviceContext3D* context); virtual NPError Device3DSetStateContext(NPDeviceContext3D* context, int32 state, - int32 value); + intptr_t value); virtual NPError Device3DGetStateContext(NPDeviceContext3D* context, int32 state, - int32* value); + intptr_t* value); virtual NPError Device3DFlushContext(NPP id, NPDeviceContext3D* context, NPDeviceFlushContextCallbackPtr callback, @@ -128,9 +128,9 @@ class WebPluginDelegatePepper : public webkit_glue::WebPluginDelegate { const NPDeviceContextAudioConfig* config, NPDeviceContextAudio* context); virtual NPError DeviceAudioSetStateContext(NPDeviceContextAudio* context, - int32 state, int32 value); + int32 state, intptr_t value); virtual NPError DeviceAudioGetStateContext(NPDeviceContextAudio* context, - int32 state, int32* value); + int32 state, intptr_t* value); virtual NPError DeviceAudioFlushContext( NPP id, NPDeviceContextAudio* context, NPDeviceFlushContextCallbackPtr callback, void* user_data); |