diff options
author | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-30 21:54:43 +0000 |
---|---|---|
committer | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-30 21:54:43 +0000 |
commit | 09bd7bc27cf7544bdfb58fe0e21465b6485d599e (patch) | |
tree | ae66b0506d572fe287577288292cb3ae43ae68fd /ppapi/utility | |
parent | 7ed04df055beabf2300c1163be8e59812ecfb7bf (diff) | |
download | chromium_src-09bd7bc27cf7544bdfb58fe0e21465b6485d599e.zip chromium_src-09bd7bc27cf7544bdfb58fe0e21465b6485d599e.tar.gz chromium_src-09bd7bc27cf7544bdfb58fe0e21465b6485d599e.tar.bz2 |
Remove PPB_Ext_Socket_Dev.
BUG=366304,244653,312916,314899
TEST=None
Review URL: https://codereview.chromium.org/252923005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267348 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/utility')
-rw-r--r-- | ppapi/utility/completion_callback_factory.h | 169 |
1 files changed, 28 insertions, 141 deletions
diff --git a/ppapi/utility/completion_callback_factory.h b/ppapi/utility/completion_callback_factory.h index 3af860a..f755c5c 100644 --- a/ppapi/utility/completion_callback_factory.h +++ b/ppapi/utility/completion_callback_factory.h @@ -185,10 +185,6 @@ template <typename T> struct TypeUnwrapper<const T&> { /// is to accept your output argument as a non-const reference and to swap() /// the argument with a vector of your own to store it. This means you don't /// have to copy the buffer to consume it. -/// -/// NewExtCallbackWithOutput is similar to NewCallbackWithOutput. It creates -/// ext::ExtCompletionCallbackWithOutput instances which are used by APIs within -/// the pp::ext namespace. template <typename T, typename ThreadTraits = ThreadSafeThreadTraits> class CompletionCallbackFactory { public: @@ -295,33 +291,9 @@ class CompletionCallbackFactory { CompletionCallbackWithOutput< typename internal::TypeUnwrapper<Output>::StorageType> NewCallbackWithOutput(void (T::*method)(int32_t, Output)) { - typedef typename internal::TypeUnwrapper<Output>::StorageType - OutputStorageType; - typedef CompletionCallbackWithOutput<OutputStorageType> CallbackType; - typedef DispatcherWithOutput0< - typename CallbackType::TraitsType, - OutputStorageType, - void (T::*)(int32_t, Output)> DispatcherType; - return NewCallbackWithOutputHelper<CallbackType>( - new DispatcherType(method)); - } - - /// Similar to NewCallbackWithOutput(), but returns an - /// <code>ext::ExtCompletionCallbackWithOutput</code>. - template <typename Output> - ext::ExtCompletionCallbackWithOutput< - typename internal::TypeUnwrapper<Output>::StorageType> - NewExtCallbackWithOutput(void (T::*method)(int32_t, Output)) { - typedef typename internal::TypeUnwrapper<Output>::StorageType - OutputStorageType; - typedef ext::ExtCompletionCallbackWithOutput<OutputStorageType> - CallbackType; - typedef DispatcherWithOutput0< - typename CallbackType::TraitsType, - OutputStorageType, - void (T::*)(int32_t, Output)> DispatcherType; - return NewCallbackWithOutputHelper<CallbackType>( - new DispatcherType(method)); + return NewCallbackWithOutputHelper(new DispatcherWithOutput0< + typename internal::TypeUnwrapper<Output>::StorageType, + void (T::*)(int32_t, Output)>(method)); } /// NewCallback() allocates a new, single-use <code>CompletionCallback</code>. @@ -381,36 +353,10 @@ class CompletionCallbackFactory { typename internal::TypeUnwrapper<Output>::StorageType> NewCallbackWithOutput(void (T::*method)(int32_t, Output, A), const A& a) { - typedef typename internal::TypeUnwrapper<Output>::StorageType - OutputStorageType; - typedef CompletionCallbackWithOutput<OutputStorageType> CallbackType; - typedef DispatcherWithOutput1< - typename CallbackType::TraitsType, - OutputStorageType, - void (T::*)(int32_t, Output, A), - typename internal::TypeUnwrapper<A>::StorageType> DispatcherType; - return NewCallbackWithOutputHelper<CallbackType>( - new DispatcherType(method, a)); - } - - /// Similar to NewCallbackWithOutput(), but returns an - /// <code>ext::ExtCompletionCallbackWithOutput</code>. - template <typename Output, typename A> - ext::ExtCompletionCallbackWithOutput< - typename internal::TypeUnwrapper<Output>::StorageType> - NewExtCallbackWithOutput(void (T::*method)(int32_t, Output, A), - const A& a) { - typedef typename internal::TypeUnwrapper<Output>::StorageType - OutputStorageType; - typedef ext::ExtCompletionCallbackWithOutput<OutputStorageType> - CallbackType; - typedef DispatcherWithOutput1< - typename CallbackType::TraitsType, - OutputStorageType, + return NewCallbackWithOutputHelper(new DispatcherWithOutput1< + typename internal::TypeUnwrapper<Output>::StorageType, void (T::*)(int32_t, Output, A), - typename internal::TypeUnwrapper<A>::StorageType> DispatcherType; - return NewCallbackWithOutputHelper<CallbackType>( - new DispatcherType(method, a)); + typename internal::TypeUnwrapper<A>::StorageType>(method, a)); } /// NewCallback() allocates a new, single-use @@ -481,39 +427,11 @@ class CompletionCallbackFactory { NewCallbackWithOutput(void (T::*method)(int32_t, Output, A, B), const A& a, const B& b) { - typedef typename internal::TypeUnwrapper<Output>::StorageType - OutputStorageType; - typedef CompletionCallbackWithOutput<OutputStorageType> CallbackType; - typedef DispatcherWithOutput2< - typename CallbackType::TraitsType, - OutputStorageType, - void (T::*)(int32_t, Output, A, B), - typename internal::TypeUnwrapper<A>::StorageType, - typename internal::TypeUnwrapper<B>::StorageType> DispatcherType; - return NewCallbackWithOutputHelper<CallbackType>( - new DispatcherType(method, a, b)); - } - - /// Similar to NewCallbackWithOutput(), but returns an - /// <code>ext::ExtCompletionCallbackWithOutput</code>. - template <typename Output, typename A, typename B> - ext::ExtCompletionCallbackWithOutput< - typename internal::TypeUnwrapper<Output>::StorageType> - NewExtCallbackWithOutput(void (T::*method)(int32_t, Output, A, B), - const A& a, - const B& b) { - typedef typename internal::TypeUnwrapper<Output>::StorageType - OutputStorageType; - typedef ext::ExtCompletionCallbackWithOutput<OutputStorageType> - CallbackType; - typedef DispatcherWithOutput2< - typename CallbackType::TraitsType, - OutputStorageType, + return NewCallbackWithOutputHelper(new DispatcherWithOutput2< + typename internal::TypeUnwrapper<Output>::StorageType, void (T::*)(int32_t, Output, A, B), typename internal::TypeUnwrapper<A>::StorageType, - typename internal::TypeUnwrapper<B>::StorageType> DispatcherType; - return NewCallbackWithOutputHelper<CallbackType>( - new DispatcherType(method, a, b)); + typename internal::TypeUnwrapper<B>::StorageType>(method, a, b)); } /// NewCallback() allocates a new, single-use @@ -598,42 +516,12 @@ class CompletionCallbackFactory { const A& a, const B& b, const C& c) { - typedef typename internal::TypeUnwrapper<Output>::StorageType - OutputStorageType; - typedef CompletionCallbackWithOutput<OutputStorageType> CallbackType; - typedef DispatcherWithOutput3< - typename CallbackType::TraitsType, - OutputStorageType, - void (T::*)(int32_t, Output, A, B, C), - typename internal::TypeUnwrapper<A>::StorageType, - typename internal::TypeUnwrapper<B>::StorageType, - typename internal::TypeUnwrapper<C>::StorageType> DispatcherType; - return NewCallbackWithOutputHelper<CallbackType>( - new DispatcherType(method, a, b, c)); - } - - /// Similar to NewCallbackWithOutput(), but returns an - /// <code>ext::ExtCompletionCallbackWithOutput</code>. - template <typename Output, typename A, typename B, typename C> - ext::ExtCompletionCallbackWithOutput< - typename internal::TypeUnwrapper<Output>::StorageType> - NewExtCallbackWithOutput(void (T::*method)(int32_t, Output, A, B, C), - const A& a, - const B& b, - const C& c) { - typedef typename internal::TypeUnwrapper<Output>::StorageType - OutputStorageType; - typedef ext::ExtCompletionCallbackWithOutput<OutputStorageType> - CallbackType; - typedef DispatcherWithOutput3< - typename CallbackType::TraitsType, - OutputStorageType, + return NewCallbackWithOutputHelper(new DispatcherWithOutput3< + typename internal::TypeUnwrapper<Output>::StorageType, void (T::*)(int32_t, Output, A, B, C), typename internal::TypeUnwrapper<A>::StorageType, typename internal::TypeUnwrapper<B>::StorageType, - typename internal::TypeUnwrapper<C>::StorageType> DispatcherType; - return NewCallbackWithOutputHelper<CallbackType>( - new DispatcherType(method, a, b, c)); + typename internal::TypeUnwrapper<C>::StorageType>(method, a, b, c)); } private: @@ -720,10 +608,11 @@ class CompletionCallbackFactory { Method method_; }; - template <typename Traits, typename Output, typename Method> + template <typename Output, typename Method> class DispatcherWithOutput0 { public: typedef Output OutputType; + typedef internal::CallbackOutputTraits<Output> Traits; DispatcherWithOutput0() : method_(NULL), @@ -772,10 +661,11 @@ class CompletionCallbackFactory { A a_; }; - template <typename Traits, typename Output, typename Method, typename A> + template <typename Output, typename Method, typename A> class DispatcherWithOutput1 { public: typedef Output OutputType; + typedef internal::CallbackOutputTraits<Output> Traits; DispatcherWithOutput1() : method_(NULL), @@ -830,14 +720,11 @@ class CompletionCallbackFactory { B b_; }; - template <typename Traits, - typename Output, - typename Method, - typename A, - typename B> + template <typename Output, typename Method, typename A, typename B> class DispatcherWithOutput2 { public: typedef Output OutputType; + typedef internal::CallbackOutputTraits<Output> Traits; DispatcherWithOutput2() : method_(NULL), @@ -898,15 +785,12 @@ class CompletionCallbackFactory { C c_; }; - template <typename Traits, - typename Output, - typename Method, - typename A, - typename B, + template <typename Output, typename Method, typename A, typename B, typename C> class DispatcherWithOutput3 { public: typedef Output OutputType; + typedef internal::CallbackOutputTraits<Output> Traits; DispatcherWithOutput3() : method_(NULL), @@ -973,17 +857,20 @@ class CompletionCallbackFactory { } // Takes ownership of the dispatcher pointer, which should be heap allocated. - template <typename Callback, typename Dispatcher> - Callback NewCallbackWithOutputHelper(Dispatcher* dispatcher) { + template <typename Dispatcher> CompletionCallbackWithOutput< + typename internal::TypeUnwrapper< + typename Dispatcher::OutputType>::StorageType> + NewCallbackWithOutputHelper(Dispatcher* dispatcher) { typename ThreadTraits::AutoLock lock(lock_); PP_DCHECK(object_); // Expects a non-null object! CallbackData<Dispatcher>* data = new CallbackData<Dispatcher>(back_pointer_, dispatcher); - return Callback(&CallbackData<Dispatcher>::Thunk, - data, - data->dispatcher()->output()); + return CompletionCallbackWithOutput<typename Dispatcher::OutputType>( + &CallbackData<Dispatcher>::Thunk, + data, + data->dispatcher()->output()); } // Disallowed: |