summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/webkit_glue.gypi2
-rw-r--r--webkit/plugins/ppapi/plugin_module.cc13
-rw-r--r--webkit/plugins/ppapi/plugin_module.h14
-rw-r--r--webkit/plugins/ppapi/ppb_audio_impl.cc278
-rw-r--r--webkit/plugins/ppapi/ppb_audio_impl.h65
-rw-r--r--webkit/plugins/ppapi/ppb_char_set_impl.cc4
-rw-r--r--webkit/plugins/ppapi/ppb_crypto_impl.cc2
-rw-r--r--webkit/plugins/ppapi/ppb_font_impl.cc2
-rw-r--r--webkit/plugins/ppapi/ppb_font_impl.h2
-rw-r--r--webkit/plugins/ppapi/ppb_image_data_impl.h2
-rw-r--r--webkit/plugins/ppapi/ppb_url_util_impl.cc2
-rw-r--r--webkit/plugins/ppapi/resource.h2
-rw-r--r--webkit/plugins/ppapi/resource_creation_impl.cc40
-rw-r--r--webkit/plugins/ppapi/resource_creation_impl.h17
-rw-r--r--webkit/plugins/ppapi/resource_tracker.cc10
-rw-r--r--webkit/plugins/ppapi/resource_tracker.h8
-rw-r--r--webkit/plugins/ppapi/webkit_forwarding_impl.cc2
-rw-r--r--webkit/plugins/ppapi/webkit_forwarding_impl.h2
18 files changed, 173 insertions, 294 deletions
diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi
index 53a6912..1b1f3df 100644
--- a/webkit/glue/webkit_glue.gypi
+++ b/webkit/glue/webkit_glue.gypi
@@ -110,7 +110,7 @@
'<(DEPTH)/gpu/gpu.gyp:gles2_implementation',
'<(DEPTH)/net/net.gyp:net',
'<(DEPTH)/ppapi/ppapi.gyp:ppapi_c',
- '<(DEPTH)/ppapi/ppapi_internal.gyp:ppapi_shared_impl',
+ '<(DEPTH)/ppapi/ppapi_internal.gyp:ppapi_shared',
'<(DEPTH)/printing/printing.gyp:printing',
'<(DEPTH)/skia/skia.gyp:skia',
'<(DEPTH)/third_party/icu/icu.gyp:icui18n',
diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc
index 6d4543f..881fe66 100644
--- a/webkit/plugins/ppapi/plugin_module.cc
+++ b/webkit/plugins/ppapi/plugin_module.cc
@@ -42,6 +42,8 @@
#include "ppapi/c/pp_module.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_var.h"
+#include "ppapi/c/ppb_audio.h"
+#include "ppapi/c/ppb_audio_config.h"
#include "ppapi/c/ppb_core.h"
#include "ppapi/c/ppb_graphics_2d.h"
#include "ppapi/c/ppb_image_data.h"
@@ -63,13 +65,14 @@
#include "ppapi/c/private/ppb_proxy_private.h"
#include "ppapi/c/private/ppb_nacl_private.h"
#include "ppapi/c/private/ppb_uma_private.h"
+#include "ppapi/c/trusted/ppb_audio_trusted.h"
#include "ppapi/c/trusted/ppb_broker_trusted.h"
#include "ppapi/c/trusted/ppb_image_data_trusted.h"
#include "ppapi/c/trusted/ppb_url_loader_trusted.h"
+#include "ppapi/thunk/thunk.h"
#include "webkit/plugins/ppapi/callbacks.h"
#include "webkit/plugins/ppapi/common.h"
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
-#include "webkit/plugins/ppapi/ppb_audio_impl.h"
#include "webkit/plugins/ppapi/ppb_broker_impl.h"
#include "webkit/plugins/ppapi/ppb_buffer_impl.h"
#include "webkit/plugins/ppapi/ppb_char_set_impl.h"
@@ -235,11 +238,11 @@ const void* GetInterface(const char* name) {
// Please keep alphabetized by interface macro name with "special" stuff at
// the bottom.
if (strcmp(name, PPB_AUDIO_CONFIG_INTERFACE) == 0)
- return PPB_AudioConfig_Impl::GetInterface();
+ return ::ppapi::thunk::GetPPB_AudioConfig_Thunk();
if (strcmp(name, PPB_AUDIO_INTERFACE) == 0)
- return PPB_Audio_Impl::GetInterface();
+ return ::ppapi::thunk::GetPPB_Audio_Thunk();
if (strcmp(name, PPB_AUDIO_TRUSTED_INTERFACE) == 0)
- return PPB_Audio_Impl::GetTrustedInterface();
+ return ::ppapi::thunk::GetPPB_AudioTrusted_Thunk();
if (strcmp(name, PPB_BROKER_TRUSTED_INTERFACE) == 0)
return PPB_Broker_Impl::GetTrustedInterface();
if (strcmp(name, PPB_BUFFER_DEV_INTERFACE) == 0)
@@ -563,7 +566,7 @@ PluginDelegate::PpapiBroker* PluginModule::GetBroker(){
return broker_;
}
-pp::shared_impl::WebKitForwarding* PluginModule::GetWebKitForwarding() {
+::ppapi::WebKitForwarding* PluginModule::GetWebKitForwarding() {
if (!webkit_forwarding_.get())
webkit_forwarding_.reset(new WebKitForwardingImpl);
return webkit_forwarding_.get();
diff --git a/webkit/plugins/ppapi/plugin_module.h b/webkit/plugins/ppapi/plugin_module.h
index d1fa058..cce03df 100644
--- a/webkit/plugins/ppapi/plugin_module.h
+++ b/webkit/plugins/ppapi/plugin_module.h
@@ -31,16 +31,14 @@ namespace base {
class WaitableEvent;
}
-namespace pp {
+namespace ppapi {
+class WebKitForwarding;
+} // namespace ppapi
+namespace pp {
namespace proxy {
class HostDispatcher;
} // namespace proxy
-
-namespace shared_impl {
-class WebKitForwarding;
-} // namespace shared_impl
-
} // namespace pp
namespace IPC {
@@ -156,7 +154,7 @@ class PluginModule : public base::RefCounted<PluginModule>,
PluginDelegate::PpapiBroker* GetBroker();
// Retrieves the forwarding interface used for talking to WebKit.
- pp::shared_impl::WebKitForwarding* GetWebKitForwarding();
+ ::ppapi::WebKitForwarding* GetWebKitForwarding();
private:
// Calls the InitializeModule entrypoint. The entrypoint must have been
@@ -207,7 +205,7 @@ class PluginModule : public base::RefCounted<PluginModule>,
PP_Bool (*reserve_instance_id_)(PP_Module, PP_Instance);
// Lazily created by GetWebKitForwarding.
- scoped_ptr<pp::shared_impl::WebKitForwarding> webkit_forwarding_;
+ scoped_ptr< ::ppapi::WebKitForwarding> webkit_forwarding_;
DISALLOW_COPY_AND_ASSIGN(PluginModule);
};
diff --git a/webkit/plugins/ppapi/ppb_audio_impl.cc b/webkit/plugins/ppapi/ppb_audio_impl.cc
index 54de09c..1709b83 100644
--- a/webkit/plugins/ppapi/ppb_audio_impl.cc
+++ b/webkit/plugins/ppapi/ppb_audio_impl.cc
@@ -9,204 +9,24 @@
#include "ppapi/c/ppb_audio.h"
#include "ppapi/c/ppb_audio_config.h"
#include "ppapi/c/trusted/ppb_audio_trusted.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_audio_config_api.h"
+#include "ppapi/thunk/thunk.h"
#include "webkit/plugins/ppapi/common.h"
namespace webkit {
namespace ppapi {
-namespace {
-
// PPB_AudioConfig -------------------------------------------------------------
-uint32_t RecommendSampleFrameCount(PP_AudioSampleRate sample_rate,
- uint32_t requested_sample_frame_count);
-
-PP_Resource CreateStereo16bit(PP_Instance instance_id,
- PP_AudioSampleRate sample_rate,
- uint32_t sample_frame_count) {
- PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id);
- if (!instance)
- return 0;
-
- // TODO(brettw): Currently we don't actually check what the hardware
- // supports, so just allow sample rates of the "guaranteed working" ones.
- if (sample_rate != PP_AUDIOSAMPLERATE_44100 &&
- sample_rate != PP_AUDIOSAMPLERATE_48000)
- return 0;
-
- // TODO(brettw): Currently we don't actually query to get a value from the
- // hardware, so just validate the range.
- if (RecommendSampleFrameCount(sample_rate, sample_frame_count) !=
- sample_frame_count)
- return 0;
-
- scoped_refptr<PPB_AudioConfig_Impl> config(
- new PPB_AudioConfig_Impl(instance, sample_rate, sample_frame_count));
- return config->GetReference();
-}
-
-uint32_t RecommendSampleFrameCount(PP_AudioSampleRate sample_rate,
- uint32_t requested_sample_frame_count) {
- // TODO(brettw) Currently we don't actually query to get a value from the
- // hardware, so we always return the input for in-range values.
- //
- // Danger: this code is duplicated in the audio config proxy.
- if (requested_sample_frame_count < PP_AUDIOMINSAMPLEFRAMECOUNT)
- return PP_AUDIOMINSAMPLEFRAMECOUNT;
- if (requested_sample_frame_count > PP_AUDIOMAXSAMPLEFRAMECOUNT)
- return PP_AUDIOMAXSAMPLEFRAMECOUNT;
- return requested_sample_frame_count;
-}
-
-PP_Bool IsAudioConfig(PP_Resource resource) {
- scoped_refptr<PPB_AudioConfig_Impl> config =
- Resource::GetAs<PPB_AudioConfig_Impl>(resource);
- return BoolToPPBool(!!config);
-}
-
-PP_AudioSampleRate GetSampleRate(PP_Resource config_id) {
- scoped_refptr<PPB_AudioConfig_Impl> config =
- Resource::GetAs<PPB_AudioConfig_Impl>(config_id);
- return config ? config->sample_rate() : PP_AUDIOSAMPLERATE_NONE;
-}
-
-uint32_t GetSampleFrameCount(PP_Resource config_id) {
- scoped_refptr<PPB_AudioConfig_Impl> config =
- Resource::GetAs<PPB_AudioConfig_Impl>(config_id);
- return config ? config->sample_frame_count() : 0;
-}
-
-const PPB_AudioConfig ppb_audioconfig = {
- &CreateStereo16bit,
- &RecommendSampleFrameCount,
- &IsAudioConfig,
- &GetSampleRate,
- &GetSampleFrameCount
-};
-
-// PPB_Audio -------------------------------------------------------------------
-
-PP_Resource Create(PP_Instance instance_id, PP_Resource config_id,
- PPB_Audio_Callback user_callback, void* user_data) {
- PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id);
- if (!instance)
- return 0;
- if (!user_callback)
- return 0;
- scoped_refptr<PPB_Audio_Impl> audio(new PPB_Audio_Impl(instance));
- if (!audio->Init(instance->delegate(), config_id,
- user_callback, user_data))
- return 0;
- return audio->GetReference();
-}
-
-PP_Bool IsAudio(PP_Resource resource) {
- scoped_refptr<PPB_Audio_Impl> audio =
- Resource::GetAs<PPB_Audio_Impl>(resource);
- return BoolToPPBool(!!audio);
-}
-
-PP_Resource GetCurrentConfig(PP_Resource audio_id) {
- scoped_refptr<PPB_Audio_Impl> audio =
- Resource::GetAs<PPB_Audio_Impl>(audio_id);
- return audio ? audio->GetCurrentConfig() : 0;
-}
-
-PP_Bool StartPlayback(PP_Resource audio_id) {
- scoped_refptr<PPB_Audio_Impl> audio =
- Resource::GetAs<PPB_Audio_Impl>(audio_id);
- return audio ? BoolToPPBool(audio->StartPlayback()) : PP_FALSE;
-}
-
-PP_Bool StopPlayback(PP_Resource audio_id) {
- scoped_refptr<PPB_Audio_Impl> audio =
- Resource::GetAs<PPB_Audio_Impl>(audio_id);
- return audio ? BoolToPPBool(audio->StopPlayback()) : PP_FALSE;
-}
-
-const PPB_Audio ppb_audio = {
- &Create,
- &IsAudio,
- &GetCurrentConfig,
- &StartPlayback,
- &StopPlayback,
-};
-
-// PPB_AudioTrusted ------------------------------------------------------------
-
-PP_Resource CreateTrusted(PP_Instance instance_id) {
- PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id);
- if (!instance)
- return 0;
- scoped_refptr<PPB_Audio_Impl> audio(new PPB_Audio_Impl(instance));
- return audio->GetReference();
+PPB_AudioConfig_Impl::PPB_AudioConfig_Impl(PluginInstance* instance)
+ : Resource(instance) {
}
-int32_t Open(PP_Resource audio_id,
- PP_Resource config_id,
- PP_CompletionCallback created) {
- scoped_refptr<PPB_Audio_Impl> audio =
- Resource::GetAs<PPB_Audio_Impl>(audio_id);
- if (!audio)
- return PP_ERROR_BADRESOURCE;
- if (!created.func)
- return PP_ERROR_BADARGUMENT;
- return audio->Open(audio->instance()->delegate(), config_id, created);
+PPB_AudioConfig_Impl::~PPB_AudioConfig_Impl() {
}
-int32_t GetSyncSocket(PP_Resource audio_id, int* sync_socket) {
- scoped_refptr<PPB_Audio_Impl> audio =
- Resource::GetAs<PPB_Audio_Impl>(audio_id);
- if (audio)
- return audio->GetSyncSocket(sync_socket);
- return PP_ERROR_BADRESOURCE;
-}
-
-int32_t GetSharedMemory(PP_Resource audio_id,
- int* shm_handle,
- uint32_t* shm_size) {
- scoped_refptr<PPB_Audio_Impl> audio =
- Resource::GetAs<PPB_Audio_Impl>(audio_id);
- if (audio)
- return audio->GetSharedMemory(shm_handle, shm_size);
- return PP_ERROR_BADRESOURCE;
-}
-
-const PPB_AudioTrusted ppb_audiotrusted = {
- &CreateTrusted,
- &Open,
- &GetSyncSocket,
- &GetSharedMemory,
-};
-
-} // namespace
-
-// PPB_AudioConfig_Impl --------------------------------------------------------
-
-PPB_AudioConfig_Impl::PPB_AudioConfig_Impl(
- PluginInstance* instance,
- PP_AudioSampleRate sample_rate,
- uint32_t sample_frame_count)
- : Resource(instance),
- sample_rate_(sample_rate),
- sample_frame_count_(sample_frame_count) {
-}
-
-const PPB_AudioConfig* PPB_AudioConfig_Impl::GetInterface() {
- return &ppb_audioconfig;
-}
-
-size_t PPB_AudioConfig_Impl::BufferSize() {
- // TODO(audio): as more options become available, we'll need to
- // have additional code here to correctly calculate the size in
- // bytes of an audio buffer. For now, only support two channel
- // int16_t sample buffers.
- const int kChannels = 2;
- const int kSizeOfSample = sizeof(int16_t);
- return static_cast<size_t>(sample_frame_count_ * kSizeOfSample * kChannels);
-}
-
-PPB_AudioConfig_Impl* PPB_AudioConfig_Impl::AsPPB_AudioConfig_Impl() {
+::ppapi::thunk::PPB_AudioConfig_API* PPB_AudioConfig_Impl::AsAudioConfig_API() {
return this;
}
@@ -214,12 +34,16 @@ PPB_AudioConfig_Impl* PPB_AudioConfig_Impl::AsPPB_AudioConfig_Impl() {
PPB_Audio_Impl::PPB_Audio_Impl(PluginInstance* instance)
: Resource(instance),
+ config_id_(0),
audio_(NULL),
create_callback_pending_(false) {
create_callback_ = PP_MakeCompletionCallback(NULL, NULL);
}
PPB_Audio_Impl::~PPB_Audio_Impl() {
+ if (config_id_)
+ ResourceTracker::Get()->UnrefResource(config_id_);
+
// 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
@@ -238,70 +62,80 @@ PPB_Audio_Impl::~PPB_Audio_Impl() {
}
}
-const PPB_Audio* PPB_Audio_Impl::GetInterface() {
- return &ppb_audio;
-}
-
-const PPB_AudioTrusted* PPB_Audio_Impl::GetTrustedInterface() {
- return &ppb_audiotrusted;
+::ppapi::thunk::PPB_Audio_API* PPB_Audio_Impl::AsAudio_API() {
+ return this;
}
-PPB_Audio_Impl* PPB_Audio_Impl::AsPPB_Audio_Impl() {
+::ppapi::thunk::PPB_AudioTrusted_API* PPB_Audio_Impl::AsAudioTrusted_API() {
return this;
}
-bool PPB_Audio_Impl::Init(PluginDelegate* plugin_delegate,
- PP_Resource config_id,
+bool PPB_Audio_Impl::Init(PP_Resource config_id,
PPB_Audio_Callback callback, void* user_data) {
- CHECK(!audio_);
- config_ = Resource::GetAs<PPB_AudioConfig_Impl>(config_id);
- if (!config_)
+ // Validate the config and keep a reference to it.
+ ::ppapi::thunk::EnterResourceNoLock< ::ppapi::thunk::PPB_AudioConfig_API>
+ enter(config_id, true);
+ if (enter.failed())
+ return false;
+ config_id_ = config_id;
+ ResourceTracker::Get()->AddRefResource(config_id);
+
+ if (!callback)
return false;
SetCallback(callback, user_data);
// When the stream is created, we'll get called back on StreamCreated().
- audio_ = plugin_delegate->CreateAudio(config_->sample_rate(),
- config_->sample_frame_count(),
- this);
+ CHECK(!audio_);
+ audio_ = instance()->delegate()->CreateAudio(
+ enter.object()->GetSampleRate(),
+ enter.object()->GetSampleFrameCount(),
+ this);
return audio_ != NULL;
}
PP_Resource PPB_Audio_Impl::GetCurrentConfig() {
- return config_->GetReference();
+ // AddRef on behalf of caller.
+ ResourceTracker::Get()->AddRefResource(config_id_);
+ return config_id_;
}
-bool PPB_Audio_Impl::StartPlayback() {
+PP_Bool PPB_Audio_Impl::StartPlayback() {
if (!audio_)
- return false;
+ return PP_FALSE;
if (playing())
- return true;
+ return PP_TRUE;
SetStartPlaybackState();
- return audio_->StartPlayback();
+ return BoolToPPBool(audio_->StartPlayback());
}
-bool PPB_Audio_Impl::StopPlayback() {
+PP_Bool PPB_Audio_Impl::StopPlayback() {
if (!audio_)
- return false;
+ return PP_FALSE;
if (!playing())
- return true;
+ return PP_TRUE;
if (!audio_->StopPlayback())
- return false;
+ return PP_FALSE;
SetStopPlaybackState();
- return true;
+ return PP_TRUE;
}
-int32_t PPB_Audio_Impl::Open(PluginDelegate* plugin_delegate,
- PP_Resource config_id,
- PP_CompletionCallback create_callback) {
- DCHECK(!audio_);
- config_ = Resource::GetAs<PPB_AudioConfig_Impl>(config_id);
- if (!config_)
- return PP_ERROR_BADRESOURCE;
+int32_t PPB_Audio_Impl::OpenTrusted(PP_Resource config_id,
+ PP_CompletionCallback create_callback) {
+
+ // Validate the config and keep a reference to it.
+ ::ppapi::thunk::EnterResourceNoLock< ::ppapi::thunk::PPB_AudioConfig_API>
+ enter(config_id, true);
+ if (enter.failed())
+ return false;
+ config_id_ = config_id;
+ ResourceTracker::Get()->AddRefResource(config_id);
// When the stream is created, we'll get called back on StreamCreated().
- audio_ = plugin_delegate->CreateAudio(config_->sample_rate(),
- config_->sample_frame_count(),
- this);
+ DCHECK(!audio_);
+ audio_ = instance()->delegate()->CreateAudio(
+ enter.object()->GetSampleRate(),
+ enter.object()->GetSampleFrameCount(),
+ this);
if (!audio_)
return PP_ERROR_FAILED;
diff --git a/webkit/plugins/ppapi/ppb_audio_impl.h b/webkit/plugins/ppapi/ppb_audio_impl.h
index 9ea2588..201193f 100644
--- a/webkit/plugins/ppapi/ppb_audio_impl.h
+++ b/webkit/plugins/ppapi/ppb_audio_impl.h
@@ -13,7 +13,9 @@
#include "ppapi/c/ppb_audio.h"
#include "ppapi/c/ppb_audio_config.h"
#include "ppapi/c/trusted/ppb_audio_trusted.h"
+#include "ppapi/shared_impl/audio_config_impl.h"
#include "ppapi/shared_impl/audio_impl.h"
+#include "ppapi/thunk/ppb_audio_trusted_api.h"
#include "webkit/plugins/ppapi/plugin_delegate.h"
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
#include "webkit/plugins/ppapi/resource.h"
@@ -23,54 +25,51 @@ namespace ppapi {
class PluginInstance;
-class PPB_AudioConfig_Impl : public Resource {
+// The implementation is actually in AudioConfigImpl.
+class PPB_AudioConfig_Impl : public Resource,
+ public ::ppapi::AudioConfigImpl {
public:
- PPB_AudioConfig_Impl(PluginInstance* instance,
- PP_AudioSampleRate sample_rate,
- uint32_t sample_frame_count);
- size_t BufferSize();
- static const PPB_AudioConfig* GetInterface();
+ // Note that you must call Init (on AudioConfigImpl) before using this class.
+ PPB_AudioConfig_Impl(PluginInstance* instance);
+ ~PPB_AudioConfig_Impl();
- PP_AudioSampleRate sample_rate() { return sample_rate_; }
- uint32_t sample_frame_count() { return sample_frame_count_; }
+ // ResourceObjectBase overrides.
+ virtual ::ppapi::thunk::PPB_AudioConfig_API* AsAudioConfig_API() OVERRIDE;
private:
- // Resource override.
- virtual PPB_AudioConfig_Impl* AsPPB_AudioConfig_Impl();
-
- PP_AudioSampleRate sample_rate_;
- uint32_t sample_frame_count_;
+ DISALLOW_COPY_AND_ASSIGN(PPB_AudioConfig_Impl);
};
// Some of the backend functionality of this class is implemented by the
// AudioImpl so it can be shared with the proxy.
class PPB_Audio_Impl : public Resource,
- public pp::shared_impl::AudioImpl,
+ public ::ppapi::AudioImpl,
+ public ::ppapi::thunk::PPB_AudioTrusted_API,
public PluginDelegate::PlatformAudio::Client {
public:
+ // After creation, either call Init (for non-trusted init) or OpenTrusted
+ // (for trusted init).
explicit PPB_Audio_Impl(PluginInstance* instance);
virtual ~PPB_Audio_Impl();
- static const PPB_Audio* GetInterface();
- static const PPB_AudioTrusted* GetTrustedInterface();
-
- // PPB_Audio implementation.
- bool Init(PluginDelegate* plugin_delegate,
- PP_Resource config_id,
+ // Initialization function for non-trusted init.
+ bool Init(PP_Resource config_id,
PPB_Audio_Callback user_callback, void* user_data);
- PP_Resource GetCurrentConfig();
- bool StartPlayback();
- bool StopPlayback();
- // PPB_Audio_Trusted implementation.
- int32_t Open(PluginDelegate* plugin_delegate,
- PP_Resource config_id,
- PP_CompletionCallback create_callback);
- int32_t GetSyncSocket(int* sync_socket);
- int32_t GetSharedMemory(int* shm_handle, uint32_t* shm_size);
+ // ResourceObjectBase overrides.
+ virtual ::ppapi::thunk::PPB_Audio_API* AsAudio_API();
+ virtual ::ppapi::thunk::PPB_AudioTrusted_API* AsAudioTrusted_API();
+
+ // PPB_Audio_API implementation.
+ virtual PP_Resource GetCurrentConfig() OVERRIDE;
+ virtual PP_Bool StartPlayback() OVERRIDE;
+ virtual PP_Bool StopPlayback() OVERRIDE;
- // Resource override.
- virtual PPB_Audio_Impl* AsPPB_Audio_Impl();
+ // PPB_AudioTrusted_API implementation.
+ virtual int32_t OpenTrusted(PP_Resource config_id,
+ PP_CompletionCallback create_callback) OVERRIDE;
+ virtual int32_t GetSyncSocket(int* sync_socket) OVERRIDE;
+ virtual int32_t GetSharedMemory(int* shm_handle, uint32_t* shm_size) OVERRIDE;
private:
// PluginDelegate::PlatformAudio::Client implementation.
@@ -78,8 +77,8 @@ class PPB_Audio_Impl : public Resource,
size_t shared_memory_size_,
base::SyncSocket::Handle socket);
- // AudioConfig used for creating this Audio object.
- scoped_refptr<PPB_AudioConfig_Impl> config_;
+ // AudioConfig used for creating this Audio object. We own a ref.
+ PP_Resource config_id_;
// PluginDelegate audio object that we delegate audio IPC through. We don't
// own this pointer but are responsible for calling Shutdown on it.
diff --git a/webkit/plugins/ppapi/ppb_char_set_impl.cc b/webkit/plugins/ppapi/ppb_char_set_impl.cc
index dfa7bd3..5f9b54e 100644
--- a/webkit/plugins/ppapi/ppb_char_set_impl.cc
+++ b/webkit/plugins/ppapi/ppb_char_set_impl.cc
@@ -22,7 +22,7 @@ char* UTF16ToCharSet(PP_Instance /* instance */,
const char* output_char_set,
PP_CharSet_ConversionError on_error,
uint32_t* output_length) {
- return pp::shared_impl::CharSetImpl::UTF16ToCharSet(
+ return ::ppapi::CharSetImpl::UTF16ToCharSet(
PluginModule::GetCore(), utf16, utf16_len, output_char_set, on_error,
output_length);
}
@@ -32,7 +32,7 @@ uint16_t* CharSetToUTF16(PP_Instance /* instance */,
const char* input_char_set,
PP_CharSet_ConversionError on_error,
uint32_t* output_length) {
- return pp::shared_impl::CharSetImpl::CharSetToUTF16(
+ return ::ppapi::CharSetImpl::CharSetToUTF16(
PluginModule::GetCore(), input, input_len, input_char_set, on_error,
output_length);
}
diff --git a/webkit/plugins/ppapi/ppb_crypto_impl.cc b/webkit/plugins/ppapi/ppb_crypto_impl.cc
index 8f3a73b..f8864c8 100644
--- a/webkit/plugins/ppapi/ppb_crypto_impl.cc
+++ b/webkit/plugins/ppapi/ppb_crypto_impl.cc
@@ -13,7 +13,7 @@ namespace ppapi {
namespace {
const PPB_Crypto_Dev ppb_crypto = {
- &pp::shared_impl::CryptoImpl::GetRandomBytes
+ &::ppapi::CryptoImpl::GetRandomBytes
};
} // namespace
diff --git a/webkit/plugins/ppapi/ppb_font_impl.cc b/webkit/plugins/ppapi/ppb_font_impl.cc
index 02fd5a9..a152691 100644
--- a/webkit/plugins/ppapi/ppb_font_impl.cc
+++ b/webkit/plugins/ppapi/ppb_font_impl.cc
@@ -13,7 +13,7 @@
#include "webkit/plugins/ppapi/string.h"
#include "webkit/plugins/ppapi/var.h"
-using pp::shared_impl::WebKitForwarding;
+using ::ppapi::WebKitForwarding;
namespace webkit {
namespace ppapi {
diff --git a/webkit/plugins/ppapi/ppb_font_impl.h b/webkit/plugins/ppapi/ppb_font_impl.h
index d7204aef..4122a6b 100644
--- a/webkit/plugins/ppapi/ppb_font_impl.h
+++ b/webkit/plugins/ppapi/ppb_font_impl.h
@@ -53,7 +53,7 @@ class PPB_Font_Impl : public Resource,
uint32_t char_offset) OVERRIDE;
private:
- scoped_ptr<pp::shared_impl::WebKitForwarding::Font> font_forwarding_;
+ scoped_ptr< ::ppapi::WebKitForwarding::Font> font_forwarding_;
DISALLOW_COPY_AND_ASSIGN(PPB_Font_Impl);
};
diff --git a/webkit/plugins/ppapi/ppb_image_data_impl.h b/webkit/plugins/ppapi/ppb_image_data_impl.h
index 69a7a65..14a004d 100644
--- a/webkit/plugins/ppapi/ppb_image_data_impl.h
+++ b/webkit/plugins/ppapi/ppb_image_data_impl.h
@@ -24,7 +24,7 @@ namespace webkit {
namespace ppapi {
class PPB_ImageData_Impl : public Resource,
- public pp::shared_impl::ImageDataImpl,
+ public ::ppapi::ImageDataImpl,
public ::ppapi::thunk::PPB_ImageData_API {
public:
explicit PPB_ImageData_Impl(PluginInstance* instance);
diff --git a/webkit/plugins/ppapi/ppb_url_util_impl.cc b/webkit/plugins/ppapi/ppb_url_util_impl.cc
index 13de355..bf71b78 100644
--- a/webkit/plugins/ppapi/ppb_url_util_impl.cc
+++ b/webkit/plugins/ppapi/ppb_url_util_impl.cc
@@ -25,7 +25,7 @@
namespace webkit {
namespace ppapi {
-using pp::shared_impl::URLUtilImpl;
+using ::ppapi::URLUtilImpl;
namespace {
diff --git a/webkit/plugins/ppapi/resource.h b/webkit/plugins/ppapi/resource.h
index a263231..781c55d 100644
--- a/webkit/plugins/ppapi/resource.h
+++ b/webkit/plugins/ppapi/resource.h
@@ -51,7 +51,7 @@ FOR_ALL_RESOURCES(DECLARE_RESOURCE_CLASS)
#undef DECLARE_RESOURCE_CLASS
class Resource : public base::RefCountedThreadSafe<Resource>,
- public ::ppapi::shared_impl::ResourceObjectBase {
+ public ::ppapi::ResourceObjectBase {
public:
explicit Resource(PluginInstance* instance);
virtual ~Resource();
diff --git a/webkit/plugins/ppapi/resource_creation_impl.cc b/webkit/plugins/ppapi/resource_creation_impl.cc
index 6308cc2..e00c546 100644
--- a/webkit/plugins/ppapi/resource_creation_impl.cc
+++ b/webkit/plugins/ppapi/resource_creation_impl.cc
@@ -7,6 +7,7 @@
#include "ppapi/c/pp_size.h"
#include "ppapi/shared_impl/font_impl.h"
#include "webkit/plugins/ppapi/common.h"
+#include "webkit/plugins/ppapi/ppb_audio_impl.h"
#include "webkit/plugins/ppapi/ppb_font_impl.h"
#include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h"
#include "webkit/plugins/ppapi/ppb_image_data_impl.h"
@@ -25,6 +26,43 @@ ResourceCreationImpl::AsResourceCreation() {
return this;
}
+PP_Resource ResourceCreationImpl::CreateAudio(
+ PP_Instance instance_id,
+ PP_Resource config_id,
+ PPB_Audio_Callback audio_callback,
+ void* user_data) {
+ PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id);
+ if (!instance)
+ return 0;
+ scoped_refptr<PPB_Audio_Impl> audio(new PPB_Audio_Impl(instance));
+ if (!audio->Init(config_id, audio_callback, user_data))
+ return 0;
+ return audio->GetReference();
+}
+
+PP_Resource ResourceCreationImpl::CreateAudioConfig(
+ PP_Instance instance_id,
+ PP_AudioSampleRate sample_rate,
+ uint32_t sample_frame_count) {
+ PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id);
+ if (!instance)
+ return 0;
+ scoped_refptr<PPB_AudioConfig_Impl> config(
+ new PPB_AudioConfig_Impl(instance));
+ if (!config->Init(sample_rate, sample_frame_count))
+ return 0;
+ return config->GetReference();
+}
+
+PP_Resource ResourceCreationImpl::CreateAudioTrusted(
+ PP_Instance instance_id) {
+ PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id);
+ if (!instance)
+ return 0;
+ scoped_refptr<PPB_Audio_Impl> audio(new PPB_Audio_Impl(instance));
+ return audio->GetReference();
+}
+
PP_Resource ResourceCreationImpl::CreateFontObject(
PP_Instance pp_instance,
const PP_FontDescription_Dev* description) {
@@ -32,7 +70,7 @@ PP_Resource ResourceCreationImpl::CreateFontObject(
if (!instance)
return 0;
- if (!pp::shared_impl::FontImpl::IsPPFontDescriptionValid(*description))
+ if (!::ppapi::FontImpl::IsPPFontDescriptionValid(*description))
return 0;
scoped_refptr<PPB_Font_Impl> font(new PPB_Font_Impl(instance, *description));
diff --git a/webkit/plugins/ppapi/resource_creation_impl.h b/webkit/plugins/ppapi/resource_creation_impl.h
index 2e31928..8b8e551 100644
--- a/webkit/plugins/ppapi/resource_creation_impl.h
+++ b/webkit/plugins/ppapi/resource_creation_impl.h
@@ -6,13 +6,14 @@
#define WEBKIT_PLUGINS_PPAPI_RESOURCE_CREATION_IMPL_H_
#include "base/basictypes.h"
+#include "base/compiler_specific.h"
#include "ppapi/shared_impl/function_group_base.h"
#include "ppapi/thunk/resource_creation_api.h"
namespace webkit {
namespace ppapi {
-class ResourceCreationImpl : public ::ppapi::shared_impl::FunctionGroupBase,
+class ResourceCreationImpl : public ::ppapi::FunctionGroupBase,
public ::ppapi::thunk::ResourceCreationAPI {
public:
ResourceCreationImpl();
@@ -22,16 +23,24 @@ class ResourceCreationImpl : public ::ppapi::shared_impl::FunctionGroupBase,
virtual ::ppapi::thunk::ResourceCreationAPI* AsResourceCreation();
// ResourceCreationAPI implementation.
+ virtual PP_Resource CreateAudio(PP_Instance instance,
+ PP_Resource config_id,
+ PPB_Audio_Callback audio_callback,
+ void* user_data) OVERRIDE;
+ virtual PP_Resource CreateAudioTrusted(PP_Instance instace) OVERRIDE;
+ virtual PP_Resource CreateAudioConfig(PP_Instance instance,
+ PP_AudioSampleRate sample_rate,
+ uint32_t sample_frame_count) OVERRIDE;
virtual PP_Resource CreateFontObject(
PP_Instance instance,
- const PP_FontDescription_Dev* description);
+ const PP_FontDescription_Dev* description) OVERRIDE;
virtual PP_Resource CreateGraphics2D(PP_Instance pp_instance,
const PP_Size& size,
- PP_Bool is_always_opaque);
+ PP_Bool is_always_opaque) OVERRIDE;
virtual PP_Resource CreateImageData(PP_Instance instance,
PP_ImageDataFormat format,
const PP_Size& size,
- PP_Bool init_to_zero);
+ PP_Bool init_to_zero) OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(ResourceCreationImpl);
diff --git a/webkit/plugins/ppapi/resource_tracker.cc b/webkit/plugins/ppapi/resource_tracker.cc
index 1c4b3a1..a0c82a7 100644
--- a/webkit/plugins/ppapi/resource_tracker.cc
+++ b/webkit/plugins/ppapi/resource_tracker.cc
@@ -42,14 +42,12 @@ template <typename T> static inline bool CheckIdType(T id, PPIdType type) {
return (id & mask) == type;
}
-namespace shared_impl = ::ppapi::shared_impl;
-
namespace webkit {
namespace ppapi {
namespace {
-shared_impl::TrackerBase* GetTrackerBase() {
+::ppapi::TrackerBase* GetTrackerBase() {
return ResourceTracker::Get();
}
@@ -85,7 +83,7 @@ ResourceTracker::ResourceTracker()
: last_resource_id_(0),
last_var_id_(0) {
// Wire up the new shared resource tracker base to use our implementation.
- shared_impl::TrackerBase::Init(&GetTrackerBase);
+ ::ppapi::TrackerBase::Init(&GetTrackerBase);
}
ResourceTracker::~ResourceTracker() {
@@ -240,7 +238,7 @@ uint32 ResourceTracker::GetLiveObjectsForInstance(
found->second.object_vars.size());
}
-shared_impl::ResourceObjectBase* ResourceTracker::GetResourceAPI(
+::ppapi::ResourceObjectBase* ResourceTracker::GetResourceAPI(
PP_Resource res) {
DLOG_IF(ERROR, !CheckIdType(res, PP_ID_TYPE_RESOURCE))
<< res << " is not a PP_Resource.";
@@ -250,7 +248,7 @@ shared_impl::ResourceObjectBase* ResourceTracker::GetResourceAPI(
return result->second.first.get();
}
-shared_impl::FunctionGroupBase* ResourceTracker::GetFunctionAPI(
+::ppapi::FunctionGroupBase* ResourceTracker::GetFunctionAPI(
PP_Instance inst,
pp::proxy::InterfaceID id) {
if (function_proxies_[id].get())
diff --git a/webkit/plugins/ppapi/resource_tracker.h b/webkit/plugins/ppapi/resource_tracker.h
index 744d90c..dca40eb 100644
--- a/webkit/plugins/ppapi/resource_tracker.h
+++ b/webkit/plugins/ppapi/resource_tracker.h
@@ -34,7 +34,7 @@ class Var;
// us to check resource ID validity and to map them to a specific module.
//
// This object is NOT threadsafe.
-class ResourceTracker : public ::ppapi::shared_impl::TrackerBase {
+class ResourceTracker : public ::ppapi::TrackerBase {
public:
// Returns the pointer to the singleton object.
static ResourceTracker* Get();
@@ -57,9 +57,9 @@ class ResourceTracker : public ::ppapi::shared_impl::TrackerBase {
uint32 GetLiveObjectsForInstance(PP_Instance instance) const;
// ResourceTrackerBase.
- virtual ::ppapi::shared_impl::ResourceObjectBase* GetResourceAPI(
+ virtual ::ppapi::ResourceObjectBase* GetResourceAPI(
PP_Resource res);
- virtual ::ppapi::shared_impl::FunctionGroupBase* GetFunctionAPI(
+ virtual ::ppapi::FunctionGroupBase* GetFunctionAPI(
PP_Instance inst,
pp::proxy::InterfaceID id);
@@ -188,7 +188,7 @@ class ResourceTracker : public ::ppapi::shared_impl::TrackerBase {
typedef std::map<PP_Module, PluginModule*> ModuleMap;
ModuleMap module_map_;
- scoped_ptr< ::ppapi::shared_impl::FunctionGroupBase >
+ scoped_ptr< ::ppapi::FunctionGroupBase >
function_proxies_[::pp::proxy::INTERFACE_ID_COUNT];
DISALLOW_COPY_AND_ASSIGN(ResourceTracker);
diff --git a/webkit/plugins/ppapi/webkit_forwarding_impl.cc b/webkit/plugins/ppapi/webkit_forwarding_impl.cc
index 8c79e77..61805f1 100644
--- a/webkit/plugins/ppapi/webkit_forwarding_impl.cc
+++ b/webkit/plugins/ppapi/webkit_forwarding_impl.cc
@@ -20,7 +20,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebTextRun.h"
#include "webkit/glue/webkit_glue.h"
-using pp::shared_impl::WebKitForwarding;
+using ::ppapi::WebKitForwarding;
using WebKit::WebCanvas;
using WebKit::WebFloatPoint;
using WebKit::WebFloatRect;
diff --git a/webkit/plugins/ppapi/webkit_forwarding_impl.h b/webkit/plugins/ppapi/webkit_forwarding_impl.h
index 3914495..8ed2f5d 100644
--- a/webkit/plugins/ppapi/webkit_forwarding_impl.h
+++ b/webkit/plugins/ppapi/webkit_forwarding_impl.h
@@ -9,7 +9,7 @@
namespace webkit {
namespace ppapi {
-class WebKitForwardingImpl : public pp::shared_impl::WebKitForwarding {
+class WebKitForwardingImpl : public ::ppapi::WebKitForwarding {
public:
WebKitForwardingImpl();
virtual ~WebKitForwardingImpl();