Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(588)

Unified Diff: ppapi/cpp/dev/audio_input_dev.cc

Issue 11366038: Rewrite PPB_AudioInput_Dev to use the new-style host/resource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/cpp/dev/audio_input_dev.h ('k') | ppapi/examples/audio_input/audio_input.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/cpp/dev/audio_input_dev.cc
diff --git a/ppapi/cpp/dev/audio_input_dev.cc b/ppapi/cpp/dev/audio_input_dev.cc
index 92ad8382b07547e04dc15dc119a8b7f4466e1033..4c161a15552044bd9857ae8ef291feac5f9ecf6d 100644
--- a/ppapi/cpp/dev/audio_input_dev.cc
+++ b/ppapi/cpp/dev/audio_input_dev.cc
@@ -18,35 +18,12 @@ template <> const char* interface_name<PPB_AudioInput_Dev_0_2>() {
return PPB_AUDIO_INPUT_DEV_INTERFACE_0_2;
}
-template <> const char* interface_name<PPB_AudioInput_Dev_0_1>() {
- return PPB_AUDIO_INPUT_DEV_INTERFACE_0_1;
-}
-
} // namespace
-AudioInput_Dev::AudioInput_Dev() : audio_input_callback_(NULL),
- user_data_(NULL) {
-}
-
-AudioInput_Dev::AudioInput_Dev(const InstanceHandle& instance,
- const AudioConfig& config,
- PPB_AudioInput_Callback callback,
- void* user_data)
- : config_(config),
- audio_input_callback_(callback),
- user_data_(user_data) {
- if (has_interface<PPB_AudioInput_Dev_0_2>()) {
- PassRefFromConstructor(get_interface<PPB_AudioInput_Dev_0_2>()->Create(
- instance.pp_instance()));
- } else if (has_interface<PPB_AudioInput_Dev_0_1>()) {
- PassRefFromConstructor(get_interface<PPB_AudioInput_Dev_0_1>()->Create(
- instance.pp_instance(), config.pp_resource(), callback, user_data));
- }
+AudioInput_Dev::AudioInput_Dev() {
}
-AudioInput_Dev::AudioInput_Dev(const InstanceHandle& instance)
- : audio_input_callback_(NULL),
- user_data_(NULL) {
+AudioInput_Dev::AudioInput_Dev(const InstanceHandle& instance) {
if (has_interface<PPB_AudioInput_Dev_0_2>()) {
PassRefFromConstructor(get_interface<PPB_AudioInput_Dev_0_2>()->Create(
instance.pp_instance()));
@@ -58,8 +35,7 @@ AudioInput_Dev::~AudioInput_Dev() {
// static
bool AudioInput_Dev::IsAvailable() {
- return has_interface<PPB_AudioInput_Dev_0_2>() ||
- has_interface<PPB_AudioInput_Dev_0_1>();
+ return has_interface<PPB_AudioInput_Dev_0_2>();
}
int32_t AudioInput_Dev::EnumerateDevices(
@@ -80,31 +56,6 @@ int32_t AudioInput_Dev::EnumerateDevices(
}
int32_t AudioInput_Dev::Open(const DeviceRef_Dev& device_ref,
- const CompletionCallback& callback) {
- if (has_interface<PPB_AudioInput_Dev_0_2>()) {
- return get_interface<PPB_AudioInput_Dev_0_2>()->Open(
- pp_resource(), device_ref.pp_resource(), config_.pp_resource(),
- audio_input_callback_, user_data_, callback.pp_completion_callback());
- }
-
- if (has_interface<PPB_AudioInput_Dev_0_1>()) {
- if (is_null())
- return callback.MayForce(PP_ERROR_FAILED);
-
- // If the v0.1 interface is being used and there is a valid resource handle,
- // then the default device has been successfully opened during resource
- // creation.
- if (device_ref.is_null())
- return callback.MayForce(PP_OK);
-
- // The v0.1 interface doesn't support devices other than the default one.
- return callback.MayForce(PP_ERROR_NOTSUPPORTED);
- }
-
- return callback.MayForce(PP_ERROR_NOINTERFACE);
-}
-
-int32_t AudioInput_Dev::Open(const DeviceRef_Dev& device_ref,
const AudioConfig& config,
PPB_AudioInput_Callback audio_input_callback,
void* user_data,
@@ -124,11 +75,6 @@ bool AudioInput_Dev::StartCapture() {
pp_resource()));
}
- if (has_interface<PPB_AudioInput_Dev_0_1>()) {
- return PP_ToBool(get_interface<PPB_AudioInput_Dev_0_1>()->StartCapture(
- pp_resource()));
- }
-
return false;
}
@@ -138,11 +84,6 @@ bool AudioInput_Dev::StopCapture() {
pp_resource()));
}
- if (has_interface<PPB_AudioInput_Dev_0_1>()) {
- return PP_ToBool(get_interface<PPB_AudioInput_Dev_0_1>()->StopCapture(
- pp_resource()));
- }
-
return false;
}
« no previous file with comments | « ppapi/cpp/dev/audio_input_dev.h ('k') | ppapi/examples/audio_input/audio_input.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698