diff options
author | sehr@google.com <sehr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-10 21:14:41 +0000 |
---|---|---|
committer | sehr@google.com <sehr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-10 21:14:41 +0000 |
commit | 59f7ccc38ba284da223ac29a1dc846a7e52ebf58 (patch) | |
tree | 6f8ed99862994680de08f21f453f3e3949718257 /chrome/renderer | |
parent | 7cb9b9d185985932741755f88d2889bc25362751 (diff) | |
download | chromium_src-59f7ccc38ba284da223ac29a1dc846a7e52ebf58.zip chromium_src-59f7ccc38ba284da223ac29a1dc846a7e52ebf58.tar.gz chromium_src-59f7ccc38ba284da223ac29a1dc846a7e52ebf58.tar.bz2 |
base::SharedMemory does not set the size in other than the creating
process. Create an API to get the size of the audio shared memory
region.
Review URL: http://codereview.chromium.org/596038
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38665 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/pepper_devices.h | 1 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_pepper.cc | 13 |
2 files changed, 12 insertions, 2 deletions
diff --git a/chrome/renderer/pepper_devices.h b/chrome/renderer/pepper_devices.h index 408680c..ea23d5a 100644 --- a/chrome/renderer/pepper_devices.h +++ b/chrome/renderer/pepper_devices.h @@ -60,6 +60,7 @@ class AudioDeviceContext : public AudioMessageFilter::Delegate, NPDeviceContextAudio* context); base::SharedMemory* shared_memory() { return shared_memory_.get(); } + uint32_t shared_memory_size() { return shared_memory_size_; } base::SyncSocket* socket() { return socket_.get(); } private: diff --git a/chrome/renderer/webplugin_delegate_pepper.cc b/chrome/renderer/webplugin_delegate_pepper.cc index 8a0dd60..ad8a952 100644 --- a/chrome/renderer/webplugin_delegate_pepper.cc +++ b/chrome/renderer/webplugin_delegate_pepper.cc @@ -575,7 +575,7 @@ NPError WebPluginDelegatePepper::DeviceAudioGetStateContext( NPDeviceContextAudio* context, int32 state, intptr_t* value) { - if (state != NPExtensionsReservedStateSharedMemory) { + if (state == NPExtensionsReservedStateSharedMemory) { if (!context) return NPERR_INVALID_PARAM; AudioDeviceContext* ctx = audio_contexts_.Lookup( @@ -584,7 +584,16 @@ NPError WebPluginDelegatePepper::DeviceAudioGetStateContext( return NPERR_INVALID_PARAM; *value = reinterpret_cast<intptr_t>(ctx->shared_memory()); return NPERR_NO_ERROR; - } else if (state != NPExtensionsReservedStateSyncChannel) { + } else if (state == NPExtensionsReservedStateSharedMemorySize) { + if (!context) + return NPERR_INVALID_PARAM; + AudioDeviceContext* ctx = audio_contexts_.Lookup( + reinterpret_cast<intptr_t>(context->reserved)); + if (!ctx) + return NPERR_INVALID_PARAM; + *value = static_cast<intptr_t>(ctx->shared_memory_size()); + return NPERR_NO_ERROR; + } else if (state == NPExtensionsReservedStateSyncChannel) { if (!context) return NPERR_INVALID_PARAM; AudioDeviceContext* ctx = audio_contexts_.Lookup( |