diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-03 22:44:58 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-03 22:44:58 +0000 |
commit | 73b61881322b88e5bb10fdb9891e6772da334d08 (patch) | |
tree | 845d86b72e8a66d1daf578e3c5ab604b503376e2 /ppapi/thunk | |
parent | aafbcb57bbc46cd82c29fdb3c216ad7b15803704 (diff) | |
download | chromium_src-73b61881322b88e5bb10fdb9891e6772da334d08.zip chromium_src-73b61881322b88e5bb10fdb9891e6772da334d08.tar.gz chromium_src-73b61881322b88e5bb10fdb9891e6772da334d08.tar.bz2 |
Revert 95309 - I need to fix some bugs with this.
Add a template to handle properly issuing completion callbacks. This fixes
some bugs where we forgot to issue completion callbacks in some error cases
in the proxy, and cleans up the cases that were already doing this properly.
This removes the PPB_AudioTrusted_API and folds those functions into the
regular Audio API. I'm trying to merge more things to have a smaller explosion
of APIs and the boilerplate associated with them.
Review URL: http://codereview.chromium.org/7551032
TBR=brettw@chromium.org
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95342 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/thunk')
-rw-r--r-- | ppapi/thunk/ppb_audio_api.h | 7 | ||||
-rw-r--r-- | ppapi/thunk/ppb_audio_thunk.cc | 10 | ||||
-rw-r--r-- | ppapi/thunk/ppb_audio_trusted_api.h | 27 | ||||
-rw-r--r-- | ppapi/thunk/ppb_audio_trusted_thunk.cc | 11 |
4 files changed, 35 insertions, 20 deletions
diff --git a/ppapi/thunk/ppb_audio_api.h b/ppapi/thunk/ppb_audio_api.h index 3d21299..d105e1c 100644 --- a/ppapi/thunk/ppb_audio_api.h +++ b/ppapi/thunk/ppb_audio_api.h @@ -5,7 +5,6 @@ #ifndef PPAPI_THUNK_AUDIO_API_H_ #define PPAPI_THUNK_AUDIO_API_H_ -#include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/ppb_audio.h" namespace ppapi { @@ -18,12 +17,6 @@ class PPB_Audio_API { virtual PP_Resource GetCurrentConfig() = 0; virtual PP_Bool StartPlayback() = 0; virtual PP_Bool StopPlayback() = 0; - - // Trusted API. - virtual int32_t OpenTrusted(PP_Resource config_id, - PP_CompletionCallback create_callback) = 0; - virtual int32_t GetSyncSocket(int* sync_socket) = 0; - virtual int32_t GetSharedMemory(int* shm_handle, uint32_t* shm_size) = 0; }; } // namespace thunk diff --git a/ppapi/thunk/ppb_audio_thunk.cc b/ppapi/thunk/ppb_audio_thunk.cc index 18b70b6..426ba29 100644 --- a/ppapi/thunk/ppb_audio_thunk.cc +++ b/ppapi/thunk/ppb_audio_thunk.cc @@ -12,8 +12,6 @@ namespace thunk { namespace { -typedef EnterResource<PPB_Audio_API> EnterAudio; - PP_Resource Create(PP_Instance instance, PP_Resource config_id, PPB_Audio_Callback callback, @@ -26,26 +24,26 @@ PP_Resource Create(PP_Instance instance, } PP_Bool IsAudio(PP_Resource resource) { - EnterAudio enter(resource, false); + EnterResource<PPB_Audio_API> enter(resource, false); return enter.succeeded() ? PP_TRUE : PP_FALSE; } PP_Resource GetCurrentConfiguration(PP_Resource audio_id) { - EnterAudio enter(audio_id, true); + EnterResource<PPB_Audio_API> enter(audio_id, true); if (enter.failed()) return 0; return enter.object()->GetCurrentConfig(); } PP_Bool StartPlayback(PP_Resource audio_id) { - EnterAudio enter(audio_id, true); + EnterResource<PPB_Audio_API> enter(audio_id, true); if (enter.failed()) return PP_FALSE; return enter.object()->StartPlayback(); } PP_Bool StopPlayback(PP_Resource audio_id) { - EnterAudio enter(audio_id, true); + EnterResource<PPB_Audio_API> enter(audio_id, true); if (enter.failed()) return PP_FALSE; return enter.object()->StopPlayback(); diff --git a/ppapi/thunk/ppb_audio_trusted_api.h b/ppapi/thunk/ppb_audio_trusted_api.h new file mode 100644 index 0000000..de4b79a --- /dev/null +++ b/ppapi/thunk/ppb_audio_trusted_api.h @@ -0,0 +1,27 @@ +// Copyright (c) 2011 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 PPAPI_THUNK_AUDIO_TRUSTED_API_H_ +#define PPAPI_THUNK_AUDIO_TRUSTED_API_H_ + +#include "ppapi/c/trusted/ppb_audio_trusted.h" +#include "ppapi/c/ppb_audio.h" + +namespace ppapi { +namespace thunk { + +class PPB_AudioTrusted_API { + public: + virtual ~PPB_AudioTrusted_API() {} + + virtual int32_t OpenTrusted(PP_Resource config_id, + PP_CompletionCallback create_callback) = 0; + virtual int32_t GetSyncSocket(int* sync_socket) = 0; + virtual int32_t GetSharedMemory(int* shm_handle, uint32_t* shm_size) = 0; +}; + +} // namespace thunk +} // namespace ppapi + +#endif // PPAPI_THUNK_AUDIO_TRUSTED_API_H_ diff --git a/ppapi/thunk/ppb_audio_trusted_thunk.cc b/ppapi/thunk/ppb_audio_trusted_thunk.cc index 97f8978..05c1b4e 100644 --- a/ppapi/thunk/ppb_audio_trusted_thunk.cc +++ b/ppapi/thunk/ppb_audio_trusted_thunk.cc @@ -3,11 +3,10 @@ // found in the LICENSE file. #include "ppapi/c/pp_errors.h" -#include "ppapi/c/trusted/ppb_audio_trusted.h" #include "ppapi/thunk/common.h" #include "ppapi/thunk/enter.h" #include "ppapi/thunk/thunk.h" -#include "ppapi/thunk/ppb_audio_api.h" +#include "ppapi/thunk/ppb_audio_trusted_api.h" #include "ppapi/thunk/resource_creation_api.h" namespace ppapi { @@ -15,8 +14,6 @@ namespace thunk { namespace { -typedef EnterResource<PPB_Audio_API> EnterAudio; - PP_Resource Create(PP_Instance instance_id) { EnterFunction<ResourceCreationAPI> enter(instance_id, true); if (enter.failed()) @@ -27,7 +24,7 @@ PP_Resource Create(PP_Instance instance_id) { int32_t Open(PP_Resource audio_id, PP_Resource config_id, PP_CompletionCallback create_callback) { - EnterAudio enter(audio_id, true); + EnterResource<PPB_AudioTrusted_API> enter(audio_id, true); if (enter.failed()) return MayForceCallback(create_callback, PP_ERROR_BADRESOURCE); int32_t result = enter.object()->OpenTrusted(config_id, create_callback); @@ -35,7 +32,7 @@ int32_t Open(PP_Resource audio_id, } int32_t GetSyncSocket(PP_Resource audio_id, int* sync_socket) { - EnterAudio enter(audio_id, true); + EnterResource<PPB_AudioTrusted_API> enter(audio_id, true); if (enter.failed()) return PP_ERROR_BADRESOURCE; return enter.object()->GetSyncSocket(sync_socket); @@ -44,7 +41,7 @@ int32_t GetSyncSocket(PP_Resource audio_id, int* sync_socket) { int32_t GetSharedMemory(PP_Resource audio_id, int* shm_handle, uint32_t* shm_size) { - EnterAudio enter(audio_id, true); + EnterResource<PPB_AudioTrusted_API> enter(audio_id, true); if (enter.failed()) return PP_ERROR_BADRESOURCE; return enter.object()->GetSharedMemory(shm_handle, shm_size); |