summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authoryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-08 22:20:20 +0000
committeryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-08 22:20:20 +0000
commit77b5550594951087e98ed807000e82fba203a308 (patch)
treea94860399237b027ad8c6576d80dbbee86ed654a /webkit
parentd84e9997f46f08d856106aa1f98770b5d911e355 (diff)
downloadchromium_src-77b5550594951087e98ed807000e82fba203a308.zip
chromium_src-77b5550594951087e98ed807000e82fba203a308.tar.gz
chromium_src-77b5550594951087e98ed807000e82fba203a308.tar.bz2
Rewrite PPB_AudioInput_Dev to use the new-style host/resource.
TEST=None BUG=None Review URL: https://chromiumcodereview.appspot.com/11366038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166777 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/webkit_glue.gypi2
-rw-r--r--webkit/plugins/ppapi/plugin_module.cc3
-rw-r--r--webkit/plugins/ppapi/ppb_audio_input_impl.cc186
-rw-r--r--webkit/plugins/ppapi/ppb_audio_input_impl.h83
-rw-r--r--webkit/plugins/ppapi/resource_creation_impl.cc12
-rw-r--r--webkit/plugins/ppapi/resource_creation_impl.h5
6 files changed, 1 insertions, 290 deletions
diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi
index c8e36f8..d7545d7 100644
--- a/webkit/glue/webkit_glue.gypi
+++ b/webkit/glue/webkit_glue.gypi
@@ -197,8 +197,6 @@
'../plugins/ppapi/ppapi_webplugin_impl.h',
'../plugins/ppapi/ppb_audio_impl.cc',
'../plugins/ppapi/ppb_audio_impl.h',
- '../plugins/ppapi/ppb_audio_input_impl.cc',
- '../plugins/ppapi/ppb_audio_input_impl.h',
'../plugins/ppapi/ppb_broker_impl.cc',
'../plugins/ppapi/ppb_broker_impl.h',
'../plugins/ppapi/ppb_buffer_impl.cc',
diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc
index 7bd5036..5d3ec88 100644
--- a/webkit/plugins/ppapi/plugin_module.cc
+++ b/webkit/plugins/ppapi/plugin_module.cc
@@ -86,7 +86,6 @@
#include "ppapi/c/private/ppb_udp_socket_private.h"
#include "ppapi/c/private/ppb_uma_private.h"
#include "ppapi/c/private/ppb_x509_certificate_private.h"
-#include "ppapi/c/trusted/ppb_audio_input_trusted_dev.h"
#include "ppapi/c/trusted/ppb_audio_trusted.h"
#include "ppapi/c/trusted/ppb_broker_trusted.h"
#include "ppapi/c/trusted/ppb_browser_font_trusted.h"
@@ -294,8 +293,6 @@ const void* InternalGetInterface(const char* name) {
// Please keep alphabetized by interface macro name with "special" stuff at
// the bottom.
- if (strcmp(name, PPB_AUDIO_INPUT_TRUSTED_DEV_INTERFACE_0_1) == 0)
- return ::ppapi::thunk::GetPPB_AudioInputTrusted_0_1_Thunk();
if (strcmp(name, PPB_AUDIO_TRUSTED_INTERFACE_0_6) == 0)
return ::ppapi::thunk::GetPPB_AudioTrusted_0_6_Thunk();
if (strcmp(name, PPB_BUFFER_TRUSTED_INTERFACE_0_1) == 0)
diff --git a/webkit/plugins/ppapi/ppb_audio_input_impl.cc b/webkit/plugins/ppapi/ppb_audio_input_impl.cc
deleted file mode 100644
index f4f40c0..0000000
--- a/webkit/plugins/ppapi/ppb_audio_input_impl.cc
+++ /dev/null
@@ -1,186 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "webkit/plugins/ppapi/ppb_audio_input_impl.h"
-
-#include "base/bind.h"
-#include "base/logging.h"
-#include "base/memory/ref_counted.h"
-#include "base/shared_memory.h"
-#include "base/sync_socket.h"
-#include "build/build_config.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/shared_impl/ppb_device_ref_shared.h"
-#include "ppapi/shared_impl/tracked_callback.h"
-#include "webkit/plugins/ppapi/common.h"
-#include "webkit/plugins/ppapi/resource_helper.h"
-
-using ppapi::TrackedCallback;
-
-namespace webkit {
-namespace ppapi {
-
-// PPB_AudioInput_Impl ---------------------------------------------------------
-
-PPB_AudioInput_Impl::PPB_AudioInput_Impl(PP_Instance instance)
- : ::ppapi::PPB_AudioInput_Shared(instance),
- audio_input_(NULL) {
-}
-
-PPB_AudioInput_Impl::~PPB_AudioInput_Impl() {
- Close();
-}
-
-// static
-PP_Resource PPB_AudioInput_Impl::Create0_1(
- PP_Instance instance,
- PP_Resource config,
- PPB_AudioInput_Callback audio_input_callback,
- void* user_data) {
- scoped_refptr<PPB_AudioInput_Impl>
- audio_input(new PPB_AudioInput_Impl(instance));
- int32_t result = audio_input->Open(
- "", config, audio_input_callback, user_data,
- MakeIgnoredCompletionCallback(audio_input.get()));
- if (result != PP_OK && result != PP_OK_COMPLETIONPENDING)
- return 0;
- return audio_input->GetReference();
-}
-
-int32_t PPB_AudioInput_Impl::OpenTrusted(
- const std::string& device_id,
- PP_Resource config,
- scoped_refptr<TrackedCallback> create_callback) {
- return CommonOpen(device_id, config, NULL, NULL, create_callback);
-}
-
-int32_t PPB_AudioInput_Impl::GetSyncSocket(int* sync_socket) {
- if (socket_.get()) {
-#if defined(OS_POSIX)
- *sync_socket = socket_->handle();
-#elif defined(OS_WIN)
- *sync_socket = reinterpret_cast<int>(socket_->handle());
-#else
- #error "Platform not supported."
-#endif
- return PP_OK;
- }
- return PP_ERROR_FAILED;
-}
-
-int32_t PPB_AudioInput_Impl::GetSharedMemory(int* shm_handle,
- uint32_t* shm_size) {
- if (shared_memory_.get()) {
-#if defined(OS_POSIX)
- *shm_handle = shared_memory_->handle().fd;
-#elif defined(OS_WIN)
- *shm_handle = reinterpret_cast<int>(shared_memory_->handle());
-#else
- #error "Platform not supported."
-#endif
- *shm_size = shared_memory_size_;
- return PP_OK;
- }
- return PP_ERROR_FAILED;
-}
-
-const PPB_AudioInput_Impl::DeviceRefDataVector&
- PPB_AudioInput_Impl::GetDeviceRefData() const {
- return devices_data_;
-}
-
-void PPB_AudioInput_Impl::StreamCreated(
- base::SharedMemoryHandle shared_memory_handle,
- size_t shared_memory_size,
- base::SyncSocket::Handle socket) {
- OnOpenComplete(PP_OK, shared_memory_handle, shared_memory_size, socket);
-}
-
-void PPB_AudioInput_Impl::StreamCreationFailed() {
- OnOpenComplete(PP_ERROR_FAILED, base::SharedMemory::NULLHandle(), 0,
- base::SyncSocket::kInvalidHandle);
-}
-
-int32_t PPB_AudioInput_Impl::InternalEnumerateDevices(
- PP_Resource* devices,
- scoped_refptr<TrackedCallback> callback) {
- PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this);
- if (!plugin_delegate)
- return PP_ERROR_FAILED;
-
- devices_ = devices;
- enumerate_devices_callback_ = callback;
- plugin_delegate->EnumerateDevices(
- PP_DEVICETYPE_DEV_AUDIOCAPTURE,
- base::Bind(&PPB_AudioInput_Impl::EnumerateDevicesCallbackFunc,
- AsWeakPtr()));
- return PP_OK_COMPLETIONPENDING;
-}
-
-int32_t PPB_AudioInput_Impl::InternalOpen(
- const std::string& device_id,
- PP_AudioSampleRate sample_rate,
- uint32_t sample_frame_count,
- scoped_refptr<TrackedCallback> callback) {
- PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this);
- if (!plugin_delegate)
- return PP_ERROR_FAILED;
-
- // When the stream is created, we'll get called back on StreamCreated().
- DCHECK(!audio_input_);
- audio_input_ = plugin_delegate->CreateAudioInput(
- device_id, sample_rate, sample_frame_count, this);
- if (audio_input_) {
- open_callback_ = callback;
- return PP_OK_COMPLETIONPENDING;
- } else {
- return PP_ERROR_FAILED;
- }
-}
-
-PP_Bool PPB_AudioInput_Impl::InternalStartCapture() {
- if (!audio_input_)
- return PP_FALSE;
- SetStartCaptureState();
- audio_input_->StartCapture();
- return PP_TRUE;
-}
-
-PP_Bool PPB_AudioInput_Impl::InternalStopCapture() {
- if (!audio_input_)
- return PP_FALSE;
- audio_input_->StopCapture();
- SetStopCaptureState();
- return PP_TRUE;
-}
-
-void PPB_AudioInput_Impl::InternalClose() {
- // Calling ShutDown() makes sure StreamCreated() cannot be called anymore and
- // releases the audio data associated with the pointer. Note however, that
- // until ShutDown() returns, StreamCreated() may still be called. This will be
- // OK since OnOpenComplete() will clean up the handles and do nothing else in
- // that case.
- if (audio_input_) {
- audio_input_->ShutDown();
- audio_input_ = NULL;
- }
-}
-
-void PPB_AudioInput_Impl::EnumerateDevicesCallbackFunc(
- int request_id,
- bool succeeded,
- const DeviceRefDataVector& devices) {
- devices_data_.clear();
- if (succeeded)
- devices_data_ = devices;
-
- PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this);
- if (plugin_delegate)
- plugin_delegate->StopEnumerateDevices(request_id);
-
- OnEnumerateDevicesComplete(succeeded ? PP_OK : PP_ERROR_FAILED, devices);
-}
-
-} // namespace ppapi
-} // namespace webkit
diff --git a/webkit/plugins/ppapi/ppb_audio_input_impl.h b/webkit/plugins/ppapi/ppb_audio_input_impl.h
deleted file mode 100644
index d7a1e0c..0000000
--- a/webkit/plugins/ppapi/ppb_audio_input_impl.h
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef WEBKIT_PLUGINS_PPAPI_PPB_AUDIO_INPUT_IMPL_H_
-#define WEBKIT_PLUGINS_PPAPI_PPB_AUDIO_INPUT_IMPL_H_
-
-#include <string>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
-#include "base/memory/weak_ptr.h"
-#include "ppapi/shared_impl/ppb_audio_input_shared.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
-
-namespace webkit {
-namespace ppapi {
-
-// Some of the backend functionality of this class is implemented by the
-// PPB_AudioInput_Shared so it can be shared with the proxy.
-class PPB_AudioInput_Impl : public ::ppapi::PPB_AudioInput_Shared,
- public PluginDelegate::PlatformAudioInputClient,
- public base::SupportsWeakPtr<PPB_AudioInput_Impl> {
- public:
- typedef std::vector< ::ppapi::DeviceRefData> DeviceRefDataVector;
-
- explicit PPB_AudioInput_Impl(PP_Instance instance);
- virtual ~PPB_AudioInput_Impl();
-
- // Creation function for the v0.1 interface. This handles all initialization
- // and will return 0 on failure.
- static PP_Resource Create0_1(PP_Instance instance,
- PP_Resource config,
- PPB_AudioInput_Callback audio_input_callback,
- void* user_data);
-
- // Implementation of PPB_AudioInput_API trusted methods.
- virtual int32_t OpenTrusted(
- const std::string& device_id,
- PP_Resource config,
- scoped_refptr< ::ppapi::TrackedCallback> create_callback) OVERRIDE;
- virtual int32_t GetSyncSocket(int* sync_socket) OVERRIDE;
- virtual int32_t GetSharedMemory(int* shm_handle, uint32_t* shm_size) OVERRIDE;
- virtual const DeviceRefDataVector& GetDeviceRefData() const OVERRIDE;
-
- // PluginDelegate::PlatformAudioInputClient implementation.
- virtual void StreamCreated(base::SharedMemoryHandle shared_memory_handle,
- size_t shared_memory_size,
- base::SyncSocket::Handle socket) OVERRIDE;
- virtual void StreamCreationFailed() OVERRIDE;
-
- private:
- // PPB_AudioInput_Shared implementation.
- virtual int32_t InternalEnumerateDevices(
- PP_Resource* devices,
- scoped_refptr< ::ppapi::TrackedCallback> callback) OVERRIDE;
- virtual int32_t InternalOpen(
- const std::string& device_id,
- PP_AudioSampleRate sample_rate,
- uint32_t sample_frame_count,
- scoped_refptr< ::ppapi::TrackedCallback> callback) OVERRIDE;
- virtual PP_Bool InternalStartCapture() OVERRIDE;
- virtual PP_Bool InternalStopCapture() OVERRIDE;
- virtual void InternalClose() OVERRIDE;
-
- void EnumerateDevicesCallbackFunc(int request_id,
- bool succeeded,
- const DeviceRefDataVector& devices);
-
- // PluginDelegate audio input object that we delegate audio IPC through.
- // We don't own this pointer but are responsible for calling Shutdown on it.
- PluginDelegate::PlatformAudioInput* audio_input_;
-
- DeviceRefDataVector devices_data_;
-
- DISALLOW_COPY_AND_ASSIGN(PPB_AudioInput_Impl);
-};
-
-} // namespace ppapi
-} // namespace webkit
-
-#endif // WEBKIT_PLUGINS_PPAPI_PPB_AUDIO_INPUT_IMPL_H_
diff --git a/webkit/plugins/ppapi/resource_creation_impl.cc b/webkit/plugins/ppapi/resource_creation_impl.cc
index 717b830..159e27f 100644
--- a/webkit/plugins/ppapi/resource_creation_impl.cc
+++ b/webkit/plugins/ppapi/resource_creation_impl.cc
@@ -12,7 +12,6 @@
#include "ppapi/shared_impl/var.h"
#include "webkit/plugins/ppapi/common.h"
#include "webkit/plugins/ppapi/ppb_audio_impl.h"
-#include "webkit/plugins/ppapi/ppb_audio_input_impl.h"
#include "webkit/plugins/ppapi/ppb_broker_impl.h"
#include "webkit/plugins/ppapi/ppb_buffer_impl.h"
#include "webkit/plugins/ppapi/ppb_directory_reader_impl.h"
@@ -72,17 +71,8 @@ PP_Resource ResourceCreationImpl::CreateAudioTrusted(
return (new PPB_Audio_Impl(instance))->GetReference();
}
-PP_Resource ResourceCreationImpl::CreateAudioInput0_1(
- PP_Instance instance,
- PP_Resource config_id,
- PPB_AudioInput_Callback audio_input_callback,
- void* user_data) {
- return PPB_AudioInput_Impl::Create0_1(instance, config_id,
- audio_input_callback, user_data);
-}
-
PP_Resource ResourceCreationImpl::CreateAudioInput(PP_Instance instance) {
- return (new PPB_AudioInput_Impl(instance))->GetReference();
+ return 0; // Not supported in-process.
}
PP_Resource ResourceCreationImpl::CreateBroker(PP_Instance instance) {
diff --git a/webkit/plugins/ppapi/resource_creation_impl.h b/webkit/plugins/ppapi/resource_creation_impl.h
index 10d058a5..8805929 100644
--- a/webkit/plugins/ppapi/resource_creation_impl.h
+++ b/webkit/plugins/ppapi/resource_creation_impl.h
@@ -30,11 +30,6 @@ class WEBKIT_PLUGINS_EXPORT ResourceCreationImpl
virtual PP_Resource CreateAudioConfig(PP_Instance instance,
PP_AudioSampleRate sample_rate,
uint32_t sample_frame_count) OVERRIDE;
- virtual PP_Resource CreateAudioInput0_1(
- PP_Instance instance,
- PP_Resource config_id,
- PPB_AudioInput_Callback audio_input_callback,
- void* user_data) OVERRIDE;
virtual PP_Resource CreateAudioInput(PP_Instance instance) OVERRIDE;
virtual PP_Resource CreateBroker(PP_Instance instance) OVERRIDE;
virtual PP_Resource CreateBrowserFont(